Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
chore: remove code in the code base around discover hardcoded path
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedbashir committed Aug 25, 2023
1 parent 6771e76 commit 460e0c6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
6 changes: 1 addition & 5 deletions Source/OEXFindCoursesViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

static NSString* const OEXFindCoursesCourseInfoPath = @"course_info/";
static NSString* const OEXFindCoursesPathIDKey = @"path_id";
static NSString* const OEXFindCoursePathPrefix = @"course/";

@interface OEXFindCoursesViewController () <WebViewNavigationDelegate, InterfaceOrientationOverriding>

Expand Down Expand Up @@ -100,10 +99,7 @@ - (DiscoveryConfig*)discoveryConfig {

- (NSString*)getCoursePathIDFromURL:(NSURL*)url {
if([url.scheme isEqualToString:OEXFindCoursesLinkURLScheme] && [url.oex_hostlessPath isEqualToString:OEXFindCoursesCourseInfoPath]) {
NSString* path = url.oex_queryParameters[OEXFindCoursesPathIDKey];
// the site sends us things of the form "course/<path_id>" we only want the path id
NSString* pathID = [path stringByReplacingOccurrencesOfString:OEXFindCoursePathPrefix withString:@"" options:0 range:NSMakeRange(0, OEXFindCoursePathPrefix.length)];
return pathID;
return url.oex_queryParameters[OEXFindCoursesPathIDKey];
}
return nil;
}
Expand Down
4 changes: 1 addition & 3 deletions Source/WebView/DiscoveryHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import UIKit
enum URIString: String {
case appURLScheme = "edxapp"
case pathPlaceHolder = "{path_id}"
case coursePathPrefix = "course/"
}

fileprivate enum URLParameterKeys: String, RawStringExtractable {
Expand Down Expand Up @@ -47,8 +46,7 @@ enum WebviewActions: String {
return nil
}

// the site sends us things of the form "course/<path_id>" we only want the path id
return path.replacingOccurrences(of: URIString.coursePathPrefix.rawValue, with: "")
return path
}

class func parse(url: URL) -> (courseId: String?, emailOptIn: Bool)? {
Expand Down

0 comments on commit 460e0c6

Please sign in to comment.