// // Pickt.swift // Pickt // // Created by Morris Richman on 2/24/22. // import Foundation import SwiftUI import TMDb import GoogleMobileAds import Firebase @main struct Pickt: App { // @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate @State var create = false @State var join = false @StateObject var firebaseRetrieve = firebase1() init() { UserDefaults.standard.register(defaults: ["welcomePopup" : true]) NetworkMonitor.shared.startMonitoring() GADMobileAds.sharedInstance().start(completionHandler: nil) Utilities.getAppType() let providerFactory = YourAppCheckProviderFactory() AppCheck.setAppCheckProviderFactory(providerFactory) FirebaseApp.configure() // setupFPN(application: application) Utilities.fetchRemoteConfig() Auth.auth().signIn(withEmail: Utilities.remoteConfig["accessEmail"].stringValue!, password: Utilities.remoteConfig["accessPassword"].stringValue!) { (result, error) in if error != nil { print("error = \(error!.localizedDescription)") }else { print("result = \(result!)") print("uid = \(String(describing: Auth.auth().currentUser?.uid))") } } Utilities.openNum = UserDefaults.standard.integer(forKey: "openNum") + 1 UserDefaults.standard.set(UserDefaults.standard.integer(forKey: "openNum") + 1, forKey: "openNum") CDYelpFusionKitManager.shared.configure() if Utilities.switchEnabled { let type = UserDefaults.standard.string(forKey: "picktType") if type == Utilities.picktTypeOpt.media.rawValue { Utilities.picktType = .media }else if type == Utilities.picktTypeOpt.restaurants.rawValue { Utilities.picktType = .restaurants } } Utilities.getShareMode() if Utilities.fontSize > 23 { Utilities.fontSize = 23 } print("Utilities.build = \(Utilities.build!), Utilities.version = \(Utilities.version!)") print("stored version = \(UserDefaults.standard.double(forKey: "version"))") print("fontSize = \(Utilities.fontSize)") } var body: some Scene { WindowGroup { ContentView(join: $join, create: $create, showPicker: false, setMock: .constant([])) .environmentObject(firebaseRetrieve) .onOpenURL { url in let scheme = url.scheme let host = url.host let path = url.path let components = url.pathComponents print("url: \(url)") print("scheme: \(String(describing: scheme))") print("host: \(String(describing: host))") print("path: \(path)") print("components: \(components)") if host == "join" { print("join") Utilities.code = path.replacingOccurrences(of: "/", with: "") print("code = \(Utilities.code)") join = true }else if host == "create" { Utilities.location = path.replacingOccurrences(of: "/", with: "") create = true } print("create = \(create), join = \(join)") } } } }