You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by br...@apache.org on 2018/12/19 15:36:03 UTC

[cordova-ios] branch revert-418-cb-14045-on-4.5.x created (now 2174c98)

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

brodybits pushed a change to branch revert-418-cb-14045-on-4.5.x
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git.


      at 2174c98  Revert "CB-14045 - reinit url after app freezes on 4.5.x"

This branch includes the following new commits:

     new 2174c98  Revert "CB-14045 - reinit url after app freezes on 4.5.x"

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[cordova-ios] 01/01: Revert "CB-14045 - reinit url after app freezes on 4.5.x"

Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

brodybits pushed a commit to branch revert-418-cb-14045-on-4.5.x
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git

commit 2174c987b1a229a36c51c4117713f4f22344a1d8
Author: Chris Brody <ch...@gmail.com>
AuthorDate: Wed Dec 19 10:35:55 2018 -0500

    Revert "CB-14045 - reinit url after app freezes on 4.5.x"
---
 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 unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org