- Fix Installation Date

This commit is contained in:
giuseppenuc committed 2017-01-16 14:41:36 +01:00
1 parent d6bc683799
commit d45c68f35b
11 files changed
+253 -24

No files matched your search

@@ -61,6 +61,7 @@
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>"; };
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>"; };
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>"; };
@@ -99,6 +100,7 @@
6003F581195388D10070C39A = {
isa = PBXGroup;
children = (
681A32481E2CFB7300DF98BF /* PNObject_Example.entitlements */,
60FF7A9C1954A5C5007DD14C /* Podspec Metadata */,
6003F593195388D20070C39A /* Example for PNObject */,
6003F5B5195388D20070C39A /* Tests */,
@@ -253,6 +255,11 @@
TargetAttributes = {
6003F589195388D20070C39A = {
DevelopmentTeam = 825G85A28E;
SystemCapabilities = {
com.apple.Push = {
enabled = 1;
};
};
};
6003F5AD195388D20070C39A = {
TestTargetID = 6003F589195388D20070C39A;
@@ -529,6 +536,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_ENTITLEMENTS = PNObject_Example.entitlements;
DEVELOPMENT_TEAM = 825G85A28E;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "PNObject/PNObject-Prefix.pch";
@@ -546,6 +554,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_ENTITLEMENTS = PNObject_Example.entitlements;
DEVELOPMENT_TEAM = 825G85A28E;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "PNObject/PNObject-Prefix.pch";
+47
View File
@@ -19,6 +19,7 @@
#import "UIDevice-Hardware.h"
#import <PNObject/PNInstallation.h>
#import <NSDate_Utils/NSDate+NSDate_Util.h>
@implementation PNObjAppDelegate
@@ -156,6 +157,52 @@
//[installation setUser:nil];
[self updateDeviceUser];
}
- (void) updateDeviceUser {
PNInstallation * installation = [PNInstallation currentInstallation];
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 {
+8
View 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>
+4 -4
View File
@@ -33,11 +33,11 @@ PODS:
- FBSDKShareKit (4.18.0):
- FBSDKCoreKit
- NSDataAES (0.2.2)
- NSDate_Utils (1.0.3)
- NSDate_Utils (1.0.5)
- NSString-Helper (1.0.5)
- nv-ios-http-status (0.0.1)
- PEAR-FileManager-iOS (1.3.1)
- PNObject (1.1.1):
- PNObject (1.1.5):
- AFNetworking
- CodFis-Helper
- DDDKeychainWrapper
@@ -80,11 +80,11 @@ SPEC CHECKSUMS:
FBSDKLoginKit: 6773073e970b2b15fb12e451ce7f11da0532b880
FBSDKShareKit: 0b8d6cc3f103c75297eb3c62caec284a2ccf1b9e
NSDataAES: 967ea3337476a80e9838a533c25d570a06855ed0
NSDate_Utils: 2fb4071323341507c610821bc99b98ef8c46d4ac
NSDate_Utils: b0ab72ccec6df25297766bd64b0cd0c124521a45
NSString-Helper: 459e1b6a62b3bf7db10f01b0d102548608e945c4
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
PNObject: f38657e6b3e643f397da970c9e454bd2991b5b94
PNObject: 38f5fa8f707f7c53579c81a2c425ad7c2d04cb78
PureLayout: 4d550abe49a94f24c2808b9b95db9131685fe4cd
RZDataBinding: 6981e90ddaae2f5e02028323b1043f8c31013109
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "PNObject",
"version": "1.1.1",
"version": "1.1.5",
"summary": "PNObject is a simple replica of the more complex ParseObject",
"homepage": "https://git.giuseppenucifora.com/giuseppenucifora/PNObject",
"license": {
@@ -12,7 +12,7 @@
},
"source": {
"git": "https://git.giuseppenucifora.com/giuseppenucifora/PNObject.git",
"tag": "1.1.1"
"tag": "1.1.5"
},
"platforms": {
"ios": "8.0"
+4 -4
View File
@@ -33,11 +33,11 @@ PODS:
- FBSDKShareKit (4.18.0):
- FBSDKCoreKit
- NSDataAES (0.2.2)
- NSDate_Utils (1.0.3)
- NSDate_Utils (1.0.5)
- NSString-Helper (1.0.5)
- nv-ios-http-status (0.0.1)
- PEAR-FileManager-iOS (1.3.1)
- PNObject (1.1.1):
- PNObject (1.1.5):
- AFNetworking
- CodFis-Helper
- DDDKeychainWrapper
@@ -80,11 +80,11 @@ SPEC CHECKSUMS:
FBSDKLoginKit: 6773073e970b2b15fb12e451ce7f11da0532b880
FBSDKShareKit: 0b8d6cc3f103c75297eb3c62caec284a2ccf1b9e
NSDataAES: 967ea3337476a80e9838a533c25d570a06855ed0
NSDate_Utils: 2fb4071323341507c610821bc99b98ef8c46d4ac
NSDate_Utils: b0ab72ccec6df25297766bd64b0cd0c124521a45
NSString-Helper: 459e1b6a62b3bf7db10f01b0d102548608e945c4
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
PNObject: f38657e6b3e643f397da970c9e454bd2991b5b94
PNObject: 38f5fa8f707f7c53579c81a2c425ad7c2d04cb78
PureLayout: 4d550abe49a94f24c2808b9b95db9131685fe4cd
RZDataBinding: 6981e90ddaae2f5e02028323b1043f8c31013109
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
+18 -6
View File
@@ -42,14 +42,23 @@ static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeIT_shashSeparated
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeEN = @"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_shashSeparated = @"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_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_shashSeparated = @"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 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_shashSeparated = @"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_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)
@@ -82,6 +91,9 @@ static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneIT_shashSeparat
+ (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) dateByAddingMinutes:(NSInteger) dMinutes;
+17 -1
View File
@@ -194,7 +194,10 @@ static NSDateFormatter *_displayFormatter = nil;
kNSDateHelperFormatSQLDateWithTimeEN_shashSeparated,kNSDateHelperFormatSQLDateWithTimeZone,
kNSDateHelperFormatSQLDateWithTimeZone_shashSeparated,kNSDateHelperFormatSQLDateWithTimeZoneEN,
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) {
@@ -516,6 +519,19 @@ static NSDateFormatter *_displayFormatter = nil;
}
+ (NSTimeInterval) timeIntervalFromMinutes:(NSUInteger) minutes {
NSTimeInterval seconds = minutes /60;
return seconds;
}
+ (NSTimeInterval) timeIntervalFromHours:(NSUInteger) hours {
}
- (NSDate *) dateAtStartOfDay
{
NSDateComponents *components = [CURRENT_CALENDAR components:DATE_COMPONENTS fromDate:self];