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/20 08:26:51 UTC
[cordova-ios] branch 4.5.x updated: Revert "CB-14045 - reinit url
after app freezes on 4.5.x" (#484)
This is an automated email from the ASF dual-hosted git repository.
brodybits 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 cf4fb98 Revert "CB-14045 - reinit url after app freezes on 4.5.x" (#484)
cf4fb98 is described below
commit cf4fb989f4d3b6fa50c13fdc0fe2ca5ee86c6e63
Author: Chris Brody <ch...@gmail.com>
AuthorDate: Thu Dec 20 03:26:45 2018 -0500
Revert "CB-14045 - reinit url after app freezes on 4.5.x" (#484)
As discussed in PR #418, we decided the change was too drastic for a patch release.
---
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