Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

fix issue #42 #43

Merged
merged 1 commit into from
Jul 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/ios/PushPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -239,16 +239,16 @@ - (void)notificationReceived {
}
}

- (void)setApplicationIconBadgeNumber:(CDVInvokedUrlCommand *)command {

self.callbackId = command.callbackId;

- (void)setApplicationIconBadgeNumber:(CDVInvokedUrlCommand *)command
{
NSMutableDictionary* options = [command.arguments objectAtIndex:0];
int badge = [[options objectForKey:@"badge"] intValue] ?: 0;

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:badge];

[self successWithMessage:[NSString stringWithFormat:@"app badge count set to %d", badge]];
NSString* message = [NSString stringWithFormat:@"app badge count set to %d", badge];
CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:message];
[self.commandDelegate sendPluginResult:commandResult callbackId:command.callbackId];
}

-(void)successWithMessage:(NSString *)message
Expand Down
2 changes: 1 addition & 1 deletion www/push.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ PushNotification.prototype.setApplicationIconBadgeNumber = function(successCallb
return
}

cordova.exec(successCallback, errorCallback, "PushNotification", "setApplicationIconBadgeNumber", [{badge: badge}]);
exec(successCallback, errorCallback, "PushNotification", "setApplicationIconBadgeNumber", [{badge: badge}]);
};

/**
Expand Down