Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
- // notification was never shown to the user
- if UserDefaults.standard.bool(forKey: "doNotShowNotificationAgain") == false {
- NotificationManager.shared.schedule(notification)
- }
- func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
- if notification.request.identifier == "remindUserToVisitScreenX" {
- UserDefaults.standard.set(true, forKey: "doNotShowNotificationAgain")
- }
- }
- //.. some uninteresting code
- override func viewWillAppear() {
- // if user notification has never been shown, reschedule (i.e. reset) notification
- NotificationManager.shared.schedule(notification)
- {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement