Skip to content

Commit

Permalink
[TIMOB-24775] Add Xcode 9 utils, fix post-arg (tidev#9429)
Browse files Browse the repository at this point in the history
  • Loading branch information
hansemannn committed Sep 16, 2017
1 parent 2ca8b26 commit 1a3f855
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
4 changes: 3 additions & 1 deletion iphone/Classes/TiApp.m
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,9 @@ - (void)application:(UIApplication *)application performFetchWithCompletionHandl

- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
[[NSNotificationCenter defaultCenter] postNotificationName:kTiUserNotificationSettingsNotification object:self userInfo:notificationSettings];
[[NSNotificationCenter defaultCenter] postNotificationName:kTiUserNotificationSettingsNotification
object:self
userInfo:@{ @"userNotificationSettings": notificationSettings }];
}

- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forLocalNotification:(UILocalNotification *)notification withResponseInfo:(NSDictionary *)responseInfo completionHandler:(void (^)())completionHandler
Expand Down
3 changes: 2 additions & 1 deletion iphone/Classes/TiAppiOSProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,8 @@ - (void)didReceiveUploadProgressNotification:(NSNotification *)note

- (void)didRegisterUserNotificationSettingsNotification:(NSNotification *)note
{
[self fireEvent:@"usernotificationsettings" withObject:[self formatUserNotificationSettings:(UIUserNotificationSettings *)[note userInfo]]];
[self fireEvent:@"usernotificationsettings"
withObject:[self formatUserNotificationSettings:(UIUserNotificationSettings *)[[note userInfo] valueForKey:@"userNotificationSettings"]]];
}

#pragma mark Apple Watchkit notifications
Expand Down
6 changes: 6 additions & 0 deletions iphone/Classes/TiUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,12 @@ typedef enum {
*/
+ (BOOL)isIOS10OrGreater;

/**
Whether or not the current OS version is equal to or greater than 11.0.
@return _YES_ if the current OS version is equal to or greater than 11.0, _NO_ otherwise.
*/
+ (BOOL)isIOS11OrGreater;

/**
Whether or not the current OS version is equal to or greater than the specified version.
@param version The version to compare.
Expand Down
9 changes: 9 additions & 0 deletions iphone/Classes/TiUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,15 @@ + (BOOL)isIOS10OrGreater
#endif
}

+ (BOOL)isIOS11OrGreater
{
#if IS_XCODE_9
return [TiUtils isIOSVersionOrGreater:@"11.0"];
#else
return NO;
#endif
}

+ (BOOL)isIOSVersionOrGreater:(NSString *)version
{
return [[[UIDevice currentDevice] systemVersion] compare:version options:NSNumericSearch] != NSOrderedAscending;
Expand Down
7 changes: 7 additions & 0 deletions iphone/iphone/Titanium_Prefix.pch
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@
#else
#define IS_XCODE_8 false
#endif

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
#define IS_XCODE_9 true
#else
#define IS_XCODE_9 false
#endif

0 comments on commit 1a3f855

Please sign in to comment.