Merge branch 'develop'
* develop: - Update Project to 1.2.1 - Fix Installation Date
This commit is contained in:
commit
1ce4f9bc2d
@ -61,6 +61,7 @@
|
|||||||
6003F5BB195388D20070C39A /* Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tests.m; sourceTree = "<group>"; };
|
6003F5BB195388D20070C39A /* Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tests.m; sourceTree = "<group>"; };
|
||||||
606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = "<group>"; };
|
606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = "<group>"; };
|
||||||
68119C951E155BAA00E066C7 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
|
68119C951E155BAA00E066C7 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
|
||||||
|
681A32481E2CFB7300DF98BF /* PNObject_Example.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = PNObject_Example.entitlements; sourceTree = "<group>"; };
|
||||||
873B8AEA1B1F5CCA007FD442 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
|
873B8AEA1B1F5CCA007FD442 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
|
||||||
A90E0E5930707E3F83662328 /* Pods-PNObject_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PNObject_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-PNObject_Tests/Pods-PNObject_Tests.debug.xcconfig"; sourceTree = "<group>"; };
|
A90E0E5930707E3F83662328 /* Pods-PNObject_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PNObject_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-PNObject_Tests/Pods-PNObject_Tests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||||
C0F786F6B0C2234E3B3A5F30 /* Pods-PNObject_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PNObject_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-PNObject_Tests/Pods-PNObject_Tests.release.xcconfig"; sourceTree = "<group>"; };
|
C0F786F6B0C2234E3B3A5F30 /* Pods-PNObject_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PNObject_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-PNObject_Tests/Pods-PNObject_Tests.release.xcconfig"; sourceTree = "<group>"; };
|
||||||
@ -99,6 +100,7 @@
|
|||||||
6003F581195388D10070C39A = {
|
6003F581195388D10070C39A = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
681A32481E2CFB7300DF98BF /* PNObject_Example.entitlements */,
|
||||||
60FF7A9C1954A5C5007DD14C /* Podspec Metadata */,
|
60FF7A9C1954A5C5007DD14C /* Podspec Metadata */,
|
||||||
6003F593195388D20070C39A /* Example for PNObject */,
|
6003F593195388D20070C39A /* Example for PNObject */,
|
||||||
6003F5B5195388D20070C39A /* Tests */,
|
6003F5B5195388D20070C39A /* Tests */,
|
||||||
@ -253,6 +255,11 @@
|
|||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
6003F589195388D20070C39A = {
|
6003F589195388D20070C39A = {
|
||||||
DevelopmentTeam = 825G85A28E;
|
DevelopmentTeam = 825G85A28E;
|
||||||
|
SystemCapabilities = {
|
||||||
|
com.apple.Push = {
|
||||||
|
enabled = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
6003F5AD195388D20070C39A = {
|
6003F5AD195388D20070C39A = {
|
||||||
TestTargetID = 6003F589195388D20070C39A;
|
TestTargetID = 6003F589195388D20070C39A;
|
||||||
@ -529,6 +536,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
|
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
|
||||||
|
CODE_SIGN_ENTITLEMENTS = PNObject_Example.entitlements;
|
||||||
DEVELOPMENT_TEAM = 825G85A28E;
|
DEVELOPMENT_TEAM = 825G85A28E;
|
||||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||||
GCC_PREFIX_HEADER = "PNObject/PNObject-Prefix.pch";
|
GCC_PREFIX_HEADER = "PNObject/PNObject-Prefix.pch";
|
||||||
@ -546,6 +554,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
|
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
|
||||||
|
CODE_SIGN_ENTITLEMENTS = PNObject_Example.entitlements;
|
||||||
DEVELOPMENT_TEAM = 825G85A28E;
|
DEVELOPMENT_TEAM = 825G85A28E;
|
||||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||||
GCC_PREFIX_HEADER = "PNObject/PNObject-Prefix.pch";
|
GCC_PREFIX_HEADER = "PNObject/PNObject-Prefix.pch";
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
#import "UIDevice-Hardware.h"
|
#import "UIDevice-Hardware.h"
|
||||||
|
|
||||||
#import <PNObject/PNInstallation.h>
|
#import <PNObject/PNInstallation.h>
|
||||||
|
#import <NSDate_Utils/NSDate+NSDate_Util.h>
|
||||||
|
|
||||||
@implementation PNObjAppDelegate
|
@implementation PNObjAppDelegate
|
||||||
|
|
||||||
@ -143,6 +144,49 @@
|
|||||||
|
|
||||||
//[installation setUser:nil];
|
//[installation setUser:nil];
|
||||||
|
|
||||||
|
[self updateDeviceUser];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) updateDeviceUser {
|
||||||
|
|
||||||
|
if ([PNUser currentUser] && [[PNUser currentUser] isAuthenticated]) {
|
||||||
|
[[PNInstallation currentInstallation] setUser:[PNUser currentUser]];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
[[PNInstallation currentInstallation] setUser:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (![[PNInstallation currentInstallation] registeredAt] || [[NSDate date] isLaterThanDate:[[[PNInstallation currentInstallation] lastTokenUpdate] dateByAddingDays:1]]) {
|
||||||
|
[self registerRemoteDevice];
|
||||||
|
}
|
||||||
|
else if ([[PNInstallation currentInstallation] updatedAt] || [[NSDate date] isLaterThanDate:[[[PNInstallation currentInstallation] updatedAt] dateByAddingMinutes:30]]) {
|
||||||
|
[self updateRemoteDevice];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) registerRemoteDevice {
|
||||||
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
|
[[PNInstallation currentInstallation] registerDeviceWithBlockProgress:^(NSProgress * _Nonnull uploadProgress) {
|
||||||
|
|
||||||
|
} Success:^(BOOL response) {
|
||||||
|
NSLog(@"device registrato");
|
||||||
|
} failure:^(NSError * _Nonnull error) {
|
||||||
|
NSLog(@"device non registrato");
|
||||||
|
}];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) updateRemoteDevice {
|
||||||
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
|
[[PNInstallation currentInstallation] updateDeviceWithBlockProgress:^(NSProgress * _Nonnull uploadProgress) {
|
||||||
|
|
||||||
|
} Success:^(BOOL response) {
|
||||||
|
NSLog(@"device aggiornato");
|
||||||
|
} failure:^(NSError * _Nonnull error) {
|
||||||
|
NSLog(@"device non aggiornato");
|
||||||
|
}];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
|
- (void) application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
|
||||||
|
|||||||
8
Example/PNObject_Example.entitlements
Normal file
8
Example/PNObject_Example.entitlements
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>aps-environment</key>
|
||||||
|
<string>development</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@ -33,11 +33,11 @@ PODS:
|
|||||||
- FBSDKShareKit (4.18.0):
|
- FBSDKShareKit (4.18.0):
|
||||||
- FBSDKCoreKit
|
- FBSDKCoreKit
|
||||||
- NSDataAES (0.2.2)
|
- NSDataAES (0.2.2)
|
||||||
- NSDate_Utils (1.0.3)
|
- NSDate_Utils (1.0.5)
|
||||||
- NSString-Helper (1.0.5)
|
- NSString-Helper (1.0.5)
|
||||||
- nv-ios-http-status (0.0.1)
|
- nv-ios-http-status (0.0.1)
|
||||||
- PEAR-FileManager-iOS (1.3.1)
|
- PEAR-FileManager-iOS (1.3.1)
|
||||||
- PNObject (1.1.1):
|
- PNObject (1.2.1):
|
||||||
- AFNetworking
|
- AFNetworking
|
||||||
- CodFis-Helper
|
- CodFis-Helper
|
||||||
- DDDKeychainWrapper
|
- DDDKeychainWrapper
|
||||||
@ -80,11 +80,11 @@ SPEC CHECKSUMS:
|
|||||||
FBSDKLoginKit: 6773073e970b2b15fb12e451ce7f11da0532b880
|
FBSDKLoginKit: 6773073e970b2b15fb12e451ce7f11da0532b880
|
||||||
FBSDKShareKit: 0b8d6cc3f103c75297eb3c62caec284a2ccf1b9e
|
FBSDKShareKit: 0b8d6cc3f103c75297eb3c62caec284a2ccf1b9e
|
||||||
NSDataAES: 967ea3337476a80e9838a533c25d570a06855ed0
|
NSDataAES: 967ea3337476a80e9838a533c25d570a06855ed0
|
||||||
NSDate_Utils: 2fb4071323341507c610821bc99b98ef8c46d4ac
|
NSDate_Utils: b0ab72ccec6df25297766bd64b0cd0c124521a45
|
||||||
NSString-Helper: 459e1b6a62b3bf7db10f01b0d102548608e945c4
|
NSString-Helper: 459e1b6a62b3bf7db10f01b0d102548608e945c4
|
||||||
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
|
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
|
||||||
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
|
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
|
||||||
PNObject: f38657e6b3e643f397da970c9e454bd2991b5b94
|
PNObject: 6a528830b3769a9675bcfa90bd9f09cfa1cef9f2
|
||||||
PureLayout: 4d550abe49a94f24c2808b9b95db9131685fe4cd
|
PureLayout: 4d550abe49a94f24c2808b9b95db9131685fe4cd
|
||||||
RZDataBinding: 6981e90ddaae2f5e02028323b1043f8c31013109
|
RZDataBinding: 6981e90ddaae2f5e02028323b1043f8c31013109
|
||||||
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
|
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "PNObject",
|
"name": "PNObject",
|
||||||
"version": "1.1.1",
|
"version": "1.2.1",
|
||||||
"summary": "PNObject is a simple replica of the more complex ParseObject",
|
"summary": "PNObject is a simple replica of the more complex ParseObject",
|
||||||
"homepage": "https://git.giuseppenucifora.com/giuseppenucifora/PNObject",
|
"homepage": "https://github.com/giuseppenucifora/PNObject",
|
||||||
"license": {
|
"license": {
|
||||||
"type": "MIT",
|
"type": "MIT",
|
||||||
"file": "LICENSE"
|
"file": "LICENSE"
|
||||||
@ -11,8 +11,8 @@
|
|||||||
"Giuseppe Nucifora": "me@giuseppenucifora.com"
|
"Giuseppe Nucifora": "me@giuseppenucifora.com"
|
||||||
},
|
},
|
||||||
"source": {
|
"source": {
|
||||||
"git": "https://git.giuseppenucifora.com/giuseppenucifora/PNObject.git",
|
"git": "https://github.com/giuseppenucifora/PNObject.git",
|
||||||
"tag": "1.1.1"
|
"tag": "1.2.1"
|
||||||
},
|
},
|
||||||
"platforms": {
|
"platforms": {
|
||||||
"ios": "8.0"
|
"ios": "8.0"
|
||||||
|
|||||||
8
Example/Pods/Manifest.lock
generated
8
Example/Pods/Manifest.lock
generated
@ -33,11 +33,11 @@ PODS:
|
|||||||
- FBSDKShareKit (4.18.0):
|
- FBSDKShareKit (4.18.0):
|
||||||
- FBSDKCoreKit
|
- FBSDKCoreKit
|
||||||
- NSDataAES (0.2.2)
|
- NSDataAES (0.2.2)
|
||||||
- NSDate_Utils (1.0.3)
|
- NSDate_Utils (1.0.5)
|
||||||
- NSString-Helper (1.0.5)
|
- NSString-Helper (1.0.5)
|
||||||
- nv-ios-http-status (0.0.1)
|
- nv-ios-http-status (0.0.1)
|
||||||
- PEAR-FileManager-iOS (1.3.1)
|
- PEAR-FileManager-iOS (1.3.1)
|
||||||
- PNObject (1.1.1):
|
- PNObject (1.2.1):
|
||||||
- AFNetworking
|
- AFNetworking
|
||||||
- CodFis-Helper
|
- CodFis-Helper
|
||||||
- DDDKeychainWrapper
|
- DDDKeychainWrapper
|
||||||
@ -80,11 +80,11 @@ SPEC CHECKSUMS:
|
|||||||
FBSDKLoginKit: 6773073e970b2b15fb12e451ce7f11da0532b880
|
FBSDKLoginKit: 6773073e970b2b15fb12e451ce7f11da0532b880
|
||||||
FBSDKShareKit: 0b8d6cc3f103c75297eb3c62caec284a2ccf1b9e
|
FBSDKShareKit: 0b8d6cc3f103c75297eb3c62caec284a2ccf1b9e
|
||||||
NSDataAES: 967ea3337476a80e9838a533c25d570a06855ed0
|
NSDataAES: 967ea3337476a80e9838a533c25d570a06855ed0
|
||||||
NSDate_Utils: 2fb4071323341507c610821bc99b98ef8c46d4ac
|
NSDate_Utils: b0ab72ccec6df25297766bd64b0cd0c124521a45
|
||||||
NSString-Helper: 459e1b6a62b3bf7db10f01b0d102548608e945c4
|
NSString-Helper: 459e1b6a62b3bf7db10f01b0d102548608e945c4
|
||||||
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
|
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
|
||||||
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
|
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
|
||||||
PNObject: f38657e6b3e643f397da970c9e454bd2991b5b94
|
PNObject: 6a528830b3769a9675bcfa90bd9f09cfa1cef9f2
|
||||||
PureLayout: 4d550abe49a94f24c2808b9b95db9131685fe4cd
|
PureLayout: 4d550abe49a94f24c2808b9b95db9131685fe4cd
|
||||||
RZDataBinding: 6981e90ddaae2f5e02028323b1043f8c31013109
|
RZDataBinding: 6981e90ddaae2f5e02028323b1043f8c31013109
|
||||||
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
|
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
|
||||||
|
|||||||
@ -42,14 +42,23 @@ static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeIT_shashSeparated
|
|||||||
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeEN = @"MM-dd-yyyy HH:mm:ss";
|
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeEN = @"MM-dd-yyyy HH:mm:ss";
|
||||||
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeEN_shashSeparated = @"MM/dd/yyyy HH:mm:ss";
|
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeEN_shashSeparated = @"MM/dd/yyyy HH:mm:ss";
|
||||||
|
|
||||||
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZone = @"yyyy-MM-dd'T'HH:mm:ss'Z'";
|
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZone_T_Separator = @"yyyy-MM-dd'T'HH:mm:ss ZZZ";
|
||||||
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZone_shashSeparated = @"yyyy/MM/dd'T'HH:mm:ss'Z'";
|
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZone_T_Separator_shashSeparated = @"yyyy/MM/dd'T'HH:mm:ss ZZZ";
|
||||||
|
|
||||||
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneEN = @"MM-dd-yyyy'T'HH:mm:ss'Z'";
|
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneEN_T_Separator = @"MM-dd-yyyy'T'HH:mm:ss ZZZ";
|
||||||
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneEN_shashSeparated = @"MM/dd/yyyy'T'HH:mm:ss'Z'";
|
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneENAndTSeparator_shashSeparated = @"MM/dd/yyyy'T'HH:mm:ss ZZZ";
|
||||||
|
|
||||||
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneIT = @"dd-MM-yyyy'T'HH:mm:ss'Z'";
|
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneIT_T_Separator = @"dd-MM-yyyy'T'HH:mm:ss ZZZ";
|
||||||
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneIT_shashSeparated = @"dd/MM/yyyy'T'HH:mm:ss'Z'";
|
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneIT_T_Separator_shashSeparated = @"dd/MM/yyyy'T'HH:mm:ss ZZZ";
|
||||||
|
|
||||||
|
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZone = @"yyyy-MM-dd HH:mm:ss ZZZ";
|
||||||
|
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZone_shashSeparated = @"yyyy/MM/dd HH:mm:ss ZZZ";
|
||||||
|
|
||||||
|
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneEN = @"MM-dd-yyyy HH:mm:ss ZZZ";
|
||||||
|
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneEN_shashSeparated = @"MM/dd/yyyy HH:mm:ss ZZZ";
|
||||||
|
|
||||||
|
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneIT = @"dd-MM-yyyy HH:mm:ss ZZZ";
|
||||||
|
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneIT_shashSeparated = @"dd/MM/yyyy HH:mm:ss ZZZ";
|
||||||
|
|
||||||
@interface NSDate (NSDate_Util)
|
@interface NSDate (NSDate_Util)
|
||||||
|
|
||||||
@ -82,6 +91,9 @@ static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneIT_shashSeparat
|
|||||||
|
|
||||||
+ (NSString * _Nonnull) getUniversalHourFromDateString:(NSString * _Nonnull) string formatterString:(NSString * _Nonnull) formatterString andUppercaseString:(BOOL) uppercaseString;
|
+ (NSString * _Nonnull) getUniversalHourFromDateString:(NSString * _Nonnull) string formatterString:(NSString * _Nonnull) formatterString andUppercaseString:(BOOL) uppercaseString;
|
||||||
|
|
||||||
|
+ (NSTimeInterval) timeIntervalFromMinutes:(NSUInteger) minutes;
|
||||||
|
+ (NSTimeInterval) timeIntervalFromHours:(NSUInteger) minutes;
|
||||||
|
|
||||||
- (NSDate * _Nonnull) dateToNearestMinutes:(NSInteger)minutes;
|
- (NSDate * _Nonnull) dateToNearestMinutes:(NSInteger)minutes;
|
||||||
|
|
||||||
- (NSDate * _Nonnull) dateByAddingMinutes:(NSInteger) dMinutes;
|
- (NSDate * _Nonnull) dateByAddingMinutes:(NSInteger) dMinutes;
|
||||||
|
|||||||
@ -194,7 +194,10 @@ static NSDateFormatter *_displayFormatter = nil;
|
|||||||
kNSDateHelperFormatSQLDateWithTimeEN_shashSeparated,kNSDateHelperFormatSQLDateWithTimeZone,
|
kNSDateHelperFormatSQLDateWithTimeEN_shashSeparated,kNSDateHelperFormatSQLDateWithTimeZone,
|
||||||
kNSDateHelperFormatSQLDateWithTimeZone_shashSeparated,kNSDateHelperFormatSQLDateWithTimeZoneEN,
|
kNSDateHelperFormatSQLDateWithTimeZone_shashSeparated,kNSDateHelperFormatSQLDateWithTimeZoneEN,
|
||||||
kNSDateHelperFormatSQLDateWithTimeZoneEN_shashSeparated,kNSDateHelperFormatSQLDateWithTimeZoneIT,
|
kNSDateHelperFormatSQLDateWithTimeZoneEN_shashSeparated,kNSDateHelperFormatSQLDateWithTimeZoneIT,
|
||||||
kNSDateHelperFormatSQLDateWithTimeZoneIT_shashSeparated, nil];
|
kNSDateHelperFormatSQLDateWithTimeZoneIT_shashSeparated,kNSDateHelperFormatSQLDateWithTimeZone_T_Separator,
|
||||||
|
kNSDateHelperFormatSQLDateWithTimeZone_T_Separator_shashSeparated,kNSDateHelperFormatSQLDateWithTimeZoneEN_T_Separator,
|
||||||
|
kNSDateHelperFormatSQLDateWithTimeZoneENAndTSeparator_shashSeparated, kNSDateHelperFormatSQLDateWithTimeZoneIT_T_Separator,
|
||||||
|
kNSDateHelperFormatSQLDateWithTimeZoneIT_T_Separator_shashSeparated, nil];
|
||||||
|
|
||||||
|
|
||||||
for (NSString *dateFormat in dateFormatsArray) {
|
for (NSString *dateFormat in dateFormatsArray) {
|
||||||
@ -516,6 +519,19 @@ static NSDateFormatter *_displayFormatter = nil;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
+ (NSTimeInterval) timeIntervalFromMinutes:(NSUInteger) minutes {
|
||||||
|
|
||||||
|
NSTimeInterval seconds = minutes /60;
|
||||||
|
|
||||||
|
return seconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
+ (NSTimeInterval) timeIntervalFromHours:(NSUInteger) hours {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
- (NSDate *) dateAtStartOfDay
|
- (NSDate *) dateAtStartOfDay
|
||||||
{
|
{
|
||||||
NSDateComponents *components = [CURRENT_CALENDAR components:DATE_COMPONENTS fromDate:self];
|
NSDateComponents *components = [CURRENT_CALENDAR components:DATE_COMPONENTS fromDate:self];
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = 'PNObject'
|
s.name = 'PNObject'
|
||||||
s.version = '1.2.0'
|
s.version = '1.2.1'
|
||||||
s.summary = 'PNObject is a simple replica of the more complex ParseObject'
|
s.summary = 'PNObject is a simple replica of the more complex ParseObject'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -46,6 +46,18 @@ typedef NS_ENUM(NSInteger, PNInstallationStatus) {
|
|||||||
|
|
||||||
- (void) setUpdated;
|
- (void) setUpdated;
|
||||||
|
|
||||||
|
- (void) registerDeviceWithBlockProgress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||||
|
Success:(nullable void (^)(BOOL response))success
|
||||||
|
failure:(nullable void (^)(NSError * _Nonnull error))failure;
|
||||||
|
|
||||||
|
- (void) updateDeviceWithBlockProgress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||||
|
Success:(nullable void (^)(BOOL response))success
|
||||||
|
failure:(nullable void (^)(NSError * _Nonnull error))failure;
|
||||||
|
|
||||||
|
- (void) removeDeviceWithBlockProgress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||||
|
Success:(nullable void (^)(BOOL response))success
|
||||||
|
failure:(nullable void (^)(NSError * _Nonnull error))failure;
|
||||||
|
|
||||||
///--------------------------------------
|
///--------------------------------------
|
||||||
#pragma mark - PNInstallation Properties
|
#pragma mark - PNInstallation Properties
|
||||||
///--------------------------------------
|
///--------------------------------------
|
||||||
|
|||||||
@ -9,6 +9,8 @@
|
|||||||
#import "PNInstallation.h"
|
#import "PNInstallation.h"
|
||||||
#import "DJLocalization.h"
|
#import "DJLocalization.h"
|
||||||
#import "PNObjectConfig.h"
|
#import "PNObjectConfig.h"
|
||||||
|
#import "PNObject+PNObjectConnection.h"
|
||||||
|
#import "NSDate+NSDate_Util.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -172,12 +174,6 @@ static bool isFirstAccess = YES;
|
|||||||
|
|
||||||
if (self) {
|
if (self) {
|
||||||
|
|
||||||
/*[super setValue:@"iOS" forKey:VariableName(deviceType)];
|
|
||||||
[super setValue:[[UIDevice currentDevice] model] forKey:VariableName(deviceModel)];
|
|
||||||
[super setValue:[[UIDevice currentDevice] systemVersion] forKey:VariableName(osVersion)];
|
|
||||||
[self setValue:[[UIDevice currentDevice] name] forKey:VariableName(deviceName)];
|
|
||||||
[self setValue:[[DJLocalizationSystem shared] language] forKey:VariableName(localeIdentifier)];
|
|
||||||
*/
|
|
||||||
_installationStatus = PNInstallationStatusNone;
|
_installationStatus = PNInstallationStatusNone;
|
||||||
_deviceType = @"iOS";
|
_deviceType = @"iOS";
|
||||||
_deviceModel = [[UIDevice currentDevice] model];
|
_deviceModel = [[UIDevice currentDevice] model];
|
||||||
@ -190,6 +186,135 @@ static bool isFirstAccess = YES;
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) registerDeviceWithBlockProgress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||||
|
Success:(nullable void (^)(BOOL response))success
|
||||||
|
failure:(nullable void (^)(NSError * _Nonnull error))failure {
|
||||||
|
[self registerDeviceForced:NO WithBlockProgress:uploadProgress Success:success failure:failure];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) registerDeviceForced:(BOOL) forced
|
||||||
|
WithBlockProgress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||||
|
Success:(nullable void (^)(BOOL response))success
|
||||||
|
failure:(nullable void (^)(NSError * _Nonnull error))failure {
|
||||||
|
if (self.deviceToken && (forced || !self.registeredAt || [self.registeredAt isEarlierThanDate:[[NSDate date] dateByAddingHours:3]])) {
|
||||||
|
|
||||||
|
[[self class] POSTWithEndpointAction:@"device/register" parameters:[self registrationDeviceFormObject]
|
||||||
|
progress:uploadProgress
|
||||||
|
success:^(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject) {
|
||||||
|
[self setRegistered];
|
||||||
|
[self saveLocally];
|
||||||
|
if(success){
|
||||||
|
success(YES);
|
||||||
|
}
|
||||||
|
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||||
|
[self setRegistered];
|
||||||
|
[self saveLocally];
|
||||||
|
if (failure) {
|
||||||
|
failure(error);
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (success) {
|
||||||
|
success(YES);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSDictionary * _Nonnull) registrationDeviceFormObject {
|
||||||
|
|
||||||
|
NSMutableDictionary *registrationDeviceDictionary = [[NSMutableDictionary alloc] initWithDictionary:[self JSONFormObject]];
|
||||||
|
|
||||||
|
[registrationDeviceDictionary setObject:[self deviceType] forKey:@"platform"];
|
||||||
|
|
||||||
|
return registrationDeviceDictionary;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) updateDeviceWithBlockProgress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||||
|
Success:(nullable void (^)(BOOL response))success
|
||||||
|
failure:(nullable void (^)(NSError * _Nonnull error))failure {
|
||||||
|
if (self.deviceToken && self.oldDeviceToken && (!self.updatedAt || [self.updatedAt isEarlierThanDate:[[NSDate date] dateByAddingHours:3]])) {
|
||||||
|
|
||||||
|
[[self class] POSTWithEndpointAction:@"device/update" parameters:[self updateDeviceFormObject]
|
||||||
|
progress:uploadProgress
|
||||||
|
success:^(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject) {
|
||||||
|
[self setUpdated];
|
||||||
|
[self saveLocally];
|
||||||
|
if(success){
|
||||||
|
success(YES);
|
||||||
|
}
|
||||||
|
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||||
|
if (failure) {
|
||||||
|
failure(error);
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (success) {
|
||||||
|
success(YES);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSDictionary * _Nonnull) updateDeviceFormObject {
|
||||||
|
|
||||||
|
NSMutableDictionary *updateDeviceDictionary = [[NSMutableDictionary alloc] initWithDictionary:[self JSONFormObject]];
|
||||||
|
|
||||||
|
if ([updateDeviceDictionary objectForKey:VariableName(self.deviceToken)]) {
|
||||||
|
[updateDeviceDictionary setObject:[updateDeviceDictionary objectForKey:VariableName(self.deviceToken)] forKey:@"newDeviceToken"];
|
||||||
|
|
||||||
|
}
|
||||||
|
if ([updateDeviceDictionary objectForKey:VariableName(self.oldDeviceToken)]) {
|
||||||
|
[updateDeviceDictionary setObject:[updateDeviceDictionary objectForKey:VariableName(self.oldDeviceToken)] forKey:VariableName(self.deviceToken)];
|
||||||
|
[updateDeviceDictionary removeObjectForKey:VariableName(self.oldDeviceToken)];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return updateDeviceDictionary;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) removeDeviceWithBlockProgress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||||
|
Success:(nullable void (^)(BOOL response))success
|
||||||
|
failure:(nullable void (^)(NSError * _Nonnull error))failure {
|
||||||
|
|
||||||
|
if (self.deviceToken) {
|
||||||
|
|
||||||
|
[[self class] POSTWithEndpointAction:@"device/remove-user" parameters:[self removeDeviceFormObject]
|
||||||
|
progress:uploadProgress
|
||||||
|
success:^(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject) {
|
||||||
|
NSLog(@"response %@",responseObject);
|
||||||
|
if(success){
|
||||||
|
success(YES);
|
||||||
|
}
|
||||||
|
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||||
|
NSLog(@"error : %@",error);
|
||||||
|
if (failure) {
|
||||||
|
failure(error);
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if (success) {
|
||||||
|
success(YES);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSDictionary * _Nonnull) removeDeviceFormObject {
|
||||||
|
|
||||||
|
NSMutableDictionary *updateDeviceDictionary = [[NSMutableDictionary alloc] init];
|
||||||
|
|
||||||
|
[updateDeviceDictionary setObject:self.deviceToken forKey:VariableName(self.deviceToken)];
|
||||||
|
|
||||||
|
return updateDeviceDictionary;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user