From 33672c87eb977c8ceea9222d59569698dd6410ce Mon Sep 17 00:00:00 2001 From: Giuseppe Nucifora Date: Fri, 29 Apr 2016 11:26:44 +0200 Subject: [PATCH] - Fix class naming in default classes - Add User in PNInstallation - Varius fix --- PNObject.podspec | 2 +- Pod/Classes/PNClasses/PNAddress.m | 4 ++-- Pod/Classes/PNClasses/PNInstallation.h | 3 ++- Pod/Classes/PNClasses/PNInstallation.m | 6 +++++- Pod/Classes/PNClasses/PNLocation.m | 4 ++-- Pod/Classes/PNClasses/PNObjcPassword.m | 4 ++-- Pod/Classes/PNClasses/PNUser.m | 10 +++++++--- Pod/Classes/PNObjectConfig.h | 1 + Pod/Classes/PNObjectConfig.m | 2 +- 9 files changed, 23 insertions(+), 13 deletions(-) diff --git a/PNObject.podspec b/PNObject.podspec index 760ad39..c5f6c17 100644 --- a/PNObject.podspec +++ b/PNObject.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = "PNObject" -s.version = "0.7.7" +s.version = "0.7.8" s.summary = "PNObject is a simple replica of the more complex ParseObject" # This description is used to generate tags and improve search results. diff --git a/Pod/Classes/PNClasses/PNAddress.m b/Pod/Classes/PNClasses/PNAddress.m index 43db194..d123a10 100644 --- a/Pod/Classes/PNClasses/PNAddress.m +++ b/Pod/Classes/PNClasses/PNAddress.m @@ -11,11 +11,11 @@ @implementation PNAddress + (NSString *) objectClassName { - return @"Address"; + return @"PNAddress"; } + (NSString *)objectEndPoint { - return @"Address"; + return @"PNAddress"; } + (NSDictionary *) objcetMapping { diff --git a/Pod/Classes/PNClasses/PNInstallation.h b/Pod/Classes/PNClasses/PNInstallation.h index 760ec56..24aa885 100644 --- a/Pod/Classes/PNClasses/PNInstallation.h +++ b/Pod/Classes/PNClasses/PNInstallation.h @@ -7,6 +7,7 @@ // #import "PNObject.h" +#import "PNUser.h" typedef NS_ENUM(NSInteger, PNInstallationType) { PNInstallationTypeNew = 0, @@ -48,7 +49,7 @@ typedef NS_ENUM(NSInteger, PNInstallationType) { ///-------------------------------------- #pragma mark - PNInstallation Properties ///-------------------------------------- - +@property (nonatomic, strong, nullable) PNUser *user; /** * <#Description#> */ diff --git a/Pod/Classes/PNClasses/PNInstallation.m b/Pod/Classes/PNClasses/PNInstallation.m index b876f98..3ae34aa 100644 --- a/Pod/Classes/PNClasses/PNInstallation.m +++ b/Pod/Classes/PNClasses/PNInstallation.m @@ -8,6 +8,10 @@ #import "PNInstallation.h" #import "DJLocalization.h" +#import "PNObjectConfig.h" + + + @interface PNInstallation() @@ -28,7 +32,7 @@ static bool isFirstAccess = YES; + (NSDictionary *)objcetMapping { - NSDictionary *mapping = @{ + NSDictionary *mapping = @{@"user":@{@"key":@"user",@"type":[[[PNObjectConfig sharedInstance] userSubClass] PNObjClassName]}, @"deviceType":@"deviceType", @"deviceModel":@"deviceModel", @"deviceName":@"deviceName", diff --git a/Pod/Classes/PNClasses/PNLocation.m b/Pod/Classes/PNClasses/PNLocation.m index 3d5f5a5..47f8dd5 100644 --- a/Pod/Classes/PNClasses/PNLocation.m +++ b/Pod/Classes/PNClasses/PNLocation.m @@ -11,11 +11,11 @@ @implementation PNLocation + (NSString *) objectClassName { - return @"Location"; + return @"PNLocation"; } +(NSString *)objectEndPoint { - return @"Location"; + return @"PNLocation"; } + (NSDictionary *) objcetMapping { diff --git a/Pod/Classes/PNClasses/PNObjcPassword.m b/Pod/Classes/PNClasses/PNObjcPassword.m index bc4f007..2bde28d 100644 --- a/Pod/Classes/PNClasses/PNObjcPassword.m +++ b/Pod/Classes/PNClasses/PNObjcPassword.m @@ -13,11 +13,11 @@ @implementation PNObjcPassword + (NSString *) objectClassName { - return @"Password"; + return @"PNObjcPassword"; } +(NSString *)objectEndPoint { - return @"Password"; + return @"PNObjcPassword"; } + (NSDictionary *) objcetMapping { diff --git a/Pod/Classes/PNClasses/PNUser.m b/Pod/Classes/PNClasses/PNUser.m index 39b13b0..361e9b9 100644 --- a/Pod/Classes/PNClasses/PNUser.m +++ b/Pod/Classes/PNClasses/PNUser.m @@ -55,12 +55,16 @@ static bool isFirstAccess = YES; - (instancetype)copy { - return [[PNUser alloc] init]; + Class objectClass = NSClassFromString([[self class] PNObjClassName]); + + return [[objectClass alloc] init]; } - (instancetype)mutableCopy { - return [[PNUser alloc] init]; + Class objectClass = NSClassFromString([[self class] PNObjClassName]); + + return [[objectClass alloc] init]; } - (instancetype) initForCurrentUser @@ -405,7 +409,7 @@ static bool isFirstAccess = YES; @"sex":@"sex", @"birthDate":@"birthDate", @"phone":@"phone", - @"password":@{@"key":@"password",@"type":@"PNObjcPassword"}, + @"password":@{@"key":@"password",@"type":[PNObjcPassword PNObjClassName]}, @"hasAcceptedPrivacy":@"hasAcceptedPrivacy", @"hasAcceptedNewsletter":@"hasAcceptedNewsletter", @"hasVerifiedEmail":@"hasVerifiedEmail", diff --git a/Pod/Classes/PNObjectConfig.h b/Pod/Classes/PNObjectConfig.h index 5f0e546..3b67bf5 100644 --- a/Pod/Classes/PNObjectConfig.h +++ b/Pod/Classes/PNObjectConfig.h @@ -216,6 +216,7 @@ extern NSString* _Nonnull const Client_Secret; #pragma mark - PNObjectConfig Properties ///-------------------------------------- +@property (nonatomic, readonly, nonnull) Class userSubClass; /** * <#Description#> */ diff --git a/Pod/Classes/PNObjectConfig.m b/Pod/Classes/PNObjectConfig.m index 26eb241..542f09f 100644 --- a/Pod/Classes/PNObjectConfig.m +++ b/Pod/Classes/PNObjectConfig.m @@ -58,7 +58,7 @@ NSString* const Client_Secret = @"client_secret"; @property (nonatomic, strong) NSString *currentOAuthClientSecret; @property (nonatomic, strong) AFOAuth2Manager *authManager; -@property (nonatomic) Class userSubClass; + @end