diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index a114799..4646972 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -267,30 +267,6 @@ }); } -- (void)hide:(CDVInvokedUrlCommand*)command -{ - if (self.inAppBrowserViewController == nil) { - NSLog(@"Tried to hide IAB after it was closed."); - return; - - - } - if (_previousStatusBarStyle == -1) { - NSLog(@"Tried to hide IAB while already hidden"); - return; - } - - _previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle; - - // Run later to avoid the "took a long time" log message. - dispatch_async(dispatch_get_main_queue(), ^{ - if (self.inAppBrowserViewController != nil) { - _previousStatusBarStyle = -1; - [self.viewController dismissViewControllerAnimated:YES completion:nil]; - } - }); -} - - (void)openInCordovaWebView:(NSURL*)url withOptions:(NSString*)options { NSURLRequest* request = [NSURLRequest requestWithURL:url]; diff --git a/tests/tests.js b/tests/tests.js index a5645aa..de0c090 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -98,6 +98,7 @@ exports.defineAutoTests = function () { expect(iabInstance.removeEventListener).toEqual(jasmine.any(Function)); expect(iabInstance.close).toEqual(jasmine.any(Function)); expect(iabInstance.show).toEqual(jasmine.any(Function)); + expect(iabInstance.hide).toEqual(jasmine.any(Function)); expect(iabInstance.executeScript).toEqual(jasmine.any(Function)); expect(iabInstance.insertCSS).toEqual(jasmine.any(Function)); }); @@ -421,7 +422,9 @@ exports.defineManualTests = function (contentEl, createActionButton) { '

' + 'Expected result: no output. But click on "show hidden" again and nothing should be shown.' + '

' + - 'Expected result: open successfully in InAppBrowser to https://www.google.co.uk'; + 'Expected result: open successfully in InAppBrowser to https://www.google.co.uk' + + '

' + + 'Expected result: open successfully in InAppBrowser to https://www.google.co.uk. Hide after 2 seconds'; var clearing_cache_tests = '

Clearing Cache

' + '
' + @@ -620,6 +623,12 @@ exports.defineManualTests = function (contentEl, createActionButton) { createActionButton('google.co.uk Not Hidden', function () { openHidden('https://www.google.co.uk', false); }, 'openHiddenShow'); + createActionButton('google.co.uk shown for 2 seconds than hidden', function () { + var iab = doOpen('https://www.google.co.uk/', 'random_sting'); + setTimeout(function () { + iab.hide(); + }, 2000); + }, 'openVisibleAndHide'); //Clearing cache createActionButton('Clear Browser Cache', function () {