Bladeren bron

Shorten some var names to be more readable

Sebastián Katzer 7 jaren geleden
bovenliggende
commit
ef16347ad1
1 gewijzigde bestanden met toevoegingen van 13 en 8 verwijderingen
  1. 13 8
      src/ios/APPLocalNotification.m

+ 13 - 8
src/ios/APPLocalNotification.m

@@ -38,6 +38,11 @@
 
 @implementation APPLocalNotification
 
+UNNotificationPresentationOptions const OptionNone  = UNNotificationPresentationOptionNone;
+UNNotificationPresentationOptions const OptionBadge = UNNotificationPresentationOptionBadge;
+UNNotificationPresentationOptions const OptionSound = UNNotificationPresentationOptionSound;
+UNNotificationPresentationOptions const OptionAlert = UNNotificationPresentationOptionAlert;
+
 @synthesize deviceready, isActive, eventQueue;
 
 #pragma mark -
@@ -503,13 +508,13 @@
  */
 - (void) userNotificationCenter:(UNUserNotificationCenter *)center
         willPresentNotification:(UNNotification *)notification
-          withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler
+          withCompletionHandler:(void (^)(UNNotificationPresentationOptions))handler
 {
     UNNotificationRequest* toast = notification.request;
 
     [_delegate userNotificationCenter:center
               willPresentNotification:notification
-                withCompletionHandler:completionHandler];
+                withCompletionHandler:handler];
 
     if ([toast.trigger isKindOfClass:UNPushNotificationTrigger.class])
         return;
@@ -521,11 +526,11 @@
     }
 
     if (options.silent) {
-        completionHandler(UNNotificationPresentationOptionNone);
+        handler(OptionNone);
     } else if (!isActive || options.priority > 0) {
-        completionHandler(UNNotificationPresentationOptionBadge|UNNotificationPresentationOptionSound|UNNotificationPresentationOptionAlert);
+        handler(OptionBadge|OptionSound|OptionAlert);
     } else {
-        completionHandler(UNNotificationPresentationOptionBadge|UNNotificationPresentationOptionSound);
+        handler(OptionBadge|OptionSound);
     }
 }
 
@@ -535,15 +540,15 @@
  */
 - (void) userNotificationCenter:(UNUserNotificationCenter *)center
  didReceiveNotificationResponse:(UNNotificationResponse *)response
-          withCompletionHandler:(void (^)(void))completionHandler
+          withCompletionHandler:(void (^)(void))handler
 {
     UNNotificationRequest* toast = response.notification.request;
 
     [_delegate userNotificationCenter:center
        didReceiveNotificationResponse:response
-                withCompletionHandler:completionHandler];
+                withCompletionHandler:handler];
 
-    completionHandler();
+    handler();
 
     if ([toast.trigger isKindOfClass:UNPushNotificationTrigger.class])
         return;