- add badge management

This commit is contained in:
Giuseppe Nucifora 2016-04-29 10:26:42 +02:00
parent 052fa21981
commit def9c0fd06
2 changed files with 18 additions and 1 deletions

View File

@ -36,6 +36,11 @@ typedef NS_ENUM(NSInteger, PNInstallationType) {
*/
- (PNInstallationType) setDeviceTokenFromData:(nullable NSData *)deviceTokenData;
/**
* <#Description#>
*/
- (void) resetBadge;
///--------------------------------------
#pragma mark - PNInstallation Properties
///--------------------------------------
@ -75,6 +80,6 @@ typedef NS_ENUM(NSInteger, PNInstallationType) {
/**
* <#Description#>
*/
@property (nonatomic, strong) NSDate *lastUpdate;
@property (nonatomic, strong, readonly, nullable) NSDate *lastUpdate;
@end

View File

@ -101,6 +101,18 @@ static bool isFirstAccess = YES;
return response;
}
- (void) setBadge:(NSInteger)badge {
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:badge];
}
- (NSInteger) badge {
return [[UIApplication sharedApplication] applicationIconBadgeNumber];
}
- (void) resetBadge {
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
}
#pragma mark -
#pragma mark Private Methods