Repository: cordova-plugin-dialogs
Updated Branches:
  refs/heads/master e92ba3f85 -> 8f31f6f2c


correct block usage


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/commit/8f31f6f2
Tree: 
http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/tree/8f31f6f2
Diff: 
http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/diff/8f31f6f2

Branch: refs/heads/master
Commit: 8f31f6f2ca1952e2bc2b549d30875527c98e67ba
Parents: e92ba3f
Author: Jesse MacFadyen <purplecabb...@gmail.com>
Authored: Wed Nov 18 21:25:15 2015 -0800
Committer: Jesse MacFadyen <purplecabb...@gmail.com>
Committed: Wed Nov 18 21:25:15 2015 -0800

----------------------------------------------------------------------
 src/ios/CDVNotification.m | 53 +++++++++++++++++++++++-------------------
 1 file changed, 29 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/8f31f6f2/src/ios/CDVNotification.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVNotification.m b/src/ios/CDVNotification.m
index b10cb03..a4c95e9 100644
--- a/src/ios/CDVNotification.m
+++ b/src/ios/CDVNotification.m
@@ -59,31 +59,32 @@ static NSMutableArray *alertList = nil;
             
             alertController.view.frame =  alertFrame;
         }
-        
+
+        __weak CDVNotification* weakNotif = self;
+
         for (int n = 0; n < count; n++) {
             
             UIAlertAction* action = [UIAlertAction actionWithTitle:[buttons 
objectAtIndex:n] style:UIAlertActionStyleDefault handler:^(UIAlertAction * 
action)
-                                     {
-                                         CDVPluginResult* result;
-                                         
-                                         if ([dialogType 
isEqualToString:DIALOG_TYPE_PROMPT]) {
-                                             
-                                             NSString* value0 = 
[[alertController.textFields objectAtIndex:0] text];
-                                             NSDictionary* info = @{
-                                                                    
@"buttonIndex":@(n + 1),
-                                                                    
@"input1":(value0 ? value0 : [NSNull null])
-                                                                    };
-                                             result = [CDVPluginResult 
resultWithStatus:CDVCommandStatus_OK messageAsDictionary:info];
-                                             
-                                         } else {
-                                             
-                                             result = [CDVPluginResult 
resultWithStatus:CDVCommandStatus_OK messageAsInt:(int)(n  + 1)];
-                                             
-                                         }
-                                         
-                                         [self.commandDelegate 
sendPluginResult:result callbackId:callbackId];
-                                         
-                                     }];
+            {
+                CDVPluginResult* result;
+
+                if ([dialogType isEqualToString:DIALOG_TYPE_PROMPT])
+                {
+                    NSString* value0 = [[alertController.textFields 
objectAtIndex:0] text];
+                    NSDictionary* info = @{
+                        @"buttonIndex":@(n + 1),
+                        @"input1":(value0 ? value0 : [NSNull null])
+                    };
+                    result = [CDVPluginResult 
resultWithStatus:CDVCommandStatus_OK messageAsDictionary:info];
+                }
+                else
+                {
+                    result = [CDVPluginResult 
resultWithStatus:CDVCommandStatus_OK messageAsInt:(int)(n  + 1)];
+                }
+
+                [weakNotif.commandDelegate sendPluginResult:result 
callbackId:callbackId];
+
+            }];
             [alertController addAction:action];
             
         }
@@ -103,8 +104,11 @@ static NSMutableArray *alertList = nil;
             [self presentAlertcontroller];
         }
         
-    } else {
+    }
+    else
+    {
 #endif
+
         CDVAlertView* alertView = [[CDVAlertView alloc]
                                    initWithTitle:title
                                    message:message
@@ -227,10 +231,11 @@ static void soundCompletionCallback(SystemSoundID  ssid, 
void* data) {
 
 -(void)presentAlertcontroller {
     
+    __weak CDVNotification* weakNotif = self;
     [self.getTopPresentedViewController presentViewController:[alertList 
firstObject] animated:YES completion:^{
         [alertList removeObject:[alertList firstObject]];
         if ([alertList count]>0) {
-            [self presentAlertcontroller];
+            [weakNotif presentAlertcontroller];
         }
     }];
     


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org
For additional commands, e-mail: commits-h...@cordova.apache.org

Reply via email to