@@ -63,7 +63,6 @@ - (SFSafariViewController *)safariController:(NSString *)url withEntersReaderIfA
63
63
{
64
64
if (_safariController == nil ) {
65
65
NSURL *safariURL = [NSURL URLWithString: [url stringByReplacingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];
66
- #if IS_IOS_11
67
66
if (@available (iOS 11.0 , *)) {
68
67
SFSafariViewControllerConfiguration *config = [[SFSafariViewControllerConfiguration alloc ] init ];
69
68
config.entersReaderIfAvailable = entersReaderIfAvailable;
@@ -72,12 +71,9 @@ - (SFSafariViewController *)safariController:(NSString *)url withEntersReaderIfA
72
71
_safariController = [[SFSafariViewController alloc ] initWithURL: safariURL
73
72
configuration: config];
74
73
} else {
75
- #endif
76
74
_safariController = [[SFSafariViewController alloc ] initWithURL: safariURL
77
75
entersReaderIfAvailable: entersReaderIfAvailable];
78
- #if IS_IOS_11
79
76
}
80
- #endif
81
77
82
78
[_safariController setDelegate: self ];
83
79
}
@@ -115,7 +111,7 @@ - (NSNumber *)isOpen:(id)unused
115
111
116
112
- (NSNumber *)isSupported : (id )unused
117
113
{
118
- return NUMBOOL ([TiUtils isIOS9OrGreater ]);
114
+ return NUMBOOL ([TiUtils isIOSVersionOrGreater: @" 9.0 " ]);
119
115
}
120
116
121
117
- (void )close : (id )unused
@@ -144,9 +140,7 @@ - (void)open:(id)args
144
140
BOOL entersReaderIfAvailable = [TiUtils boolValue: @" entersReaderIfAvailable" properties: args def: YES ];
145
141
BOOL barCollapsingEnabled = NO ;
146
142
147
- #if IS_IOS_11
148
143
barCollapsingEnabled = [TiUtils boolValue: @" barCollapsingEnabled" properties: args def: YES ];
149
- #endif
150
144
151
145
SFSafariViewController *safari = [self safariController: _url withEntersReaderIfAvailable: entersReaderIfAvailable andBarCollapsingEnabled: barCollapsingEnabled];
152
146
@@ -157,30 +151,28 @@ - (void)open:(id)args
157
151
if ([args objectForKey: @" tintColor" ]) {
158
152
TiColor *newColor = [TiUtils colorValue: @" tintColor" properties: args];
159
153
160
- if ([TiUtils isIOS10OrGreater ]) {
154
+ if ([TiUtils isIOSVersionOrGreater: @" 10.0 " ]) {
161
155
[safari setPreferredControlTintColor: [newColor _color ]];
162
156
} else {
163
157
[[safari view ] setTintColor: [newColor _color ]];
164
158
}
165
159
}
166
160
167
161
if ([args objectForKey: @" barColor" ]) {
168
- if ([TiUtils isIOS10OrGreater ]) {
162
+ if ([TiUtils isIOSVersionOrGreater: @" 10.0 " ]) {
169
163
[safari setPreferredBarTintColor: [[TiUtils colorValue: @" barColor" properties: args] _color ]];
170
164
} else {
171
165
NSLog (@" [ERROR] Ti.WebDialog: The barColor property is only available in iOS 10 and later" );
172
166
}
173
167
}
174
168
175
- #if IS_IOS_11
176
169
if ([args objectForKey: @" dismissButtonStyle" ]) {
177
170
if (@available (iOS 11.0 , *)) {
178
171
[safari setDismissButtonStyle: [TiUtils intValue: @" dismissButtonStyle" properties: args def: SFSafariViewControllerDismissButtonStyleDone]];
179
172
} else {
180
173
NSLog (@" [ERROR] Ti.WebDialog: The dismissButtonStyle property is only available in iOS 11 and later" );
181
174
}
182
175
}
183
- #endif
184
176
185
177
[[TiApp app ] showModalController: safari
186
178
animated: animated];
@@ -198,10 +190,8 @@ - (void)open:(id)args
198
190
199
191
#pragma mark Constants
200
192
201
- #if IS_IOS_11
202
193
MAKE_SYSTEM_PROP (DISMISS_BUTTON_STYLE_DONE, SFSafariViewControllerDismissButtonStyleDone);
203
194
MAKE_SYSTEM_PROP (DISMISS_BUTTON_STYLE_CLOSE, SFSafariViewControllerDismissButtonStyleClose);
204
195
MAKE_SYSTEM_PROP (DISMISS_BUTTON_STYLE_CANCEL, SFSafariViewControllerDismissButtonStyleCancel);
205
- #endif
206
196
207
197
@end
0 commit comments