This is an automated email from the ASF dual-hosted git repository.

shazron pushed a commit to branch 4.5.x
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git


The following commit(s) were added to refs/heads/4.5.x by this push:
     new 00a4b27  Revert "CB-14045 - Reinit url after app freezes (#363)"
00a4b27 is described below

commit 00a4b27466bb8d1abf11e9e9ad6f2c6c1510f652
Author: Shazron Abdullah <s...@adobe.com>
AuthorDate: Wed May 16 13:46:14 2018 +0800

    Revert "CB-14045 - Reinit url after app freezes (#363)"
    
    This reverts commit 6b3f10f70ed0fe10ad792b49228a8fb6686082f1.
---
 CordovaLib/Classes/Public/CDVViewController.m | 24 ---------------------
 tests/CordovaLibTests/CDVViewControllerTest.m | 30 ---------------------------
 2 files changed, 54 deletions(-)

diff --git a/CordovaLib/Classes/Public/CDVViewController.m 
b/CordovaLib/Classes/Public/CDVViewController.m
index 13f1a90..d0c0586 100644
--- a/CordovaLib/Classes/Public/CDVViewController.m
+++ b/CordovaLib/Classes/Public/CDVViewController.m
@@ -720,33 +720,12 @@
     }
 }
 
-- (bool)isUrlEmpty:(NSURL *)url
-{
-    if (!url || (url == (id) [NSNull null])) {
-        return true;
-    }
-    NSString *urlAsString = [url absoluteString];
-    return (urlAsString == (id) [NSNull null] || [urlAsString length]==0 || 
[urlAsString isEqualToString:@"about:blank"]);
-}
-
-- (bool)checkAndReinitViewUrl
-{
-    NSURL* appURL = [self appUrl];
-    if ([self isUrlEmpty: [self.webViewEngine URL]] && ![self isUrlEmpty: 
appURL]) {
-        NSURLRequest* appReq = [NSURLRequest requestWithURL:appURL 
cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0];
-        [self.webViewEngine loadRequest:appReq];
-        return true;
-    }
-    return false;
-}
-
 /*
  This method is called to let your application know that it is about to move 
from the active to inactive state.
  You should use this method to pause ongoing tasks, disable timer, ...
  */
 - (void)onAppWillResignActive:(NSNotification*)notification
 {
-    [self checkAndReinitViewUrl];
     // NSLog(@"%@",@"applicationWillResignActive");
     [self.commandDelegate evalJs:@"cordova.fireDocumentEvent('resign');" 
scheduledOnRunLoop:NO];
 }
@@ -758,7 +737,6 @@
  */
 - (void)onAppWillEnterForeground:(NSNotification*)notification
 {
-    [self checkAndReinitViewUrl];
     // NSLog(@"%@",@"applicationWillEnterForeground");
     [self.commandDelegate evalJs:@"cordova.fireDocumentEvent('resume');"];
 
@@ -773,7 +751,6 @@
 // This method is called to let your application know that it moved from the 
inactive to active state.
 - (void)onAppDidBecomeActive:(NSNotification*)notification
 {
-    [self checkAndReinitViewUrl];
     // NSLog(@"%@",@"applicationDidBecomeActive");
     [self.commandDelegate evalJs:@"cordova.fireDocumentEvent('active');"];
 }
@@ -784,7 +761,6 @@
  */
 - (void)onAppDidEnterBackground:(NSNotification*)notification
 {
-    [self checkAndReinitViewUrl];
     // NSLog(@"%@",@"applicationDidEnterBackground");
     [self.commandDelegate evalJs:@"cordova.fireDocumentEvent('pause', null, 
true);" scheduledOnRunLoop:NO];
 }
diff --git a/tests/CordovaLibTests/CDVViewControllerTest.m 
b/tests/CordovaLibTests/CDVViewControllerTest.m
index 9e13a88..9d0f7c0 100644
--- a/tests/CordovaLibTests/CDVViewControllerTest.m
+++ b/tests/CordovaLibTests/CDVViewControllerTest.m
@@ -26,14 +26,6 @@
 
 @end
 
-@interface CDVViewController ()
-
-// expose private interface
-- (bool)checkAndReinitViewUrl;
-- (bool)isUrlEmpty:(NSURL*)url;
-
-@end
-
 @implementation CDVViewControllerTest
 
 -(CDVViewController*)viewController{
@@ -97,27 +89,5 @@
     XCTAssertNil([viewController colorFromColorString:@"#NOTHEX"]);
 }
 
--(void)testIsUrlEmpty{
-    CDVViewController* viewController = [self viewController];
-    XCTAssertTrue([viewController isUrlEmpty:(id)[NSNull null]]);
-    XCTAssertTrue([viewController isUrlEmpty:nil]);
-    XCTAssertTrue([viewController isUrlEmpty:[NSURL URLWithString:@""]]);
-    XCTAssertTrue([viewController isUrlEmpty:[NSURL 
URLWithString:@"about:blank"]]);
-}
-
--(void)testIfItLoadsAppUrlIfCurrentViewIsBlank{
-    CDVViewController* viewController = [self viewController];
-    
-    NSString* appUrl = @"about:blank";
-    NSString* html = @"<html><body></body></html>";
-    [viewController.webViewEngine loadHTMLString:html baseURL:[NSURL 
URLWithString:appUrl]];
-    XCTAssertFalse([viewController checkAndReinitViewUrl]);
-
-    appUrl = @"https://cordova.apache.org";;
-    viewController.startPage = appUrl;
-    [viewController.webViewEngine loadRequest:[NSURLRequest 
requestWithURL:[NSURL URLWithString:appUrl]]];
-    XCTAssertTrue([viewController checkAndReinitViewUrl]);
-}
-
 @end
 

-- 
To stop receiving notification emails like this one, please contact
shaz...@apache.org.

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org
For additional commands, e-mail: commits-h...@cordova.apache.org

Reply via email to