Last active
September 26, 2018 13:43
-
-
Save darthpelo/77ef2674b7d815819f4e16beee570670 to your computer and use it in GitHub Desktop.
This file contains hidden or 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, | |
continue userActivity: NSUserActivity, | |
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { | |
return handle(userAcitivity: userActivity) | |
} | |
// MARK: - Private | |
private func handle(userAcitivity activity: NSUserActivity) -> Bool { | |
switch activity.activityType { | |
case "com.mobiquity.TakeUrPill.history": | |
UserDefaults.standard.userSession = UserSession.History.rawValue | |
let notificationName = Notification.Name(rawValue: "com.mobiquity.TakeUrPill.history") | |
NotificationCenter.default.post(name: notificationName, object: nil) | |
return true | |
default:() | |
} | |
return false | |
} |
This file contains hidden or 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
// Function associated to the notification "com.mobiquity.TakeUrPill.history" | |
// triggered from AppDelegate | |
@objc func checkUserSession() { | |
userSession() | |
} | |
// The presenter checks in which status the user is. If he is in the History, it's not | |
// neccesary to show the History | |
private func userSession() { | |
if let presenter = presenter, presenter.showUserHistory() { | |
showHistory() | |
} | |
} | |
// This function just triggers the Flow Controller, that will bring the user to the | |
// History section | |
private func showHistory() { | |
configure?.controller.show() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment