Skip to content

Commit d01cb0a

Browse files
vijaysingh-axwaysgtcoolguy
authored andcommitted
chore(ios): update minimum target to iOS 11 and cleaned the code
1 parent cf8e368 commit d01cb0a

File tree

3 files changed

+18
-36
lines changed

3 files changed

+18
-36
lines changed

ios/Classes/TiWebdialogModule.m

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ - (void)teardown
4949
[self fireEvent:@"close"
5050
withObject:@{
5151
@"success" : NUMINT(YES),
52-
@"url" : [_url stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
52+
@"url" : [_url stringByRemovingPercentEncoding]
5353
}];
5454
}
5555
}
@@ -62,19 +62,13 @@ - (void)safariViewControllerDidFinish:(SFSafariViewController *)controller
6262
- (SFSafariViewController *)safariController:(NSString *)url withEntersReaderIfAvailable:(BOOL)entersReaderIfAvailable andBarCollapsingEnabled:(BOOL)barCollapsingEnabled
6363
{
6464
if (_safariController == nil) {
65-
NSURL *safariURL = [NSURL URLWithString:[url stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
66-
if (@available(iOS 11.0, *)) {
67-
SFSafariViewControllerConfiguration *config = [[SFSafariViewControllerConfiguration alloc] init];
68-
config.entersReaderIfAvailable = entersReaderIfAvailable;
69-
config.barCollapsingEnabled = barCollapsingEnabled;
70-
71-
_safariController = [[SFSafariViewController alloc] initWithURL:safariURL
72-
configuration:config];
73-
} else {
74-
_safariController = [[SFSafariViewController alloc] initWithURL:safariURL
75-
entersReaderIfAvailable:entersReaderIfAvailable];
76-
}
65+
NSURL *safariURL = [NSURL URLWithString:[url stringByRemovingPercentEncoding]];
66+
SFSafariViewControllerConfiguration *config = [[SFSafariViewControllerConfiguration alloc] init];
67+
config.entersReaderIfAvailable = entersReaderIfAvailable;
68+
config.barCollapsingEnabled = barCollapsingEnabled;
7769

70+
_safariController = [[SFSafariViewController alloc] initWithURL:safariURL
71+
configuration:config];
7872
[_safariController setDelegate:self];
7973
}
8074

@@ -86,7 +80,7 @@ - (void)safariViewController:(SFSafariViewController *)controller didCompleteIni
8680
if ([self _hasListeners:@"load"]) {
8781
[self fireEvent:@"load"
8882
withObject:@{
89-
@"url" : [_url stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding],
83+
@"url" : [_url stringByRemovingPercentEncoding],
9084
@"success" : NUMBOOL(didLoadSuccessfully)
9185
}];
9286
}
@@ -97,7 +91,7 @@ - (void)safariViewController:(SFSafariViewController *)controller initialLoadDid
9791
if ([self _hasListeners:@"redirect"]) {
9892
[self fireEvent:@"redirect"
9993
withObject:@{
100-
@"url" : [_url stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
94+
@"url" : [_url stringByRemovingPercentEncoding]
10195
}];
10296
}
10397
}
@@ -150,28 +144,15 @@ - (void)open:(id)args
150144

151145
if ([args objectForKey:@"tintColor"]) {
152146
TiColor *newColor = [TiUtils colorValue:@"tintColor" properties:args];
153-
154-
if ([TiUtils isIOSVersionOrGreater:@"10.0"]) {
155-
[safari setPreferredControlTintColor:[newColor _color]];
156-
} else {
157-
[[safari view] setTintColor:[newColor _color]];
158-
}
147+
[safari setPreferredControlTintColor:[newColor _color]];
159148
}
160149

161150
if ([args objectForKey:@"barColor"]) {
162-
if ([TiUtils isIOSVersionOrGreater:@"10.0"]) {
163-
[safari setPreferredBarTintColor:[[TiUtils colorValue:@"barColor" properties:args] _color]];
164-
} else {
165-
NSLog(@"[ERROR] Ti.WebDialog: The barColor property is only available in iOS 10 and later");
166-
}
151+
[safari setPreferredBarTintColor:[[TiUtils colorValue:@"barColor" properties:args] _color]];
167152
}
168153

169154
if ([args objectForKey:@"dismissButtonStyle"]) {
170-
if (@available(iOS 11.0, *)) {
171-
[safari setDismissButtonStyle:[TiUtils intValue:@"dismissButtonStyle" properties:args def:SFSafariViewControllerDismissButtonStyleDone]];
172-
} else {
173-
NSLog(@"[ERROR] Ti.WebDialog: The dismissButtonStyle property is only available in iOS 11 and later");
174-
}
155+
[safari setDismissButtonStyle:[TiUtils intValue:@"dismissButtonStyle" properties:args def:SFSafariViewControllerDismissButtonStyleDone]];
175156
}
176157

177158
[[TiApp app] showModalController:safari

ios/manifest

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# this is your module manifest and used by Titanium
33
# during compilation, packaging, distribution, etc.
44
#
5-
version: 2.0.0
5+
version: 3.0.0
66
apiversion: 2
7-
architectures: armv7 arm64 i386 x86_64
7+
architectures: arm64 x86_64
88
description: titanium-web-dialog
99
author: Hans Knoechel
1010
license: Apache 2.0

ios/titanium-web-dialog.xcodeproj/project.pbxproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@
243243
GCC_WARN_UNUSED_VALUE = NO;
244244
GCC_WARN_UNUSED_VARIABLE = NO;
245245
INSTALL_PATH = /usr/local/lib;
246-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
246+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
247247
LIBRARY_SEARCH_PATHS = "";
248248
OTHER_CFLAGS = (
249249
"-DDEBUG",
@@ -289,7 +289,7 @@
289289
GCC_WARN_UNUSED_VALUE = NO;
290290
GCC_WARN_UNUSED_VARIABLE = NO;
291291
INSTALL_PATH = /usr/local/lib;
292-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
292+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
293293
LIBRARY_SEARCH_PATHS = "";
294294
OTHER_CFLAGS = "-DTI_POST_1_2";
295295
OTHER_LDFLAGS = "-ObjC";
@@ -325,6 +325,7 @@
325325
GCC_WARN_UNUSED_VALUE = NO;
326326
GCC_WARN_UNUSED_VARIABLE = NO;
327327
INSTALL_PATH = /usr/local/lib;
328+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
328329
ONLY_ACTIVE_ARCH = YES;
329330
OTHER_CFLAGS = (
330331
"-DDEBUG",
@@ -363,7 +364,7 @@
363364
GCC_WARN_UNUSED_VALUE = NO;
364365
GCC_WARN_UNUSED_VARIABLE = NO;
365366
INSTALL_PATH = /usr/local/lib;
366-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
367+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
367368
OTHER_CFLAGS = "-DTI_POST_1_2";
368369
OTHER_LDFLAGS = "-ObjC";
369370
PRODUCT_NAME = ti.webdialog;

0 commit comments

Comments
 (0)