diff --git a/Source/NewCourseDashboardViewController.swift b/Source/NewCourseDashboardViewController.swift index 9b32e055f..413acd01a 100644 --- a/Source/NewCourseDashboardViewController.swift +++ b/Source/NewCourseDashboardViewController.swift @@ -85,12 +85,12 @@ class NewCourseDashboardViewController: UIViewController, InterfaceOrientationOv private let environment: Environment let courseID: String private let screen: CourseUpgradeScreen = .courseDashboard - private let fromEnrollment: Bool + private let newEnrollment: Bool - init(environment: Environment, courseID: String, fromEnrollment: Bool = false) { + init(environment: Environment, courseID: String, newEnrollment: Bool = false) { self.environment = environment self.courseID = courseID - self.fromEnrollment = fromEnrollment + self.newEnrollment = newEnrollment self.courseStream = BackedStream() self.loadStateController = LoadStateViewController() super.init(nibName: nil, bundle: nil) @@ -106,7 +106,7 @@ class NewCourseDashboardViewController: UIViewController, InterfaceOrientationOv navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil) addSubviews() - let delay = fromEnrollment ? 0.5 : 0 + let delay = newEnrollment ? 0.5 : 0 DispatchQueue.main.asyncAfter(deadline: .now() + delay) { [weak self] in self?.loadCourseStream() } diff --git a/Source/OEXCourseInfoViewController.m b/Source/OEXCourseInfoViewController.m index ea6978c9e..4424be0a4 100644 --- a/Source/OEXCourseInfoViewController.m +++ b/Source/OEXCourseInfoViewController.m @@ -118,7 +118,7 @@ - (void)parseURL:(NSURL*)url getCourseID:(NSString* __autoreleasing*)courseID em } - (void)showMainScreenWithMessage:(NSString*)message courseID:(NSString*)courseID { - [self.environment.router showMyCoursesWithAnimated:YES pushingCourseWithID:courseID fromEnrollment:YES]; + [self.environment.router showMyCoursesAnimated:YES pushingCourseWithID:courseID]; [self performSelector:@selector(postEnrollmentSuccessNotification:) withObject:message afterDelay:0.5]; } diff --git a/Source/OEXRouter+Swift.swift b/Source/OEXRouter+Swift.swift index fd86a6ada..4774164d9 100644 --- a/Source/OEXRouter+Swift.swift +++ b/Source/OEXRouter+Swift.swift @@ -210,12 +210,12 @@ extension OEXRouter { return controllerForBlockWithID(blockID: block.blockID, type: block.displayType, courseID: courseID, gated: block.isGated, shouldCelebrationAppear: shouldCelebrationAppear) } - @objc func showMyCourses(animated: Bool = true, pushingCourseWithID courseID: String? = nil, fromEnrollment: Bool = false) { + @objc(showMyCoursesAnimated:pushingCourseWithID:) func showMyCourses(animated: Bool = true, pushingCourseWithID courseID: String? = nil) { let controller = EnrolledTabBarViewController(environment: environment) let learnController = controller.children.flatMap { $0.children }.compactMap { $0 as? LearnContainerViewController } .first showContentStack(withRootController: controller, animated: animated) if let courseID = courseID, let learnController = learnController { - showCourseWithID(courseID: courseID, fromController: learnController, animated: false, fromEnrollment: fromEnrollment) + showCourseWithID(courseID: courseID, fromController: learnController, animated: false, newEnrollment: true) } } @@ -560,9 +560,9 @@ extension OEXRouter { c.loadRequest(request: URLRequest(url: url as URL) as NSURLRequest) } - func showCourseWithID(courseID: String, fromController: UIViewController, animated: Bool = true, fromEnrollment: Bool = false, completion: ((UIViewController) -> Void)? = nil) { + func showCourseWithID(courseID: String, fromController: UIViewController, animated: Bool = true, newEnrollment: Bool = false, completion: ((UIViewController) -> Void)? = nil) { if environment.config.isNewDashboardEnabled { - let courseDashboardViewController = NewCourseDashboardViewController(environment: environment, courseID: courseID, fromEnrollment: fromEnrollment) + let courseDashboardViewController = NewCourseDashboardViewController(environment: environment, courseID: courseID, newEnrollment: newEnrollment) let controller = ForwardingNavigationController(rootViewController: courseDashboardViewController) controller.navigationController?.setNavigationBarHidden(true, animated: false) controller.modalPresentationStyle = .fullScreen diff --git a/Source/WebView/DiscoveryHelper.swift b/Source/WebView/DiscoveryHelper.swift index cf07bbfce..8dcd88568 100644 --- a/Source/WebView/DiscoveryHelper.swift +++ b/Source/WebView/DiscoveryHelper.swift @@ -72,7 +72,7 @@ enum WebviewActions: String { } private class func showMainScreen(with message: String, and courseId: String, from controller: UIViewController) { - OEXRouter.shared().showMyCourses(animated: true, pushingCourseWithID: courseId, fromEnrollment: controller is OEXCourseInfoViewController ? true : false) + OEXRouter.shared().showMyCourses(animated: true, pushingCourseWithID: courseId) let delay = DispatchTime.now() + Double(Int64(0.5 * TimeInterval(NSEC_PER_SEC))) / Double(NSEC_PER_SEC) DispatchQueue.main.asyncAfter(deadline: delay) { postEnrollmentSuccessNotification(message: message, from: controller)