You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ja...@apache.org on 2013/05/01 21:51:07 UTC
ios commit: [CB-3311] add default textbox for notification prompt
Updated Branches:
refs/heads/master 0a1319e3b -> 2f53c3ff6
[CB-3311] add default textbox for notification prompt
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/2f53c3ff
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/2f53c3ff
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/2f53c3ff
Branch: refs/heads/master
Commit: 2f53c3ff6548c0ac6d2cf6e8ad63debdabe0e663
Parents: 0a1319e
Author: James Jong <wj...@gmail.com>
Authored: Wed May 1 15:50:03 2013 -0400
Committer: James Jong <wj...@gmail.com>
Committed: Wed May 1 15:50:03 2013 -0400
----------------------------------------------------------------------
CordovaLib/Classes/CDVNotification.m | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/2f53c3ff/CordovaLib/Classes/CDVNotification.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVNotification.m b/CordovaLib/Classes/CDVNotification.m
index 821cb9f..464eb1f 100644
--- a/CordovaLib/Classes/CDVNotification.m
+++ b/CordovaLib/Classes/CDVNotification.m
@@ -31,10 +31,11 @@
* message The alert view message.
* title The alert view title.
* buttons The array of customized strings for the buttons.
+ * defaultText The input text for the textbox (if textbox exists).
* callbackId The commmand callback id.
* dialogType The type of alert view [alert | prompt].
*/
-- (void)showDialogWithMessage:(NSString*)message title:(NSString*)title buttons:(NSArray*)buttons callbackId:(NSString*)callbackId dialogType:(NSString*)dialogType
+- (void)showDialogWithMessage:(NSString*)message title:(NSString*)title buttons:(NSArray*)buttons defaultText:(NSString*)defaultText callbackId:(NSString*)callbackId dialogType:(NSString*)dialogType
{
CDVAlertView* alertView = [[CDVAlertView alloc]
initWithTitle:title
@@ -53,6 +54,8 @@
if ([dialogType isEqualToString:DIALOG_TYPE_PROMPT]) {
alertView.alertViewStyle = UIAlertViewStylePlainTextInput;
+ UITextField* textField = [alertView textFieldAtIndex:0];
+ textField.text = defaultText;
}
[alertView show];
@@ -65,7 +68,7 @@
NSString* title = [command argumentAtIndex:1];
NSString* buttons = [command argumentAtIndex:2];
- [self showDialogWithMessage:message title:title buttons:@[buttons] callbackId:callbackId dialogType:DIALOG_TYPE_ALERT];
+ [self showDialogWithMessage:message title:title buttons:@[buttons] defaultText:nil callbackId:callbackId dialogType:DIALOG_TYPE_ALERT];
}
- (void)confirm:(CDVInvokedUrlCommand*)command
@@ -75,7 +78,7 @@
NSString* title = [command argumentAtIndex:1];
NSArray* buttons = [command argumentAtIndex:2];
- [self showDialogWithMessage:message title:title buttons:buttons callbackId:callbackId dialogType:DIALOG_TYPE_ALERT];
+ [self showDialogWithMessage:message title:title buttons:buttons defaultText:nil callbackId:callbackId dialogType:DIALOG_TYPE_ALERT];
}
- (void)prompt:(CDVInvokedUrlCommand*)command
@@ -84,8 +87,9 @@
NSString* message = [command argumentAtIndex:0];
NSString* title = [command argumentAtIndex:1];
NSArray* buttons = [command argumentAtIndex:2];
+ NSString* defaultText = [command argumentAtIndex:3];
- [self showDialogWithMessage:message title:title buttons:buttons callbackId:callbackId dialogType:DIALOG_TYPE_PROMPT];
+ [self showDialogWithMessage:message title:title buttons:buttons defaultText:defaultText callbackId:callbackId dialogType:DIALOG_TYPE_PROMPT];
}
/**