-
Notifications
You must be signed in to change notification settings - Fork 0
/
AppDelegate.swift
49 lines (40 loc) · 1.68 KB
/
AppDelegate.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// AppDelegate.swift
// PoocoinV2
//
// Created by Pozdnyshev Maksim on 6/28/21.
//
import UIKit
import Firebase
import YandexMobileMetrica
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
let configuration = YMMYandexMetricaConfiguration.init(apiKey: "911fb408-ca79-4976-aa08-41a62d820705")
YMMYandexMetrica.activate(with: configuration!)
window = UIWindow(frame: UIScreen.main.bounds)
if UserDefaults.standard.bool(forKey: "onboarding") {
window?.rootViewController = TabbarController()
} else {
window?.rootViewController = OnboardingViewController() // TabbarController()
}
window?.makeKeyAndVisible()
return true
}
func applicationWillEnterForeground(_ application: UIApplication) {
BaseSocketManager.shared.restartSubscriptons()
}
func applicationDidEnterBackground(_ application: UIApplication) {
BaseSocketManager.shared.stopSubscription()
}
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
if UIDevice.current.userInterfaceIdiom == .phone {
if let tabbar = window?.rootViewController as? TabbarController, let nav = tabbar.selectedViewController as? UINavigationController, let chart = nav.viewControllers.last as? ChartController {
return chart.allowRotation ? .all : .portrait
}
}
return .portrait
}
}