- fix object
This commit is contained in:
parent
c054feaec0
commit
3d11d2f025
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = "PNObject"
|
s.name = "PNObject"
|
||||||
s.version = "0.5.6"
|
s.version = "0.5.7"
|
||||||
s.summary = "PNObject is a simple replica of the more complex ParseObject"
|
s.summary = "PNObject is a simple replica of the more complex ParseObject"
|
||||||
|
|
||||||
# This description is used to generate tags and improve search results.
|
# This description is used to generate tags and improve search results.
|
||||||
|
|||||||
@ -8,6 +8,12 @@
|
|||||||
|
|
||||||
#import "PNObject.h"
|
#import "PNObject.h"
|
||||||
|
|
||||||
|
typedef NS_ENUM(NSInteger, PNInstallationType) {
|
||||||
|
PNInstallationTypeNew = 0,
|
||||||
|
PNInstallationTypeChange,
|
||||||
|
PNInstallationTypeNone,
|
||||||
|
};
|
||||||
|
|
||||||
@interface PNInstallation : PNObject
|
@interface PNInstallation : PNObject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,7 +34,7 @@
|
|||||||
*
|
*
|
||||||
* @return RETURN YES if token is not set o token changes, NO if token is the same of old token.
|
* @return RETURN YES if token is not set o token changes, NO if token is the same of old token.
|
||||||
*/
|
*/
|
||||||
- (BOOL) setDeviceTokenFromData:(nullable NSData *)deviceTokenData;
|
- (PNInstallationType) setDeviceTokenFromData:(nullable NSData *)deviceTokenData;
|
||||||
|
|
||||||
///--------------------------------------
|
///--------------------------------------
|
||||||
#pragma mark - PNInstallation Properties
|
#pragma mark - PNInstallation Properties
|
||||||
|
|||||||
@ -69,9 +69,9 @@ static bool isFirstAccess = YES;
|
|||||||
return INSTALLATION;
|
return INSTALLATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) setDeviceTokenFromData:(NSData *)deviceTokenData {
|
- (PNInstallationType) setDeviceTokenFromData:(NSData *)deviceTokenData {
|
||||||
|
|
||||||
BOOL response = NO;
|
PNInstallationType response = PNInstallationTypeNone;
|
||||||
|
|
||||||
_deviceTokenData = deviceTokenData;
|
_deviceTokenData = deviceTokenData;
|
||||||
|
|
||||||
@ -80,9 +80,12 @@ static bool isFirstAccess = YES;
|
|||||||
stringByReplacingOccurrencesOfString:@">" withString:@""]
|
stringByReplacingOccurrencesOfString:@">" withString:@""]
|
||||||
stringByReplacingOccurrencesOfString: @" " withString: @""];
|
stringByReplacingOccurrencesOfString: @" " withString: @""];
|
||||||
|
|
||||||
if (!_deviceToken || (_deviceToken && ![ptoken isEqualToString:_deviceToken])) {
|
if (!_deviceToken) {
|
||||||
|
|
||||||
response = YES;
|
response = PNInstallationTypeNew;
|
||||||
|
}
|
||||||
|
else if (_deviceToken && ![ptoken isEqualToString:_deviceToken]) {
|
||||||
|
response = PNInstallationTypeChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
_oldDeviceToken = _deviceToken;
|
_oldDeviceToken = _deviceToken;
|
||||||
|
|||||||
@ -61,10 +61,11 @@ extern NSString* _Nonnull const PNObjectMappingSelector;
|
|||||||
#pragma mark - PNObject Properties
|
#pragma mark - PNObject Properties
|
||||||
///--------------------------------------
|
///--------------------------------------
|
||||||
|
|
||||||
|
@property (nonatomic, strong, nonnull) NSString *objID;
|
||||||
/**
|
/**
|
||||||
* <#Description#>
|
* <#Description#>
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, strong, nonnull) NSString * objID;
|
@property (nonatomic, strong, nonnull) NSString * localObjID;
|
||||||
/**
|
/**
|
||||||
* <#Description#>
|
* <#Description#>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -40,7 +40,8 @@ NSString * const PNObjectMappingSelector = @"selector";
|
|||||||
#pragma mark PNObjectSubclassing
|
#pragma mark PNObjectSubclassing
|
||||||
|
|
||||||
+ (NSDictionary *) objcetMapping {
|
+ (NSDictionary *) objcetMapping {
|
||||||
NSDictionary *mapping = @{@"objID":@"objID",
|
NSDictionary *mapping = @{@"objID":@"uuid",
|
||||||
|
@"localObjID":@"localObjID",
|
||||||
@"createdAt":@"created_at",
|
@"createdAt":@"created_at",
|
||||||
};
|
};
|
||||||
return mapping;
|
return mapping;
|
||||||
@ -87,7 +88,7 @@ NSString * const PNObjectMappingSelector = @"selector";
|
|||||||
|
|
||||||
NSAssert([[self class] conformsToProtocol:@protocol(PNObjectSubclassing)], @"Subclass object must conform to PNObjectSubclassing");
|
NSAssert([[self class] conformsToProtocol:@protocol(PNObjectSubclassing)], @"Subclass object must conform to PNObjectSubclassing");
|
||||||
|
|
||||||
_objID = [[NSProcessInfo processInfo] globallyUniqueString];
|
_localObjID = [[NSProcessInfo processInfo] globallyUniqueString];
|
||||||
|
|
||||||
self.objectModel = [PNObjectModel sharedInstance];
|
self.objectModel = [PNObjectModel sharedInstance];
|
||||||
[self.objectModel setPersistencyDelegate:self];
|
[self.objectModel setPersistencyDelegate:self];
|
||||||
@ -146,7 +147,7 @@ NSString * const PNObjectMappingSelector = @"selector";
|
|||||||
if ([[self class] isSubclassOfClass:[PNObject class]]) {
|
if ([[self class] isSubclassOfClass:[PNObject class]]) {
|
||||||
NSAssert([[self class] conformsToProtocol:@protocol(PNObjectSubclassing)], @"Subclass object must conform to PNObjectSubclassing Protocol");
|
NSAssert([[self class] conformsToProtocol:@protocol(PNObjectSubclassing)], @"Subclass object must conform to PNObjectSubclassing Protocol");
|
||||||
|
|
||||||
_objID = [[NSProcessInfo processInfo] globallyUniqueString];
|
_localObjID = [[NSProcessInfo processInfo] globallyUniqueString];
|
||||||
|
|
||||||
self.objectModel = [PNObjectModel sharedInstance];
|
self.objectModel = [PNObjectModel sharedInstance];
|
||||||
[self.objectModel setPersistencyDelegate:self];
|
[self.objectModel setPersistencyDelegate:self];
|
||||||
@ -454,6 +455,7 @@ NSString * const PNObjectMappingSelector = @"selector";
|
|||||||
_JSON = nil;
|
_JSON = nil;
|
||||||
_JSONObjectMap = nil;
|
_JSONObjectMap = nil;
|
||||||
_objID = nil;
|
_objID = nil;
|
||||||
|
_localObjID = nil;
|
||||||
_createdAt = nil;
|
_createdAt = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user