diff --git a/Source/CourseUpgradeHelper.swift b/Source/CourseUpgradeHelper.swift index 5f7db2aed..1e6c868c4 100644 --- a/Source/CourseUpgradeHelper.swift +++ b/Source/CourseUpgradeHelper.swift @@ -238,6 +238,12 @@ class CourseUpgradeHelper: NSObject { } } + // presented view appears on the uplock controller + // need to bring it to front for better user experience + func bringLoaderToFront() { + unlockController.bringToFront() + } + func removeLoader(success: Bool? = false, removeView: Bool? = false, completion: (()-> ())? = nil) { self.completion = completion if success == true { diff --git a/Source/NewCourseDashboardViewController.swift b/Source/NewCourseDashboardViewController.swift index b94a7aefa..0dfa278a6 100644 --- a/Source/NewCourseDashboardViewController.swift +++ b/Source/NewCourseDashboardViewController.swift @@ -118,6 +118,10 @@ class NewCourseDashboardViewController: UIViewController, InterfaceOrientationOv navigationItem.setHidesBackButton(true, animated: true) navigationController?.setNavigationBarHidden(true, animated: true) environment.analytics.trackScreen(withName: OEXAnalyticsScreenCourseDashboard, courseID: courseID, value: nil) + + if let _ = courseUpgradeHelper.courseUpgradeModel { + courseUpgradeHelper.bringLoaderToFront() + } } override func viewWillDisappear(_ animated: Bool) { diff --git a/Source/ValuePropUnlockViewContainer.swift b/Source/ValuePropUnlockViewContainer.swift index e1f182dff..9bda12fba 100644 --- a/Source/ValuePropUnlockViewContainer.swift +++ b/Source/ValuePropUnlockViewContainer.swift @@ -48,6 +48,14 @@ class ValuePropUnlockViewContainer: NSObject { } } + // the bring subview to front isn't work here because of hierarchy + // removing and readding the view + func bringToFront() { + removeView() { [weak self] in + self?.showView() + } + } + @objc private func finishTimer() { shouldDismiss.value = true }