Skip to content

Commit

Permalink
Merge pull request #6101 from jonalter/TIMOB-17707
Browse files Browse the repository at this point in the history
[TIMOB-17707] changing Ti.App.iOS event name from 'backgroundNotificatio...
  • Loading branch information
vishalduggal committed Sep 16, 2014
2 parents 3ad2a5d + 1423554 commit 693cd0a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
5 changes: 2 additions & 3 deletions apidoc/Titanium/App/iOS/iOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ description: |
with the <Titanium.App.iOS.createUserNotificationCategory> method.
3. Register the notification categories with the
<Titanium.App.iOS.registerUserNotificationSettings> method.
4. Monitor the [backgroundNotification](Titanium.App.iOS.backgroundNotification)
event while the app is the background.
4. Monitor the [localnotificationaction](Titanium.App.iOS.localnotificationaction) event.
For instructions on sending local interactive notifications, see the
[iOS Local Notifications guide](http://docs.appcelerator.com/titanium/latest/#!/guide/iOS_Local_Notifications).
Expand Down Expand Up @@ -288,7 +287,7 @@ events:
summary: Custom data object.
type: Dictionary

- name: backgroundNotification
- name: localnotificationaction
summary: Fired when a user selects an action for an interactive notification.
properties:
- name: alertAction
Expand Down
3 changes: 1 addition & 2 deletions iphone/Classes/TiApp.m
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ - (void)generateNotification:(NSDictionary*)dict
}
[remoteNotification setValue:[aps valueForKey:key] forKey:key];
}
DebugLog(@"[WARN] Accessing APS keys from toplevel of notification is deprecated");
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions_
Expand Down Expand Up @@ -441,7 +440,7 @@ - (void)application:(UIApplication *)application didRegisterUserNotificationSett
- (void) application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forLocalNotification:(UILocalNotification *)notification completionHandler:(void (^)())completionHandler {
RELEASE_TO_NIL(localNotification);
localNotification = [[TiApp dictionaryWithLocalNotification:notification withIdentifier:identifier] retain];
[[NSNotificationCenter defaultCenter] postNotificationName:kTiBackgroundLocalNotification object:localNotification userInfo:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:kTiLocalNotificationAction object:localNotification userInfo:nil];
completionHandler();
}

Expand Down
10 changes: 5 additions & 5 deletions iphone/Classes/TiAppiOSProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ -(void)_listenerAdded:(NSString*)type count:(int)count
if (count == 1 && [type isEqual:@"notification"]) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveLocalNotification:) name:kTiLocalNotification object:nil];
}
if (count == 1 && [type isEqual:@"backgroundNotification"]) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveBackgroundLocalNotification:) name:kTiBackgroundLocalNotification object:nil];
if (count == 1 && [type isEqual:@"localnotificationaction"]) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveBackgroundLocalNotification:) name:kTiLocalNotificationAction object:nil];
}

if ((count == 1) && [type isEqual:@"backgroundfetch"]) {
Expand Down Expand Up @@ -87,8 +87,8 @@ -(void)_listenerRemoved:(NSString*)type count:(int)count
if (count == 0 && [type isEqual:@"notification"]) {
[[NSNotificationCenter defaultCenter] removeObserver:self name:kTiLocalNotification object:nil];
}
if (count == 0 && [type isEqual:@"backgroundNotification"]) {
[[NSNotificationCenter defaultCenter] removeObserver:self name:kTiBackgroundLocalNotification object:nil];
if (count == 0 && [type isEqual:@"localnotificationaction"]) {
[[NSNotificationCenter defaultCenter] removeObserver:self name:kTiLocalNotificationAction object:nil];
}

if ((count == 1) && [type isEqual:@"backgroundfetch"]) {
Expand Down Expand Up @@ -466,7 +466,7 @@ -(void)didReceiveLocalNotification:(NSNotification*)note
-(void)didReceiveBackgroundLocalNotification:(NSNotification*)note
{
NSDictionary *notification = [note object];
[self fireEvent:@"backgroundNotification" withObject:notification];
[self fireEvent:@"localnotificationaction" withObject:notification];
}

-(void)didReceiveBackgroundFetchNotification:(NSNotification*)note
Expand Down
2 changes: 1 addition & 1 deletion iphone/Classes/TiBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ extern NSString * const kTiSilentPushNotification;
extern NSString * const kTiBackgroundTransfer;
extern NSString * const kTiFrameAdjustNotification;
extern NSString * const kTiLocalNotification;
extern NSString * const kTiBackgroundLocalNotification;
extern NSString * const kTiLocalNotificationAction;
extern NSString * const kTiUserNotificationSettingsNotification;
extern NSString * const kTiBackgroundTransfer;
extern NSString * const kTiURLDownloadFinished;
Expand Down
2 changes: 1 addition & 1 deletion iphone/Classes/TiBase.m
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void TiLogMessage(NSString* str, ...) {
NSString * const kTiURLUploadProgress = @"TiUploadProgress";
NSString * const kTiFrameAdjustNotification = @"TiFrameAdjust";
NSString * const kTiLocalNotification = @"TiLocalNotification";
NSString * const kTiBackgroundLocalNotification = @"TiBackgroundLocalNotification";
NSString * const kTiLocalNotificationAction = @"TiLocalNotificationAction";
NSString * const kTiUserNotificationSettingsNotification = @"TiUserNotificationSettingsNotification";

NSString* const kTiBehaviorSize = @"SIZE";
Expand Down

0 comments on commit 693cd0a

Please sign in to comment.