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

Commit 53763a2

Browse files
authored
fix: improve showing of IAP unlock controller (#1828)
1 parent 5c40075 commit 53763a2

3 files changed

+18
-0
lines changed

Source/CourseUpgradeHelper.swift

+6
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,12 @@ class CourseUpgradeHelper: NSObject {
238238
}
239239
}
240240

241+
// presented view appears on the unlock controller
242+
// need to bring it to front for better user experience
243+
func bringLoaderToFront() {
244+
unlockController.bringToFront()
245+
}
246+
241247
func removeLoader(success: Bool? = false, removeView: Bool? = false, completion: (()-> ())? = nil) {
242248
self.completion = completion
243249
if success == true {

Source/NewCourseDashboardViewController.swift

+4
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ class NewCourseDashboardViewController: UIViewController, InterfaceOrientationOv
118118
navigationItem.setHidesBackButton(true, animated: true)
119119
navigationController?.setNavigationBarHidden(true, animated: true)
120120
environment.analytics.trackScreen(withName: OEXAnalyticsScreenCourseDashboard, courseID: courseID, value: nil)
121+
122+
if let _ = courseUpgradeHelper.courseUpgradeModel {
123+
courseUpgradeHelper.bringLoaderToFront()
124+
}
121125
}
122126

123127
override func viewWillDisappear(_ animated: Bool) {

Source/ValuePropUnlockViewContainer.swift

+8
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ class ValuePropUnlockViewContainer: NSObject {
4848
}
4949
}
5050

51+
// the bring subview to front isn't work here because of hierarchy
52+
// removing and readding the view
53+
func bringToFront() {
54+
removeView() { [weak self] in
55+
self?.showView()
56+
}
57+
}
58+
5159
@objc private func finishTimer() {
5260
shouldDismiss.value = true
5361
}

0 commit comments

Comments
 (0)