diff --git a/ios/Classes/TiWebdialogModule.m b/ios/Classes/TiWebdialogModule.m index 617701f..c001d67 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] }]; } } @@ -62,19 +62,13 @@ - (void)safariViewControllerDidFinish:(SFSafariViewController *)controller - (SFSafariViewController *)safariController:(NSString *)url withEntersReaderIfAvailable:(BOOL)entersReaderIfAvailable andBarCollapsingEnabled:(BOOL)barCollapsingEnabled { if (_safariController == nil) { - 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]; - } + NSURL *safariURL = [NSURL URLWithString:[url stringByRemovingPercentEncoding]]; + SFSafariViewControllerConfiguration *config = [[SFSafariViewControllerConfiguration alloc] init]; + config.entersReaderIfAvailable = entersReaderIfAvailable; + config.barCollapsingEnabled = barCollapsingEnabled; + _safariController = [[SFSafariViewController alloc] initWithURL:safariURL + configuration:config]; [_safariController setDelegate:self]; } @@ -86,7 +80,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 +91,7 @@ - (void)safariViewController:(SFSafariViewController *)controller initialLoadDid if ([self _hasListeners:@"redirect"]) { [self fireEvent:@"redirect" withObject:@{ - @"url" : [_url stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding] + @"url" : [_url stringByRemovingPercentEncoding] }]; } } @@ -150,28 +144,15 @@ - (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"]) { - 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"); - } + [safari setDismissButtonStyle:[TiUtils intValue:@"dismissButtonStyle" properties:args def:SFSafariViewControllerDismissButtonStyleDone]]; } [[TiApp app] showModalController:safari diff --git a/ios/manifest b/ios/manifest index e2207f7..0f21cf4 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: 2.0.0 +version: 3.0.0 apiversion: 2 -architectures: armv7 arm64 i386 x86_64 +architectures: arm64 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 331a55a..cea4847 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 = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.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 = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LIBRARY_SEARCH_PATHS = ""; OTHER_CFLAGS = "-DTI_POST_1_2"; OTHER_LDFLAGS = "-ObjC"; @@ -325,6 +325,7 @@ 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", @@ -363,7 +364,7 @@ GCC_WARN_UNUSED_VALUE = NO; GCC_WARN_UNUSED_VARIABLE = NO; INSTALL_PATH = /usr/local/lib; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; OTHER_CFLAGS = "-DTI_POST_1_2"; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = ti.webdialog;