Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-24775] iOS: Add Xcode 9 utils, fix NSNotification argument #9429

Merged
merged 2 commits into from
Sep 16, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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