|
1 | | -/* |
2 | | - MIT License |
3 | | - |
4 | | - Copyright (c) 2017-2019 MessageKit |
5 | | - |
6 | | - Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | | - of this software and associated documentation files (the "Software"), to deal |
8 | | - in the Software without restriction, including without limitation the rights |
9 | | - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
10 | | - copies of the Software, and to permit persons to whom the Software is |
11 | | - furnished to do so, subject to the following conditions: |
12 | | - |
13 | | - The above copyright notice and this permission notice shall be included in all |
14 | | - copies or substantial portions of the Software. |
15 | | - |
16 | | - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | | - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | | - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | | - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
20 | | - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
21 | | - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
22 | | - SOFTWARE. |
23 | | - */ |
| 1 | +// MIT License |
| 2 | +// |
| 3 | +// Copyright (c) 2017-2019 MessageKit |
| 4 | +// |
| 5 | +// Permission is hereby granted, free of charge, to any person obtaining a copy |
| 6 | +// of this software and associated documentation files (the "Software"), to deal |
| 7 | +// in the Software without restriction, including without limitation the rights |
| 8 | +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 9 | +// copies of the Software, and to permit persons to whom the Software is |
| 10 | +// furnished to do so, subject to the following conditions: |
| 11 | +// |
| 12 | +// The above copyright notice and this permission notice shall be included in all |
| 13 | +// copies or substantial portions of the Software. |
| 14 | +// |
| 15 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 18 | +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 20 | +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 21 | +// SOFTWARE. |
24 | 22 |
|
25 | 23 | import UIKit |
26 | 24 |
|
27 | 25 | @UIApplicationMain |
28 | 26 | final internal class AppDelegate: UIResponder, UIApplicationDelegate { |
| 27 | + var window: UIWindow? |
29 | 28 |
|
30 | | - var window: UIWindow? |
| 29 | + func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { |
| 30 | + let masterViewController = UINavigationController(rootViewController: LaunchViewController()) |
| 31 | + let splitViewController = UISplitViewController() |
| 32 | + splitViewController.viewControllers = UIDevice.current.userInterfaceIdiom == .pad |
| 33 | + ? [ |
| 34 | + masterViewController, |
| 35 | + UIViewController() |
| 36 | + ] |
| 37 | + : [masterViewController] |
| 38 | + splitViewController.preferredDisplayMode = .allVisible |
31 | 39 |
|
32 | | - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { |
| 40 | + window = UIWindow(frame: UIScreen.main.bounds) |
| 41 | + window?.rootViewController = splitViewController |
| 42 | + window?.makeKeyAndVisible() |
33 | 43 |
|
34 | | - let masterViewController = UINavigationController(rootViewController: LaunchViewController()) |
35 | | - let splitViewController = UISplitViewController() |
36 | | - splitViewController.viewControllers = UIDevice.current.userInterfaceIdiom == .pad ? [masterViewController, UIViewController()] : [masterViewController] |
37 | | - splitViewController.preferredDisplayMode = .allVisible |
38 | | - |
39 | | - window = UIWindow(frame: UIScreen.main.bounds) |
40 | | - window?.rootViewController = splitViewController |
41 | | - window?.makeKeyAndVisible() |
42 | | - |
43 | | - if UserDefaults.isFirstLaunch() { |
44 | | - // Enable Text Messages |
45 | | - UserDefaults.standard.set(true, forKey: "Text Messages") |
46 | | - } |
47 | | - |
48 | | - return true |
| 44 | + if UserDefaults.isFirstLaunch() { |
| 45 | + // Enable Text Messages |
| 46 | + UserDefaults.standard.set(true, forKey: "Text Messages") |
49 | 47 | } |
50 | 48 |
|
| 49 | + return true |
| 50 | + } |
51 | 51 | } |
0 commit comments