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

Commit 09d71d1

Browse files
committed
Fixed color chooser iOS 12, Fixed non-called AppDelegate methods on pre-ios 13
1 parent 653e73d commit 09d71d1

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

Slide for Reddit/AppDelegate.swift

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
134134
var launchedURL: URL?
135135

136136
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
137+
let window = UIWindow(frame: UIScreen.main.bounds)
138+
self.window = window
139+
didFinishLaunching(window: window)
140+
137141
if #available(iOS 13.0, *) { return true } else {
138-
let window = UIWindow(frame: UIScreen.main.bounds)
139-
self.window = window
140-
didFinishLaunching(window: window)
141142
launchedURL = launchOptions?[UIApplication.LaunchOptionsKey.url] as? URL
142143
let remoteNotif = launchOptions?[UIApplication.LaunchOptionsKey.localNotification] as? UILocalNotification
143144

@@ -859,9 +860,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
859860
}
860861

861862
func applicationDidBecomeActive(_ application: UIApplication) {
862-
if #available(iOS 13.0, *) { return } else {
863-
didBecomeActive()
864-
}
863+
didBecomeActive()
865864
}
866865

867866
func didBecomeActive() {
@@ -904,9 +903,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
904903

905904
var backView: UIView?
906905
func applicationWillResignActive(_ application: UIApplication) {
907-
if #available(iOS 13.0, *) { return } else {
908-
willResignActive()
909-
}
906+
willResignActive()
910907
}
911908

912909
func willResignActive() {
@@ -989,9 +986,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
989986
}
990987

991988
func applicationDidEnterBackground(_ application: UIApplication) {
992-
if #available(iOS 13.0, *) { return } else {
993989
didEnterBackground()
994-
}
995990
}
996991

997992
func didEnterBackground() {

Slide for Reddit/SettingsTheme.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,11 @@ class SettingsTheme: BubbleSettingTableViewController, ColorPickerViewDelegate {
125125
presenter.sourceRect = selectedTableView.bounds
126126
}
127127

128-
UIApplication.shared.keyWindow?.rootViewController?.present(alertController, animated: true, completion: nil)
128+
if let presenter = self.navigationController {
129+
presenter.present(alertController, animated: true, completion: nil)
130+
} else {
131+
present(alertController, animated: true, completion: nil)
132+
}
129133
}
130134
}
131135

0 commit comments

Comments
 (0)