From f42c9e31e078d96fabbf1804bbad93d2fa0a4f64 Mon Sep 17 00:00:00 2001 From: Joshua Quick Date: Wed, 21 Jul 2021 20:54:38 -0700 Subject: [PATCH 1/4] Revert "chore(ios): update minimum target to iOS 11 and cleaned the code" This reverts commit d01cb0a16659dd8c3a5d07ab83eb8e75d3305675. --- ios/Classes/TiWebdialogModule.m | 43 +++++++++++++------ ios/manifest | 4 +- .../project.pbxproj | 7 ++- 3 files changed, 36 insertions(+), 18 deletions(-) diff --git a/ios/Classes/TiWebdialogModule.m b/ios/Classes/TiWebdialogModule.m index c001d67..617701f 100644 --- a/ios/Classes/TiWebdialogModule.m +++ b/ios/Classes/TiWebdialogModule.m @@ -49,7 +49,7 @@ - (void)teardown [self fireEvent:@"close" withObject:@{ @"success" : NUMINT(YES), - @"url" : [_url stringByRemovingPercentEncoding] + @"url" : [_url stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding] }]; } } @@ -62,13 +62,19 @@ - (void)safariViewControllerDidFinish:(SFSafariViewController *)controller - (SFSafariViewController *)safariController:(NSString *)url withEntersReaderIfAvailable:(BOOL)entersReaderIfAvailable andBarCollapsingEnabled:(BOOL)barCollapsingEnabled { if (_safariController == nil) { - NSURL *safariURL = [NSURL URLWithString:[url stringByRemovingPercentEncoding]]; - SFSafariViewControllerConfiguration *config = [[SFSafariViewControllerConfiguration alloc] init]; - config.entersReaderIfAvailable = entersReaderIfAvailable; - config.barCollapsingEnabled = barCollapsingEnabled; + NSURL *safariURL = [NSURL URLWithString:[url stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; + if (@available(iOS 11.0, *)) { + SFSafariViewControllerConfiguration *config = [[SFSafariViewControllerConfiguration alloc] init]; + config.entersReaderIfAvailable = entersReaderIfAvailable; + config.barCollapsingEnabled = barCollapsingEnabled; + + _safariController = [[SFSafariViewController alloc] initWithURL:safariURL + configuration:config]; + } else { + _safariController = [[SFSafariViewController alloc] initWithURL:safariURL + entersReaderIfAvailable:entersReaderIfAvailable]; + } - _safariController = [[SFSafariViewController alloc] initWithURL:safariURL - configuration:config]; [_safariController setDelegate:self]; } @@ -80,7 +86,7 @@ - (void)safariViewController:(SFSafariViewController *)controller didCompleteIni if ([self _hasListeners:@"load"]) { [self fireEvent:@"load" withObject:@{ - @"url" : [_url stringByRemovingPercentEncoding], + @"url" : [_url stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding], @"success" : NUMBOOL(didLoadSuccessfully) }]; } @@ -91,7 +97,7 @@ - (void)safariViewController:(SFSafariViewController *)controller initialLoadDid if ([self _hasListeners:@"redirect"]) { [self fireEvent:@"redirect" withObject:@{ - @"url" : [_url stringByRemovingPercentEncoding] + @"url" : [_url stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding] }]; } } @@ -144,15 +150,28 @@ - (void)open:(id)args if ([args objectForKey:@"tintColor"]) { TiColor *newColor = [TiUtils colorValue:@"tintColor" properties:args]; - [safari setPreferredControlTintColor:[newColor _color]]; + + if ([TiUtils isIOSVersionOrGreater:@"10.0"]) { + [safari setPreferredControlTintColor:[newColor _color]]; + } else { + [[safari view] setTintColor:[newColor _color]]; + } } if ([args objectForKey:@"barColor"]) { - [safari setPreferredBarTintColor:[[TiUtils colorValue:@"barColor" properties:args] _color]]; + if ([TiUtils isIOSVersionOrGreater:@"10.0"]) { + [safari setPreferredBarTintColor:[[TiUtils colorValue:@"barColor" properties:args] _color]]; + } else { + NSLog(@"[ERROR] Ti.WebDialog: The barColor property is only available in iOS 10 and later"); + } } if ([args objectForKey:@"dismissButtonStyle"]) { - [safari setDismissButtonStyle:[TiUtils intValue:@"dismissButtonStyle" properties:args def:SFSafariViewControllerDismissButtonStyleDone]]; + if (@available(iOS 11.0, *)) { + [safari setDismissButtonStyle:[TiUtils intValue:@"dismissButtonStyle" properties:args def:SFSafariViewControllerDismissButtonStyleDone]]; + } else { + NSLog(@"[ERROR] Ti.WebDialog: The dismissButtonStyle property is only available in iOS 11 and later"); + } } [[TiApp app] showModalController:safari diff --git a/ios/manifest b/ios/manifest index 0f21cf4..e2207f7 100644 --- a/ios/manifest +++ b/ios/manifest @@ -2,9 +2,9 @@ # this is your module manifest and used by Titanium # during compilation, packaging, distribution, etc. # -version: 3.0.0 +version: 2.0.0 apiversion: 2 -architectures: arm64 x86_64 +architectures: armv7 arm64 i386 x86_64 description: titanium-web-dialog author: Hans Knoechel license: Apache 2.0 diff --git a/ios/titanium-web-dialog.xcodeproj/project.pbxproj b/ios/titanium-web-dialog.xcodeproj/project.pbxproj index cea4847..331a55a 100644 --- a/ios/titanium-web-dialog.xcodeproj/project.pbxproj +++ b/ios/titanium-web-dialog.xcodeproj/project.pbxproj @@ -243,7 +243,7 @@ GCC_WARN_UNUSED_VALUE = NO; GCC_WARN_UNUSED_VARIABLE = NO; INSTALL_PATH = /usr/local/lib; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LIBRARY_SEARCH_PATHS = ""; OTHER_CFLAGS = ( "-DDEBUG", @@ -289,7 +289,7 @@ GCC_WARN_UNUSED_VALUE = NO; GCC_WARN_UNUSED_VARIABLE = NO; INSTALL_PATH = /usr/local/lib; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LIBRARY_SEARCH_PATHS = ""; OTHER_CFLAGS = "-DTI_POST_1_2"; OTHER_LDFLAGS = "-ObjC"; @@ -325,7 +325,6 @@ GCC_WARN_UNUSED_VALUE = NO; GCC_WARN_UNUSED_VARIABLE = NO; INSTALL_PATH = /usr/local/lib; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = ( "-DDEBUG", @@ -364,7 +363,7 @@ GCC_WARN_UNUSED_VALUE = NO; GCC_WARN_UNUSED_VARIABLE = NO; INSTALL_PATH = /usr/local/lib; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DTI_POST_1_2"; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = ti.webdialog; From ea35a5e8dd2692ce64eba5809d5aeddaba7e6ecf Mon Sep 17 00:00:00 2001 From: Joshua Quick Date: Wed, 21 Jul 2021 21:02:33 -0700 Subject: [PATCH 2/4] refactor(ios): simplify module class code --- ios/Classes/TiWebdialogModule.m | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/ios/Classes/TiWebdialogModule.m b/ios/Classes/TiWebdialogModule.m index 617701f..3e2c206 100644 --- a/ios/Classes/TiWebdialogModule.m +++ b/ios/Classes/TiWebdialogModule.m @@ -49,7 +49,7 @@ - (void)teardown [self fireEvent:@"close" withObject:@{ @"success" : NUMINT(YES), - @"url" : [_url stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding] + @"url" : [_url stringByRemovingPercentEncoding] }]; } } @@ -86,7 +86,7 @@ - (void)safariViewController:(SFSafariViewController *)controller didCompleteIni if ([self _hasListeners:@"load"]) { [self fireEvent:@"load" withObject:@{ - @"url" : [_url stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding], + @"url" : [_url stringByRemovingPercentEncoding], @"success" : NUMBOOL(didLoadSuccessfully) }]; } @@ -97,7 +97,7 @@ - (void)safariViewController:(SFSafariViewController *)controller initialLoadDid if ([self _hasListeners:@"redirect"]) { [self fireEvent:@"redirect" withObject:@{ - @"url" : [_url stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding] + @"url" : [_url stringByRemovingPercentEncoding] }]; } } @@ -150,20 +150,11 @@ - (void)open:(id)args if ([args objectForKey:@"tintColor"]) { TiColor *newColor = [TiUtils colorValue:@"tintColor" properties:args]; - - if ([TiUtils isIOSVersionOrGreater:@"10.0"]) { - [safari setPreferredControlTintColor:[newColor _color]]; - } else { - [[safari view] setTintColor:[newColor _color]]; - } + [safari setPreferredControlTintColor:[newColor _color]]; } if ([args objectForKey:@"barColor"]) { - if ([TiUtils isIOSVersionOrGreater:@"10.0"]) { - [safari setPreferredBarTintColor:[[TiUtils colorValue:@"barColor" properties:args] _color]]; - } else { - NSLog(@"[ERROR] Ti.WebDialog: The barColor property is only available in iOS 10 and later"); - } + [safari setPreferredBarTintColor:[[TiUtils colorValue:@"barColor" properties:args] _color]]; } if ([args objectForKey:@"dismissButtonStyle"]) { From 9a72050192266aa4a37d1c6d66320d68fcc85eba Mon Sep 17 00:00:00 2001 From: Joshua Quick Date: Wed, 21 Jul 2021 21:02:57 -0700 Subject: [PATCH 3/4] chore(ios): update module version to 3.0.1 --- ios/manifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/manifest b/ios/manifest index e2207f7..8a9b8e4 100644 --- a/ios/manifest +++ b/ios/manifest @@ -2,7 +2,7 @@ # this is your module manifest and used by Titanium # during compilation, packaging, distribution, etc. # -version: 2.0.0 +version: 3.0.1 apiversion: 2 architectures: armv7 arm64 i386 x86_64 description: titanium-web-dialog From 9935fd6b7b243bee9b2bf7f96b501ca87f5e5ee2 Mon Sep 17 00:00:00 2001 From: Joshua Quick Date: Wed, 21 Jul 2021 21:03:17 -0700 Subject: [PATCH 4/4] chore: update package.json version to 4.0.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9864843..0b3eb8c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@titanium-sdk/ti.webdialog", - "version": "4.0.0", + "version": "4.0.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@titanium-sdk/ti.webdialog", - "version": "4.0.0", + "version": "4.0.1", "hasInstallScript": true, "devDependencies": { "@commitlint/cli": "^12.0.0", diff --git a/package.json b/package.json index 6ab22df..278e46c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@titanium-sdk/ti.webdialog", - "version": "4.0.0", + "version": "4.0.1", "description": "Use the native `SFSafariViewController` (iOS) and `Chrome Pages` (Android) within Axway Titanium.", "scripts": { "commit": "git-cz",