From 460e0c629a923fd939e83e84e6285d0e37248ba5 Mon Sep 17 00:00:00 2001 From: saeedbashir Date: Fri, 25 Aug 2023 09:21:09 +0500 Subject: [PATCH] chore: remove code in the code base around discover hardcoded path --- Source/OEXFindCoursesViewController.m | 6 +----- Source/WebView/DiscoveryHelper.swift | 4 +--- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/Source/OEXFindCoursesViewController.m b/Source/OEXFindCoursesViewController.m index 3b4767a41e..5da3e99c78 100644 --- a/Source/OEXFindCoursesViewController.m +++ b/Source/OEXFindCoursesViewController.m @@ -20,7 +20,6 @@ static NSString* const OEXFindCoursesCourseInfoPath = @"course_info/"; static NSString* const OEXFindCoursesPathIDKey = @"path_id"; -static NSString* const OEXFindCoursePathPrefix = @"course/"; @interface OEXFindCoursesViewController () @@ -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/" 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; } diff --git a/Source/WebView/DiscoveryHelper.swift b/Source/WebView/DiscoveryHelper.swift index f0afc3453c..8dcd88568f 100644 --- a/Source/WebView/DiscoveryHelper.swift +++ b/Source/WebView/DiscoveryHelper.swift @@ -12,7 +12,6 @@ import UIKit enum URIString: String { case appURLScheme = "edxapp" case pathPlaceHolder = "{path_id}" - case coursePathPrefix = "course/" } fileprivate enum URLParameterKeys: String, RawStringExtractable { @@ -47,8 +46,7 @@ enum WebviewActions: String { return nil } - // the site sends us things of the form "course/" 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)? {