You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2015/03/07 01:18:29 UTC
[16/43] ios commit: Moved CDVWebViewUIDelegate into Classes folder
Moved CDVWebViewUIDelegate into Classes folder
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/4c0556bd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/4c0556bd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/4c0556bd
Branch: refs/heads/4.0.x
Commit: 4c0556bd611d3f93fa119592e2d16f37163b6925
Parents: 1a759ac
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu Jul 17 16:48:13 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Fri Oct 31 15:37:43 2014 -0700
----------------------------------------------------------------------
CordovaLib/CDVWebViewUIDelegate.h | 35 ------
CordovaLib/CDVWebViewUIDelegate.m | 126 -------------------
CordovaLib/Classes/CDVWebViewUIDelegate.h | 35 ++++++
CordovaLib/Classes/CDVWebViewUIDelegate.m | 126 +++++++++++++++++++
CordovaLib/CordovaLib.xcodeproj/project.pbxproj | 4 +-
5 files changed, 163 insertions(+), 163 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4c0556bd/CordovaLib/CDVWebViewUIDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaLib/CDVWebViewUIDelegate.h b/CordovaLib/CDVWebViewUIDelegate.h
deleted file mode 100644
index 9ff2ac1..0000000
--- a/CordovaLib/CDVWebViewUIDelegate.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- 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.
- */
-
-#import <Foundation/Foundation.h>
-
-#ifdef __IPHONE_8_0
- #import <WebKit/WebKit.h>
-#endif
-
-@interface CDVWebViewUIDelegate : NSObject
-#ifdef __IPHONE_8_0
- <WKUIDelegate>
-#endif
-
-@property (nonatomic, copy) NSString* title;
-
-- (instancetype)initWithTitle:(NSString*)title;
-
-@end
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4c0556bd/CordovaLib/CDVWebViewUIDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/CDVWebViewUIDelegate.m b/CordovaLib/CDVWebViewUIDelegate.m
deleted file mode 100644
index 6f98327..0000000
--- a/CordovaLib/CDVWebViewUIDelegate.m
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- 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.
- */
-
-#ifdef __IPHONE_8_0
-
-#import "CDVWebViewUIDelegate.h"
-
- @implementation CDVWebViewUIDelegate
-
- - (instancetype)initWithTitle:(NSString*)title
- {
- self = [super init];
- if (self) {
- self.title = title;
- }
-
- return self;
- }
-
- - (void) webView:(WKWebView*)webView runJavaScriptAlertPanelWithMessage:(NSString*)message
- initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)())completionHandler
- {
- UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
- message:message
- preferredStyle:UIAlertControllerStyleAlert];
-
- UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
- style:UIAlertActionStyleDefault
- handler:^(UIAlertAction* action)
- {
- completionHandler();
- [alert dismissViewControllerAnimated:YES completion:nil];
- }];
-
- [alert addAction:ok];
-
- UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
-
- [rootController presentViewController:alert animated:YES completion:nil];
- }
-
- - (void) webView:(WKWebView*)webView runJavaScriptConfirmPanelWithMessage:(NSString*)message
- initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)(BOOL result))completionHandler
- {
- UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
- message:message
- preferredStyle:UIAlertControllerStyleAlert];
-
- UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
- style:UIAlertActionStyleDefault
- handler:^(UIAlertAction* action)
- {
- completionHandler(YES);
- [alert dismissViewControllerAnimated:YES completion:nil];
- }];
-
- [alert addAction:ok];
-
- UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
- style:UIAlertActionStyleDefault
- handler:^(UIAlertAction* action)
- {
- completionHandler(NO);
- [alert dismissViewControllerAnimated:YES completion:nil];
- }];
- [alert addAction:cancel];
-
- UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
-
- [rootController presentViewController:alert animated:YES completion:nil];
- }
-
- - (void) webView:(WKWebView*)webView runJavaScriptTextInputPanelWithPrompt:(NSString*)prompt
- defaultText:(NSString*)defaultText initiatedByFrame:(WKFrameInfo*)frame
- completionHandler:(void (^)(NSString* result))completionHandler
- {
- UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
- message:prompt
- preferredStyle:UIAlertControllerStyleAlert];
-
- UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
- style:UIAlertActionStyleDefault
- handler:^(UIAlertAction* action)
- {
- completionHandler(((UITextField*)alert.textFields[0]).text);
- [alert dismissViewControllerAnimated:YES completion:nil];
- }];
-
- [alert addAction:ok];
-
- UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
- style:UIAlertActionStyleDefault
- handler:^(UIAlertAction* action)
- {
- completionHandler(nil);
- [alert dismissViewControllerAnimated:YES completion:nil];
- }];
- [alert addAction:cancel];
-
- [alert addTextFieldWithConfigurationHandler:^(UITextField* textField) {
- textField.text = defaultText;
- }];
-
- UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
-
- [rootController presentViewController:alert animated:YES completion:nil];
- }
-
- @end
-#endif /* ifdef __IPHONE_8_0 */
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4c0556bd/CordovaLib/Classes/CDVWebViewUIDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewUIDelegate.h b/CordovaLib/Classes/CDVWebViewUIDelegate.h
new file mode 100644
index 0000000..9ff2ac1
--- /dev/null
+++ b/CordovaLib/Classes/CDVWebViewUIDelegate.h
@@ -0,0 +1,35 @@
+/*
+ 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.
+ */
+
+#import <Foundation/Foundation.h>
+
+#ifdef __IPHONE_8_0
+ #import <WebKit/WebKit.h>
+#endif
+
+@interface CDVWebViewUIDelegate : NSObject
+#ifdef __IPHONE_8_0
+ <WKUIDelegate>
+#endif
+
+@property (nonatomic, copy) NSString* title;
+
+- (instancetype)initWithTitle:(NSString*)title;
+
+@end
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4c0556bd/CordovaLib/Classes/CDVWebViewUIDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewUIDelegate.m b/CordovaLib/Classes/CDVWebViewUIDelegate.m
new file mode 100644
index 0000000..6f98327
--- /dev/null
+++ b/CordovaLib/Classes/CDVWebViewUIDelegate.m
@@ -0,0 +1,126 @@
+/*
+ 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.
+ */
+
+#ifdef __IPHONE_8_0
+
+#import "CDVWebViewUIDelegate.h"
+
+ @implementation CDVWebViewUIDelegate
+
+ - (instancetype)initWithTitle:(NSString*)title
+ {
+ self = [super init];
+ if (self) {
+ self.title = title;
+ }
+
+ return self;
+ }
+
+ - (void) webView:(WKWebView*)webView runJavaScriptAlertPanelWithMessage:(NSString*)message
+ initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)())completionHandler
+ {
+ UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
+ message:message
+ preferredStyle:UIAlertControllerStyleAlert];
+
+ UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+ style:UIAlertActionStyleDefault
+ handler:^(UIAlertAction* action)
+ {
+ completionHandler();
+ [alert dismissViewControllerAnimated:YES completion:nil];
+ }];
+
+ [alert addAction:ok];
+
+ UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
+
+ [rootController presentViewController:alert animated:YES completion:nil];
+ }
+
+ - (void) webView:(WKWebView*)webView runJavaScriptConfirmPanelWithMessage:(NSString*)message
+ initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void (^)(BOOL result))completionHandler
+ {
+ UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
+ message:message
+ preferredStyle:UIAlertControllerStyleAlert];
+
+ UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+ style:UIAlertActionStyleDefault
+ handler:^(UIAlertAction* action)
+ {
+ completionHandler(YES);
+ [alert dismissViewControllerAnimated:YES completion:nil];
+ }];
+
+ [alert addAction:ok];
+
+ UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
+ style:UIAlertActionStyleDefault
+ handler:^(UIAlertAction* action)
+ {
+ completionHandler(NO);
+ [alert dismissViewControllerAnimated:YES completion:nil];
+ }];
+ [alert addAction:cancel];
+
+ UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
+
+ [rootController presentViewController:alert animated:YES completion:nil];
+ }
+
+ - (void) webView:(WKWebView*)webView runJavaScriptTextInputPanelWithPrompt:(NSString*)prompt
+ defaultText:(NSString*)defaultText initiatedByFrame:(WKFrameInfo*)frame
+ completionHandler:(void (^)(NSString* result))completionHandler
+ {
+ UIAlertController* alert = [UIAlertController alertControllerWithTitle:self.title
+ message:prompt
+ preferredStyle:UIAlertControllerStyleAlert];
+
+ UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK")
+ style:UIAlertActionStyleDefault
+ handler:^(UIAlertAction* action)
+ {
+ completionHandler(((UITextField*)alert.textFields[0]).text);
+ [alert dismissViewControllerAnimated:YES completion:nil];
+ }];
+
+ [alert addAction:ok];
+
+ UIAlertAction* cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel")
+ style:UIAlertActionStyleDefault
+ handler:^(UIAlertAction* action)
+ {
+ completionHandler(nil);
+ [alert dismissViewControllerAnimated:YES completion:nil];
+ }];
+ [alert addAction:cancel];
+
+ [alert addTextFieldWithConfigurationHandler:^(UITextField* textField) {
+ textField.text = defaultText;
+ }];
+
+ UIViewController* rootController = [UIApplication sharedApplication].delegate.window.rootViewController;
+
+ [rootController presentViewController:alert animated:YES completion:nil];
+ }
+
+ @end
+#endif /* ifdef __IPHONE_8_0 */
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4c0556bd/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
index 941fa15..8d43b0b 100644
--- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
+++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
@@ -100,8 +100,8 @@
68A32D7414103017006B237C /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; };
7E14B5A61705050A0032169E /* CDVTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVTimer.h; path = Classes/CDVTimer.h; sourceTree = "<group>"; };
7E14B5A71705050A0032169E /* CDVTimer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVTimer.m; path = Classes/CDVTimer.m; sourceTree = "<group>"; };
- 7E785B98196F508900ABBDC8 /* CDVWebViewUIDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVWebViewUIDelegate.h; sourceTree = "<group>"; };
- 7E785B99196F508900ABBDC8 /* CDVWebViewUIDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVWebViewUIDelegate.m; sourceTree = "<group>"; };
+ 7E785B98196F508900ABBDC8 /* CDVWebViewUIDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWebViewUIDelegate.h; path = Classes/CDVWebViewUIDelegate.h; sourceTree = "<group>"; };
+ 7E785B99196F508900ABBDC8 /* CDVWebViewUIDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWebViewUIDelegate.m; path = Classes/CDVWebViewUIDelegate.m; sourceTree = "<group>"; };
7EE9ECF619525D24004CA6B9 /* CDVWebViewPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWebViewPreferences.h; path = Classes/CDVWebViewPreferences.h; sourceTree = "<group>"; };
7E22B88419E4C0210026F95E /* CDVAvailabilityDeprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVAvailabilityDeprecated.h; path = Classes/CDVAvailabilityDeprecated.h; sourceTree = "<group>"; };
7EE9ECF719525D24004CA6B9 /* CDVWebViewPreferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWebViewPreferences.m; path = Classes/CDVWebViewPreferences.m; sourceTree = "<group>"; };
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org