-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathAppDelegate.swift
More file actions
55 lines (46 loc) · 1.78 KB
/
AppDelegate.swift
File metadata and controls
55 lines (46 loc) · 1.78 KB
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
50
51
52
53
54
55
// Tella
//
// Copyright © 2022 HORIZONTAL.
// Licensed under MIT (https://github.com/Horizontal-org/Tella-iOS/blob/develop/LICENSE)
//
import Foundation
import UIKit
import SwiftyDropbox
import GoogleSignIn
class AppDelegate: NSObject, UIApplicationDelegate {
var backgroundSessionCompletionHandler: (() -> Void)?
static private(set) var instance: AppDelegate! = nil
@Published var shouldHandleTimeout : Bool = false
@Published var appWillTerminate : Bool = false
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
AppDelegate.instance = self
setupDropbox()
configureGoogleSignIn()
return true
}
func applicationWillTerminate(_ application: UIApplication) {
appWillTerminate = true
}
func application(
_ application: UIApplication,
handleEventsForBackgroundURLSession
handleEventsForBackgroundURLSessionidentifier: String,
completionHandler: @escaping () -> Void) {
backgroundSessionCompletionHandler = completionHandler
shouldHandleTimeout = true
}
private func setupDropbox() {
guard let dropboxAppKey = ConfigurationManager.getValue(DropboxAuthConstants.dropboxAppKey) else {
debugLog("Dropbox App Key not found")
return
}
DropboxClientsManager.setupWithAppKey(dropboxAppKey)
}
func configureGoogleSignIn() {
guard let clientID = ConfigurationManager.getValue(GoogleAuthConstants.gDriveClientID) else {
debugLog("Google Drive Client ID not found")
return
}
GIDSignIn.sharedInstance.configuration = GIDConfiguration(clientID: clientID)
}
}