Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View WildStudio's full-sized avatar
Get shit done!

Christian Aranda WildStudio

Get shit done!
  • WildStudio
  • Barcelona
View GitHub Profile
protocol DeeplinkHandlerProtocol {
func handle(url: URL, completion:DeeplinkHandlerCompletion?) -> Bool
func handle(customScheme url: URL, completion:DeeplinkHandlerCompletion?) -> Bool
func handle(userActivity: NSUserActivity, completion:DeeplinkHandlerCompletion?) -> Bool
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
currentUserActivity = LaunchOptionsHandler.handle(launchOptions: launchOptions)
FirebaseApp.configure()
flowCoordinator.start { (error) in
}
return true
}
struct LaunchOptionsHandler {
static func handle(launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> NSUserActivity? {
if let activityType = launchOptions?[.userActivityType] as? String {
if activityType == NSUserActivityTypeBrowsingWeb {
return NSUserActivity(activityType: NSUserActivityTypeBrowsingWeb)
}
}
enum StartupState {
case authenticated, deeplink, unauthenticated
}
fileprivate var isCurrentUserActivity:Bool {
get {
let appDelegte = UIApplication.shared.delegate as! AppDelegate
return appDelegte.currentUserActivity != nil
}
}