Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
  2.  
  3. // notification was never shown to the user
  4. if UserDefaults.standard.bool(forKey: "doNotShowNotificationAgain") == false {
  5. NotificationManager.shared.schedule(notification)
  6. }
  7.  
  8.  
  9. func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
  10. if notification.request.identifier == "remindUserToVisitScreenX" {
  11. UserDefaults.standard.set(true, forKey: "doNotShowNotificationAgain")
  12. }
  13. }
  14.  
  15. //.. some uninteresting code
  16.  
  17.  
  18. override func viewWillAppear() {
  19. // if user notification has never been shown, reschedule (i.e. reset) notification
  20. NotificationManager.shared.schedule(notification)
  21. {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement