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

fix: improve showing of IAP unlock controller #1828

Merged
merged 2 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Source/CourseUpgradeHelper.swift
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading