Commit 6ffb58bb authored by Bob Easterday's avatar Bob Easterday
Browse files

Merge pull request #32 from florianbachmann/master

Use & instead of your large and error prone if statements
parents 1247986a b51d164a
Loading
Loading
Loading
Loading
+3 −20
Changes for src/ios/PushPlugin.m: 3 added lines, 20 removed lines.
Original line number Diff line number Diff line
@@ -124,30 +124,13 @@
        // one is actually disabled. So we are literally checking to see if rnTypes matches what is turned on, instead of by number. The "tricky" part is that the
        // single notification types will only match if they are the ONLY one enabled.  Likewise, when we are checking for a pair of notifications, it will only be
        // true if those two notifications are on.  This is why the code is written this way
        if(rntypes == UIRemoteNotificationTypeBadge){
        if(rntypes & UIRemoteNotificationTypeBadge){
            pushBadge = @"enabled";
        }
        else if(rntypes == UIRemoteNotificationTypeAlert){
        if(rntypes & UIRemoteNotificationTypeAlert) {
            pushAlert = @"enabled";
        }
        else if(rntypes == UIRemoteNotificationTypeSound){
          pushSound = @"enabled";
        }
        else if(rntypes == ( UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert)){
          pushBadge = @"enabled";
          pushAlert = @"enabled";
        }
        else if(rntypes == ( UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)){
          pushBadge = @"enabled";
          pushSound = @"enabled";
        }
        else if(rntypes == ( UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)){
          pushAlert = @"enabled";
          pushSound = @"enabled";
        }
        else if(rntypes == ( UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)){
          pushBadge = @"enabled";
          pushAlert = @"enabled";
        if(rntypes & UIRemoteNotificationTypeSound) {
            pushSound = @"enabled";
        }