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 2014/05/29 21:50:57 UTC
[1/2] git commit: Remove some dead code left from last commit
Repository: cordova-app-harness
Updated Branches:
refs/heads/master f21635e6d -> be702a672
Remove some dead code left from last commit
Project: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/commit/c03d3fb5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/c03d3fb5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/c03d3fb5
Branch: refs/heads/master
Commit: c03d3fb5283bfb9855f254133cf2afcaf0709b2b
Parents: f21635e
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu May 29 15:07:13 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu May 29 15:07:13 2014 -0400
----------------------------------------------------------------------
www/cdvah/js/InAppMenuCtrl.js | 7 -------
1 file changed, 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/c03d3fb5/www/cdvah/js/InAppMenuCtrl.js
----------------------------------------------------------------------
diff --git a/www/cdvah/js/InAppMenuCtrl.js b/www/cdvah/js/InAppMenuCtrl.js
index 1ffb1da..1527d92 100644
--- a/www/cdvah/js/InAppMenuCtrl.js
+++ b/www/cdvah/js/InAppMenuCtrl.js
@@ -52,13 +52,6 @@
$scope.$apply(function() {
if (eventName == 'showMenu') {
AppHarnessUI.setVisible(false);
- } else if (eventName == 'hideMenu') {
- AppHarnessUI.setVisible(true);
- } else if (eventName == 'restartApp') {
- // TODO: Restart in place?
- AppsService.launchApp(activeApp);
- } else if (eventName == 'quitApp') {
- AppsService.quitApp();
} else if (eventName == 'destroyed') {
$window.history.back();
} else {
[2/2] git commit: Forgot to commit iOS changes for overlay change
Posted by ag...@apache.org.
Forgot to commit iOS changes for overlay change
Project: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/commit/be702a67
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/be702a67
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/be702a67
Branch: refs/heads/master
Commit: be702a672654c0019502174a0dcfd40e11dd3745
Parents: c03d3fb
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu May 29 15:48:44 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu May 29 15:48:44 2014 -0400
----------------------------------------------------------------------
AppHarnessUI/AppHarnessUI.m | 69 ++++++++++++----------------------------
1 file changed, 20 insertions(+), 49 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/be702a67/AppHarnessUI/AppHarnessUI.m
----------------------------------------------------------------------
diff --git a/AppHarnessUI/AppHarnessUI.m b/AppHarnessUI/AppHarnessUI.m
index 710c823..00bcb78 100644
--- a/AppHarnessUI/AppHarnessUI.m
+++ b/AppHarnessUI/AppHarnessUI.m
@@ -29,33 +29,14 @@
}
@end
-@interface AHUIOverlayPlugin : CDVPlugin {
-@public
- __weak AppHarnessUI* _parentPlugin;
-}
-@end
-
@interface AppHarnessUI : CDVPlugin {
AHUIViewController* _slaveCordovaViewController;
NSString* _eventsCallbackId;
- CDVViewController* _overlayCordovaViewController;
+ BOOL _slaveVisible;
}
- (void)sendEvent:(NSString*)event;
@end
-
-#pragma mark AHUIOverlayPlugin
-
-@implementation AHUIOverlayPlugin
-
-- (void)sendEvent:(CDVInvokedUrlCommand*)command {
- NSString* event = [command argumentAtIndex:0];
- [_parentPlugin sendEvent:event];
-}
-
-@end
-
-
#pragma mark AHUIViewController
@implementation AHUIViewController
@@ -69,7 +50,7 @@
tapRecognizer.numberOfTapsRequired = 2;
tapRecognizer.numberOfTouchesRequired = 2;
tapRecognizer.delegate = self;
-
+
// Add the tap gesture recognizer to the view
[self.view addGestureRecognizer:tapRecognizer];
}
@@ -116,7 +97,7 @@
_slaveCordovaViewController = [[AHUIViewController alloc] init];
_slaveCordovaViewController.startPage = url;
_slaveCordovaViewController->_parentPlugin = self;
- [self.viewController presentViewController:_slaveCordovaViewController animated:NO completion:nil];
+ [self setVisibleHelper:YES];
} else {
NSLog(@"AppHarnessUI.create: already exists");
}
@@ -128,47 +109,37 @@
if (_slaveCordovaViewController == nil) {
NSLog(@"AppHarnessUI.destroy: already destroyed.");
} else {
+ [self setVisibleHelper:NO];
_slaveCordovaViewController = nil;
- _overlayCordovaViewController = nil;
- [self.viewController dismissViewControllerAnimated:NO completion:nil];
+ [self sendEvent:@"destroyed"];
}
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:pluginResult callbackId:_eventsCallbackId]; // Close events channel.
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
-- (void)createOverlay:(CDVInvokedUrlCommand*)command {
- NSString* url = [command argumentAtIndex:0];
+- (void)setVisibleHelper:(BOOL)value {
+ if (value == _slaveVisible) {
+ return;
+ }
+ _slaveVisible = value;
if (_slaveCordovaViewController == nil) {
- NSLog(@"AppHarnessUI.createOverlay: slave doesn't exist");
- } else if (_overlayCordovaViewController == nil) {
- _overlayCordovaViewController = [[CDVViewController alloc] init];
- _overlayCordovaViewController.startPage = url;
- AHUIOverlayPlugin* overlayPlugin = [[AHUIOverlayPlugin alloc] init];
- overlayPlugin->_parentPlugin = self;
- [_overlayCordovaViewController registerPlugin:overlayPlugin withPluginName:@"OverlayPlugin"];
- _overlayCordovaViewController.view.opaque = NO;
- _overlayCordovaViewController.view.backgroundColor = [UIColor clearColor];
- _overlayCordovaViewController.webView.opaque = NO;
- _overlayCordovaViewController.webView.backgroundColor = [UIColor clearColor];
- _overlayCordovaViewController.webView.scrollView.scrollEnabled = NO;
- [_slaveCordovaViewController.view addSubview:_overlayCordovaViewController.view];
+ NSLog(@"AppHarnessUI.setVisible: slave doesn't exist");
} else {
- NSLog(@"AppHarnessUI.createOverlay: already exists");
+ UIView* newView = value ? _slaveCordovaViewController.view : self.viewController.view;
+ UIView* oldView = !value ? _slaveCordovaViewController.view : self.viewController.view;
+ UIView* superView = oldView.superview;
+ [oldView removeFromSuperview];
+ [superView addSubview:newView];
}
- CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
-- (void)destroyOverlay:(CDVInvokedUrlCommand*)command {
- if (_overlayCordovaViewController == nil) {
- NSLog(@"AppHarnessUI.destroyOverlay: already destroyed.");
- } else {
- [_overlayCordovaViewController.view removeFromSuperview];
- _overlayCordovaViewController = nil;
- }
+- (void)setVisible:(CDVInvokedUrlCommand*)command {
+ BOOL value = [[command argumentAtIndex:0] boolValue];
+ [self setVisibleHelper:value];
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
+
@end