Created
December 6, 2018 09:15
-
-
Save shakemno/11eda9d747dfcb8090c194543c8c1170 to your computer and use it in GitHub Desktop.
Untested idea to handle the native StoreKit in-app Review alert presentation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NotificationCenter | |
.default.reactive.notifications(forName: nil, object: nil) | |
.take(duringLifetimeOf: self) | |
.observe(on: UIScheduler()) | |
.filter { note in | |
return note.name == Notification.Name.init("UITextEffectsWindowDidRotateNotification") | |
} | |
.observeValues { (note) in | |
print("⚠️ \(UIApplication.shared.windows.count)") | |
for window in UIApplication.shared.windows { | |
if let controller = window.rootViewController { | |
print("🔺 \(type(of: controller))") | |
// Count subviews of the windows viewcontroller view not containing ROOTVIEWCONTROLLER. | |
guard type(of: controller) != ROOTVIEWCONTROLLER.self else { | |
continue | |
} | |
for view in controller.view.subviews { | |
print("🔻 \(view) : \(view.subviews)") | |
// If view.subviews > 2 the window is probably presenting a view... | |
for sub in view.subviews { | |
print("🔻 \(sub) : \(sub.subviews)") | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment