Last active
November 15, 2019 00:02
-
-
Save JWPapi/362133f6769f4a8fcb4b2de61196b21d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |
IQKeyboardManager.shared.enable = true | |
IQKeyboardManager.shared.enableAutoToolbar = false | |
FirebaseApp.configure() | |
Messaging.messaging().delegate = self | |
UNUserNotificationCenter.current().delegate = self | |
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound] | |
UNUserNotificationCenter.current().requestAuthorization(options: authOptions,completionHandler: {_, _ in }) | |
application.registerForRemoteNotifications() | |
let sb = UIStoryboard.init(name: "Main", bundle: nil) | |
let VC = { () -> UIViewController in | |
if (launchOptions?[UIApplication.LaunchOptionsKey.remoteNotification] as? [AnyHashable: Any]) != nil { | |
let DashboardVC = sb.instantiateViewController(withIdentifier: "dashboard") as! DashBoardViewController | |
DashboardVC.friendsView = (nottype == "chat") | |
DashboardVC.chatUserSentId = (nottype == "chat") ? chatUserSentId : nil | |
DashboardVC.singleEvent = (nottype == "event") ? singleEvent : nil | |
return DashboardVC | |
} | |
if UserDefaults.standard.value(forKey: "session") as? String == "true" { | |
return sb.instantiateViewController(withIdentifier: "swreveal") | |
} | |
UserDefaults.standard.set("false", forKey: "session") | |
return sb.instantiateViewController(withIdentifier: "register") | |
} | |
let nvc = UINavigationController.init(rootViewController: VC()) | |
nvc.isNavigationBarHidden = true | |
self.window?.rootViewController = nvc | |
self.window?.makeKeyAndVisible() | |
return true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment