Permalink
Browse files

CDV220 functionality check

Checked functionality for CDV220
uncrustified
  • Loading branch information...
1 parent 3627523 commit 073abd60a0dd207b1d354dacf664f77abff93a01 Randy McMillan committed Nov 13, 2012
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,3 +1,5 @@
+Cordova 2.2.0 functionality check Nov 13 2012 - @RandyMcMillan
+
Cordova 1.5.0 support added March 29 2012 - @RandyMcMillan
StatusBarHidden issue addressed
@@ -3,15 +3,13 @@
//
// Created by Grant Sanders on 12/25/2010.
-
#import <Foundation/Foundation.h>
#import <Cordova/CDVPlugin.h>
#import <MessageUI/MessageUI.h>
#import <MessageUI/MFMessageComposeViewController.h>
-@interface SMSComposer : CDVPlugin <MFMessageComposeViewControllerDelegate> {
-}
+@interface SMSComposer : CDVPlugin <MFMessageComposeViewControllerDelegate>{}
-- (void)showSMSComposer:(NSArray*)arguments withDict:(NSDictionary*)options;
+- (void)showSMSComposer:(NSArray *)arguments withDict:(NSDictionary *)options;
@end
@@ -9,83 +9,81 @@
@implementation SMSComposer
--(CDVPlugin*) initWithWebView:(UIWebView*)theWebView
+- (CDVPlugin *)initWithWebView:(UIWebView *)theWebView
{
- self = (SMSComposer*)[super initWithWebView:theWebView];
- return self;
+ self = (SMSComposer *)[super initWithWebView:theWebView];
+ return self;
}
-- (void)showSMSComposer:(NSArray*)arguments withDict:(NSDictionary*)options
+- (void)showSMSComposer:(NSArray *)arguments withDict:(NSDictionary *)options
{
-
Class messageClass = (NSClassFromString(@"MFMessageComposeViewController"));
- if (messageClass != nil) {
-
- if (![messageClass canSendText]) {
-
- UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Notice" message:@"SMS Text not available."
- delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
+
+ if (messageClass != nil) {
+ if (![messageClass canSendText]) {
+ UIAlertView *alert = [[UIAlertView alloc] initWithTitle :@"Notice" message:@"SMS Text not available."
+ delegate :self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
return;
- }
-
- } else {
- UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Notice" message:@"SMS Text not available."
- delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
+ }
+ } else {
+ UIAlertView *alert = [[UIAlertView alloc] initWithTitle :@"Notice" message:@"SMS Text not available."
+ delegate :self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
return;
}
-
-
- NSString* body = [options valueForKey:@"body"];
- NSString* toRecipientsString = [options valueForKey:@"toRecipients"];
-
- MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
-
- picker.messageComposeDelegate = self;
-
- if(body != nil)
+
+ NSString *body = [options valueForKey:@"body"];
+ NSString *toRecipientsString = [options valueForKey:@"toRecipients"];
+
+ MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
+
+ picker.messageComposeDelegate = self;
+
+ if (body != nil) {
picker.body = [options valueForKey:@"body"];
-
- if(toRecipientsString != nil)
- [picker setRecipients:[ toRecipientsString componentsSeparatedByString:@","]];
+ }
+
+ if (toRecipientsString != nil) {
+ [picker setRecipients:[toRecipientsString componentsSeparatedByString:@","]];
+ }
[self.viewController presentModalViewController:picker animated:YES];
- [[UIApplication sharedApplication] setStatusBarHidden:YES];///This hides the statusbar when the picker is presented -@RandyMcMillan
+ [[UIApplication sharedApplication] setStatusBarHidden:YES]; // /This hides the statusbar when the picker is presented -@RandyMcMillan
[picker release];
-
}
// Dismisses the composition interface when users tap Cancel or Send. Proceeds to update the message field with the result of the operation.
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
-{
- // Notifies users about errors associated with the interface
+{
+ // Notifies users about errors associated with the interface
int webviewResult = 0;
-
- switch (result)
- {
+
+ switch (result) {
case MessageComposeResultCancelled:
webviewResult = 0;
break;
+
case MessageComposeResultSent:
webviewResult = 1;
break;
+
case MessageComposeResultFailed:
webviewResult = 2;
break;
+
default:
webviewResult = 3;
break;
}
-
- [self.viewController dismissModalViewControllerAnimated:YES];
-
- NSString* jsString = [[NSString alloc] initWithFormat:@"window.plugins.smsComposer._didFinishWithResult(%d);",webviewResult];
+
+ [self.viewController dismissModalViewControllerAnimated:YES];
+
+ NSString *jsString = [[NSString alloc] initWithFormat:@"window.plugins.smsComposer._didFinishWithResult(%d);", webviewResult];
[self writeJavascript:jsString];
[jsString release];
-
}
-@end
+@end
View
@@ -1,60 +1,54 @@
<!DOCTYPE html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
<html>
- <!--
- #
- # Licensed to the Apache Software Foundation (ASF) under one
- # or more contributor license agreements. See the NOTICE file
- # distributed with this work for additional information
- # regarding copyright ownership. The ASF licenses this file
- # to you under the Apache License, Version 2.0 (the
- # "License"); you may not use this file except in compliance
- # with the License. You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing,
- # software distributed under the License is distributed on an
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- # KIND, either express or implied. See the License for the
- # specific language governing permissions and limitations
- # under the License.
- #
- -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta name = "format-detection" content = "telephone=no"/>
- <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width;" />
+ <meta name="format-detection" content="telephone=no" />
+ <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
- <title>Hello Cordova</title>
+ <title>Hello World</title>
</head>
<body>
<div class="app">
- <h1>Apache Cordova™</h1>
- <div id="deviceready">
- <p class="status pending blink">Connecting to Device</p>
- <p class="status complete blink hide">Device is Ready</p>
+ <h1>Apache Cordova</h1>
+ <div id="deviceready" class="blink">
+ <p class="event listening">Connecting to Device</p>
+ <p class="event received">Device is Ready</p>
+ </div <center><button onclick="cordova.exec(null,null, 'SMSComposer','showSMSComposer',[args])">Compose SMS</button></center>
+
+ >
</div>
- </div>
- <script type="text/javascript" src="cordova-2.0.0.js"></script>
- <script type="text/javascript" src="js/index.js"></script>
- <script type="text/javascript" charset="utf-8" src="SMSComposer.js"></script>
-
-
- <script type="text/javascript">
- app.initialize();
+ <script type="text/javascript" src="cordova-2.2.0.js"></script>
+ <script type="text/javascript" src="js/index.js"></script> <script type="text/javascript" charset="utf-8" src="SMSComposer.js"></script>
- var args;
+ <script type="text/javascript">
+ app.initialize();
+
+ var args;
+
+ // cordova.exec(null,null, 'SMSComposer','showSMSComposer',[args]);
+
+
+
+ </script>
- // cordova.exec(null,null, 'SMSComposer','showSMSComposer',[args]);
-
-
- </script>
-
-
- <center><button onclick="cordova.exec(null,null, 'SMSComposer','showSMSComposer',[args])">Compose SMS</button></center>
-
-
-
- </body>
+ </body>
</html>

0 comments on commit 073abd6

Please sign in to comment.