no message
This commit is contained in:
parent
33672c87eb
commit
c2c6e9a299
@ -9,10 +9,10 @@
|
||||
#import "PNObject.h"
|
||||
#import "PNUser.h"
|
||||
|
||||
typedef NS_ENUM(NSInteger, PNInstallationType) {
|
||||
PNInstallationTypeNew = 0,
|
||||
PNInstallationTypeChange,
|
||||
PNInstallationTypeNone,
|
||||
typedef NS_ENUM(NSInteger, PNInstallationStatus) {
|
||||
PNInstallationStatusNew = 0,
|
||||
PNInstallationStatusChange,
|
||||
PNInstallationStatusNone,
|
||||
};
|
||||
|
||||
@interface PNInstallation : PNObject
|
||||
@ -35,7 +35,7 @@ typedef NS_ENUM(NSInteger, PNInstallationType) {
|
||||
*
|
||||
* @return RETURN YES if token is not set o token changes, NO if token is the same of old token.
|
||||
*/
|
||||
- (PNInstallationType) setDeviceTokenFromData:(nullable NSData *)deviceTokenData;
|
||||
- (PNInstallationStatus) setDeviceTokenFromData:(nullable NSData *)deviceTokenData;
|
||||
|
||||
/**
|
||||
* <#Description#>
|
||||
@ -82,6 +82,10 @@ typedef NS_ENUM(NSInteger, PNInstallationType) {
|
||||
* <#Description#>
|
||||
*/
|
||||
@property (nonatomic, assign) NSInteger badge;
|
||||
/**
|
||||
* <#Description#>
|
||||
*/
|
||||
@property (nonatomic, readonly) PNInstallationStatus installationStatus;
|
||||
/**
|
||||
* <#Description#>
|
||||
*/
|
||||
|
||||
@ -76,9 +76,12 @@ static bool isFirstAccess = YES;
|
||||
return INSTALLATION;
|
||||
}
|
||||
|
||||
- (PNInstallationType) setDeviceTokenFromData:(NSData *)deviceTokenData {
|
||||
- (PNInstallationStatus) setDeviceTokenFromData:(NSData *)deviceTokenData {
|
||||
|
||||
PNInstallationType response = PNInstallationTypeNone;
|
||||
if(!deviceTokenData){
|
||||
_installationStatus = PNInstallationStatusNone;
|
||||
return _installationStatus;
|
||||
}
|
||||
|
||||
self.deviceTokenData = deviceTokenData;
|
||||
|
||||
@ -89,10 +92,10 @@ static bool isFirstAccess = YES;
|
||||
|
||||
if (!_deviceToken) {
|
||||
|
||||
response = PNInstallationTypeNew;
|
||||
_installationStatus = PNInstallationStatusNew;
|
||||
}
|
||||
else if (_deviceToken && ![ptoken isEqualToString:_deviceToken]) {
|
||||
response = PNInstallationTypeChange;
|
||||
_installationStatus = PNInstallationStatusChange;
|
||||
}
|
||||
|
||||
/*[self setValue:_deviceToken forKey:VariableName(oldDeviceToken)];
|
||||
@ -100,11 +103,11 @@ static bool isFirstAccess = YES;
|
||||
*/
|
||||
_oldDeviceToken = _deviceToken;
|
||||
_deviceToken = ptoken;
|
||||
if (response != PNInstallationTypeNone) {
|
||||
if (_installationStatus != PNInstallationStatusNone) {
|
||||
_lastTokenUpdate = [NSDate date];
|
||||
}
|
||||
|
||||
return response;
|
||||
return _installationStatus;
|
||||
}
|
||||
|
||||
- (void) setBadge:(NSInteger)badge {
|
||||
@ -127,6 +130,21 @@ static bool isFirstAccess = YES;
|
||||
_updatedAt = [NSDate date];
|
||||
}
|
||||
|
||||
- (void) setUser:(PNUser *)user {
|
||||
if (!self.user) {
|
||||
self.user = user;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:PNObjectLocalNotificationPNInstallationUserNew object:nil];
|
||||
}
|
||||
else if(self.user.objID != user.objID) {
|
||||
self.user = user;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:PNObjectLocalNotificationPNInstallationUserChange object:nil];
|
||||
}
|
||||
else if (user == nil){
|
||||
self.user = nil;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:PNObjectLocalNotificationPNInstallationUserDelete object:nil];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
#pragma mark Private Methods
|
||||
@ -160,6 +178,7 @@ static bool isFirstAccess = YES;
|
||||
[self setValue:[[UIDevice currentDevice] name] forKey:VariableName(deviceName)];
|
||||
[self setValue:[[DJLocalizationSystem shared] language] forKey:VariableName(localeIdentifier)];
|
||||
*/
|
||||
_installationStatus = PNInstallationStatusNone;
|
||||
_deviceType = @"iOS";
|
||||
_deviceModel = [[UIDevice currentDevice] model];
|
||||
_osVersion = [[UIDevice currentDevice] systemVersion];
|
||||
|
||||
@ -31,6 +31,10 @@ extern NSString* _Nonnull const PNObjectLocalNotificationUserReloadFromServerFai
|
||||
extern NSString* _Nonnull const PNObjectLocalNotificationUserWillLogout;
|
||||
extern NSString* _Nonnull const PNObjectLocalNotificationUserEndLogout;
|
||||
|
||||
extern NSString* _Nonnull const PNObjectLocalNotificationPNInstallationUserNew;
|
||||
extern NSString* _Nonnull const PNObjectLocalNotificationPNInstallationUserChange;
|
||||
extern NSString* _Nonnull const PNObjectLocalNotificationPNInstallationUserDelete;
|
||||
|
||||
#pragma mark -
|
||||
|
||||
extern NSString* _Nonnull const EnvironmentProduction;
|
||||
|
||||
@ -30,6 +30,10 @@ NSString * const PNObjectLocalNotificationUserReloadFromServerFailure = @"PNObje
|
||||
NSString * const PNObjectLocalNotificationUserWillLogout = @"PNObjectLocalNotificationUserLogout";
|
||||
NSString * const PNObjectLocalNotificationUserEndLogout = @"PNObjectLocalNotificationUserLogout";
|
||||
|
||||
NSString * const PNObjectLocalNotificationPNInstallationUserNew = @"PNObjectLocalNotificationPNInstallationUserNew";
|
||||
NSString * const PNObjectLocalNotificationPNInstallationUserChange = @"PNObjectLocalNotificationPNInstallationUserChange";
|
||||
NSString * const PNObjectLocalNotificationPNInstallationUserDelete = @"PNObjectLocalNotificationPNInstallationUserDelete";
|
||||
|
||||
NSInteger const minPassLenght = 4;
|
||||
|
||||
NSString * const PNObjectEncryptionKey = @"PNObjectConfigEncryptionKey";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user