5 // Created by Marcus Rohrmoser on 09.06.19.
6 // Copyright © 2019-2022 Marcus Rohrmoser mobile Software http://mro.name/me. All rights reserved.
8 // This program is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation, either version 3 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program. If not, see <http://www.gnu.org/licenses/>.
25 class AppDelegate: UIResponder, UIApplicationDelegate {
27 static let shared = UIApplication.shared.delegate as! AppDelegate
29 let semver = info_to_semver(Bundle.main.infoDictionary)
33 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
35 UINavigationBar.appearance().barTintColor = .darkGray
36 UINavigationBar.appearance().tintColor = ShaarliM.buttonColor
37 // UIBarButtonItem.appearance().tintColor = ShaarliM.buttonColor
38 UIButton.appearance().tintColor = ShaarliM.buttonColor
39 UILabel.appearance(whenContainedInInstancesOf: [SettingsVC.self]).textColor = ShaarliM.labelColor
41 let info = Bundle.main.infoDictionary ?? [:]
42 assert(BUNDLE_ID == info["CFBundleIdentifier"] as? String, "CFBundleIdentifier")
43 let urlt = info["CFBundleURLTypes"] as? [[String:Any]]
44 let urls = urlt?[0]["CFBundleURLSchemes"] as? [String]
45 assert(SELF_URL_PREFIX == urls?[0], "CFBundleURLTypes"+"/"+"CFBundleURLSchemes")
47 // UIView.setAnimationsEnabled(false) // nil != launchOptions[UIApplicationLaunchOptionsURLKey]];
52 func applicationWillResignActive(_ application: UIApplication) {
53 // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
54 // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
57 func applicationDidEnterBackground(_ application: UIApplication) {
58 // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
59 // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
62 func applicationWillEnterForeground(_ application: UIApplication) {
63 // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
66 func applicationDidBecomeActive(_ application: UIApplication) {
67 // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
70 func applicationWillTerminate(_ application: UIApplication) {
71 // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.