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

Commit

Permalink
fix: improve showing of IAP unlock controller (#1828)
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedbashir committed May 3, 2024
1 parent 5c40075 commit 53763a2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Source/CourseUpgradeHelper.swift
Expand Up @@ -238,6 +238,12 @@ class CourseUpgradeHelper: NSObject {
}
}

// presented view appears on the unlock 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 {
Expand Down
4 changes: 4 additions & 0 deletions Source/NewCourseDashboardViewController.swift
Expand Up @@ -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) {
Expand Down
8 changes: 8 additions & 0 deletions Source/ValuePropUnlockViewContainer.swift
Expand Up @@ -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
}
Expand Down

0 comments on commit 53763a2

Please sign in to comment.