You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/03/14 16:36:29 UTC

ios commit: [CB-1933] Changed button labels to an array.

Updated Branches:
  refs/heads/master a28c77128 -> ec411f183


[CB-1933] Changed button labels to an array.

This allows commas to be included in button label text.


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/ec411f18
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/ec411f18
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/ec411f18

Branch: refs/heads/master
Commit: ec411f18309d577b4debefd9a2f085ba719701d5
Parents: a28c771
Author: Max Woghiren <ma...@gmail.com>
Authored: Fri Feb 15 14:53:33 2013 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Mar 14 11:36:25 2013 -0400

----------------------------------------------------------------------
 CordovaLib/Classes/CDVNotification.m |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ec411f18/CordovaLib/Classes/CDVNotification.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVNotification.m b/CordovaLib/Classes/CDVNotification.m
index 992239e..6b1b35f 100644
--- a/CordovaLib/Classes/CDVNotification.m
+++ b/CordovaLib/Classes/CDVNotification.m
@@ -22,7 +22,7 @@
 
 @implementation CDVNotification
 
-- (void)showDialogWithMessage:(NSString*)message title:(NSString*)title buttons:(NSString*)buttons callbackId:(NSString*)callbackId
+- (void)showDialogWithMessage:(NSString*)message title:(NSString*)title buttons:(NSArray*)buttons callbackId:(NSString*)callbackId
 {
     CDVAlertView* alertView = [[CDVAlertView alloc]
             initWithTitle:title
@@ -33,11 +33,10 @@
 
     alertView.callbackId = callbackId;
 
-    NSArray* labels = [buttons componentsSeparatedByString:@","];
-    int count = [labels count];
+    int count = [buttons count];
 
     for (int n = 0; n < count; n++) {
-        [alertView addButtonWithTitle:[labels objectAtIndex:n]];
+        [alertView addButtonWithTitle:[buttons objectAtIndex:n]];
     }
 
     [alertView show];
@@ -60,7 +59,7 @@
         buttons = NSLocalizedString(@"OK", @"OK");
     }
 
-    [self showDialogWithMessage:message title:title buttons:buttons callbackId:callbackId];
+    [self showDialogWithMessage:message title:title buttons:@[buttons] callbackId:callbackId];
 }
 
 - (void)confirm:(CDVInvokedUrlCommand*)command
@@ -71,13 +70,13 @@
 
     NSString* message = argc > 0 ? [arguments objectAtIndex:0] : nil;
     NSString* title = argc > 1 ? [arguments objectAtIndex:1] : nil;
-    NSString* buttons = argc > 2 ? [arguments objectAtIndex:2] : nil;
+    NSArray* buttons = argc > 2 ? [arguments objectAtIndex:2] : nil;
 
     if (!title) {
         title = NSLocalizedString(@"Confirm", @"Confirm");
     }
     if (!buttons) {
-        buttons = NSLocalizedString(@"OK,Cancel", @"OK,Cancel");
+        buttons = @[NSLocalizedString(@"OK", @"OK"), NSLocalizedString(@"Cancel", @"Cancel")];
     }
 
     [self showDialogWithMessage:message title:title buttons:buttons callbackId:callbackId];