no message

This commit is contained in:
Giuseppe Nucifora 2016-03-17 10:38:52 +01:00
parent ce70ebf7fc
commit 22499a85d3
12 changed files with 180 additions and 164 deletions

View File

@ -139,9 +139,7 @@
NSLog(@"response : %@",responseObject);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[responseObject reloadFormServer];
});
NSLog(@"%@",[User currentUser]);
} failure:^(NSError * _Nonnull error) {
NSLog(@"response : %@",error);
}];

View File

@ -26,11 +26,11 @@ PODS:
- Expecta+Snapshots (2.0.0):
- Expecta (~> 1.0)
- FBSnapshotTestCase/Core (~> 2.0.3)
- FBSDKCoreKit (4.10.0):
- FBSDKCoreKit (4.10.1):
- Bolts (~> 1.5)
- FBSDKLoginKit (4.10.0):
- FBSDKLoginKit (4.10.1):
- FBSDKCoreKit
- FBSDKShareKit (4.10.0):
- FBSDKShareKit (4.10.1):
- FBSDKCoreKit
- FBSnapshotTestCase (2.0.7):
- FBSnapshotTestCase/SwiftSupport (= 2.0.7)
@ -44,7 +44,7 @@ PODS:
- CocoaSecurity (~> 1.2.2)
- nv-ios-http-status (0.0.1)
- PEAR-FileManager-iOS (1.3.1)
- PNObject (0.4.5):
- PNObject (0.4.6):
- AFNetworking
- CodFis-Helper
- FBSDKCoreKit
@ -93,9 +93,9 @@ SPEC CHECKSUMS:
CodFis-Helper: 28be4c74d7202542459d72354f59b1215871de87
Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe
Expecta+Snapshots: 29b38dd695bc72a0ed2bea833937d78df41943ba
FBSDKCoreKit: 13bec8373fb3af94d44daf2aa1e0958687897fbd
FBSDKLoginKit: d3d4a2e9d31954deb00bfea964167a05ca1ea976
FBSDKShareKit: 54587b4624706ace1e810cf83412a918141f807a
FBSDKCoreKit: d2aaed5e9ab7d8d6301c533376a1fbff1cf3deb5
FBSDKLoginKit: 699ff169080e3072de4b9b0faca90bf23dc36deb
FBSDKShareKit: 2fd887cce0056bdda91f99b2021d724a4fed8e88
FBSnapshotTestCase: 7e85180d0d141a0cf472352edda7e80d7eaeb547
NACrypto: ce3900f1775f1b0cc27ce7c4953b94c598a74149
NSDate_Utils: 68669d2c81f310ee13026c791f4f0ed227b94c65
@ -103,7 +103,7 @@ SPEC CHECKSUMS:
NSUserDefaults-AESEncryptor: da02cfef056f1e18ebe2748767915f08b274c9c5
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
PNObject: e3104b38e9aa668a992de191cb4630440cce5cf3
PNObject: 20b785cb5cbf88322f2c268a5ba80ca3337dec51
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
StrongestPasswordValidator: 921e42615bdf353513c6f925bffd4fc29865dbd7

View File

@ -41,5 +41,5 @@
#import <FBSDKCoreKit/FBSDKProfilePictureView.h>
#endif
#define FBSDK_VERSION_STRING @"4.10.0"
#define FBSDK_VERSION_STRING @"4.10.1"
#define FBSDK_TARGET_PLATFORM_VERSION @"v2.5"

View File

@ -41,206 +41,226 @@ static const u_int FB_GROUP1_RECHECK_DURATION = 30 * 60; // seconds
static const u_int FB_GIGABYTE = 1024 * 1024 * 1024; // bytes
@implementation FBSDKAppEventsDeviceInfo
{
// Ephemeral data, may change during the lifetime of an app. We collect them in different
// 'group' frequencies - group1 may gets collected once every 30 minutes.
// Ephemeral data, may change during the lifetime of an app. We collect them in different
// 'group' frequencies - group1 may gets collected once every 30 minutes.
// group1
NSString *_carrierName;
NSString *_timeZoneAbbrev;
unsigned long long _remainingDiskSpaceGB;
NSString *_timeZoneName;
// group1
NSString *_carrierName;
NSString *_timeZoneAbbrev;
unsigned long long _remainingDiskSpaceGB;
// Persistent data, but we maintain it to make rebuilding the device info as fast as possible.
NSString *_bundleIdentifier;
NSString *_longVersion;
NSString *_shortVersion;
NSString *_sysVersion;
NSString *_machine;
NSString *_language;
unsigned long long _totalDiskSpaceGB;
unsigned long long _coreCount;
CGFloat _width;
CGFloat _height;
CGFloat _density;
// Persistent data, but we maintain it to make rebuilding the device info as fast as possible.
NSString *_bundleIdentifier;
NSString *_longVersion;
NSString *_shortVersion;
NSString *_sysVersion;
NSString *_machine;
NSString *_language;
unsigned long long _totalDiskSpaceGB;
unsigned long long _coreCount;
CGFloat _width;
CGFloat _height;
CGFloat _density;
// Other state
long _lastGroup1CheckTime;
BOOL _isEncodingDirty = YES;
NSString *_encodedDeviceInfo;
static FBSDKAppEventsDeviceInfo *g_singleton;
// Other state
long _lastGroup1CheckTime;
BOOL _isEncodingDirty;
NSString *_encodedDeviceInfo;
}
#pragma mark - Public Methods
+ (void)extendDictionaryWithDeviceInfo:(NSMutableDictionary *)dictionary
{
dictionary[@"extinfo"] = [g_singleton encodedDeviceInfo];
dictionary[@"extinfo"] = [[self sharedDeviceInfo] encodedDeviceInfo];
}
#pragma mark - Internal Methods
+ (void)initialize
{
if (self == [FBSDKAppEventsDeviceInfo class]) {
g_singleton = [[FBSDKAppEventsDeviceInfo alloc] init];
[g_singleton _collectPersistentData];
}
if (self == [FBSDKAppEventsDeviceInfo class]) {
[[self sharedDeviceInfo] _collectPersistentData];
}
}
+ (instancetype)sharedDeviceInfo
{
static FBSDKAppEventsDeviceInfo *_sharedDeviceInfo = nil;
if (_sharedDeviceInfo == nil) {
_sharedDeviceInfo = [[FBSDKAppEventsDeviceInfo alloc] init];
}
return _sharedDeviceInfo;
}
- (instancetype)init
{
if ((self = [super init])) {
_isEncodingDirty = YES;
}
return self;
}
- (NSString *)encodedDeviceInfo
{
@synchronized (self) {
@synchronized (self) {
BOOL isGroup1Expired = [self _isGroup1Expired];
BOOL isEncodingExpired = isGroup1Expired; // Can || other groups in if we add them
BOOL isGroup1Expired = [self _isGroup1Expired];
BOOL isEncodingExpired = isGroup1Expired; // Can || other groups in if we add them
// As long as group1 hasn't expired, we can just return the last generated value
if (_encodedDeviceInfo && !isEncodingExpired) {
return _encodedDeviceInfo;
}
if (isGroup1Expired) {
[self _collectGroup1Data];
}
if (_isEncodingDirty) {
self.encodedDeviceInfo = [self _generateEncoding];
_isEncodingDirty = NO;
}
return _encodedDeviceInfo;
// As long as group1 hasn't expired, we can just return the last generated value
if (_encodedDeviceInfo && !isEncodingExpired) {
return _encodedDeviceInfo;
}
if (isGroup1Expired) {
[self _collectGroup1Data];
}
if (_isEncodingDirty) {
self.encodedDeviceInfo = [self _generateEncoding];
_isEncodingDirty = NO;
}
return _encodedDeviceInfo;
}
}
- (void)setEncodedDeviceInfo:(NSString *)encodedDeviceInfo
{
@synchronized (self) {
if (![_encodedDeviceInfo isEqualToString:encodedDeviceInfo]) {
_encodedDeviceInfo = [encodedDeviceInfo copy];
}
@synchronized (self) {
if (![_encodedDeviceInfo isEqualToString:encodedDeviceInfo]) {
_encodedDeviceInfo = [encodedDeviceInfo copy];
}
}
}
// This data need only be collected once.
- (void)_collectPersistentData
{
// Bundle stuff
NSBundle *mainBundle = [NSBundle mainBundle];
_bundleIdentifier = mainBundle.bundleIdentifier;
_longVersion = [mainBundle objectForInfoDictionaryKey:@"CFBundleVersion"];
_shortVersion = [mainBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
// Bundle stuff
NSBundle *mainBundle = [NSBundle mainBundle];
_bundleIdentifier = mainBundle.bundleIdentifier;
_longVersion = [mainBundle objectForInfoDictionaryKey:@"CFBundleVersion"];
_shortVersion = [mainBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
// Locale stuff
_language = [[NSLocale currentLocale] localeIdentifier];
// Locale stuff
_language = [[NSLocale currentLocale] localeIdentifier];
// Device stuff
UIDevice *device = [UIDevice currentDevice];
_sysVersion = device.systemVersion;
_coreCount = [FBSDKAppEventsDeviceInfo _coreCount];
// Device stuff
UIDevice *device = [UIDevice currentDevice];
_sysVersion = device.systemVersion;
_coreCount = [FBSDKAppEventsDeviceInfo _coreCount];
UIScreen *sc = [UIScreen mainScreen];
CGRect sr = sc.bounds;
_width = sr.size.width;
_height = sr.size.height;
_density = sc.scale;
UIScreen *sc = [UIScreen mainScreen];
CGRect sr = sc.bounds;
_width = sr.size.width;
_height = sr.size.height;
_density = sc.scale;
struct utsname systemInfo;
uname(&systemInfo);
_machine = @(systemInfo.machine);
struct utsname systemInfo;
uname(&systemInfo);
_machine = @(systemInfo.machine);
// Disk space stuff
float totalDiskSpace = [[FBSDKAppEventsDeviceInfo _getTotalDiskSpace] floatValue];
_totalDiskSpaceGB = (unsigned long long)round(totalDiskSpace / FB_GIGABYTE);
// Disk space stuff
float totalDiskSpace = [[FBSDKAppEventsDeviceInfo _getTotalDiskSpace] floatValue];
_totalDiskSpaceGB = (unsigned long long)round(totalDiskSpace / FB_GIGABYTE);
}
- (BOOL)_isGroup1Expired
{
return ([FBSDKAppEventsUtility unixTimeNow] - _lastGroup1CheckTime) > FB_GROUP1_RECHECK_DURATION;
return ([FBSDKAppEventsUtility unixTimeNow] - _lastGroup1CheckTime) > FB_GROUP1_RECHECK_DURATION;
}
// This data is collected only once every GROUP1_RECHECK_DURATION.
- (void)_collectGroup1Data
{
// Carrier
NSString *newCarrierName = [FBSDKAppEventsDeviceInfo _getCarrier];
if (![newCarrierName isEqualToString:_carrierName]) {
_carrierName = newCarrierName;
_isEncodingDirty = YES;
}
// Carrier
NSString *newCarrierName = [FBSDKAppEventsDeviceInfo _getCarrier];
if (![newCarrierName isEqualToString:_carrierName]) {
_carrierName = newCarrierName;
_isEncodingDirty = YES;
}
// Time zone
NSString *newTimeZoneAbbrev = [[NSTimeZone systemTimeZone] abbreviation];
if (![newTimeZoneAbbrev isEqualToString:_timeZoneAbbrev]) {
_timeZoneAbbrev = newTimeZoneAbbrev;
_isEncodingDirty = YES;
}
// Time zone
NSTimeZone *timeZone = [NSTimeZone systemTimeZone];
NSString *timeZoneName = timeZone.name;
if (![timeZoneName isEqualToString:_timeZoneName]) {
_timeZoneName = timeZoneName;
_timeZoneAbbrev = timeZone.abbreviation;
_isEncodingDirty = YES;
}
// Remaining disk space
float remainingDiskSpace = [[FBSDKAppEventsDeviceInfo _getRemainingDiskSpace] floatValue];
unsigned long long newRemainingDiskSpaceGB = (unsigned long long)round(remainingDiskSpace / FB_GIGABYTE);
if (_remainingDiskSpaceGB != newRemainingDiskSpaceGB) {
_remainingDiskSpaceGB = newRemainingDiskSpaceGB;
_isEncodingDirty = YES;
}
// Remaining disk space
float remainingDiskSpace = [[FBSDKAppEventsDeviceInfo _getRemainingDiskSpace] floatValue];
unsigned long long newRemainingDiskSpaceGB = (unsigned long long)round(remainingDiskSpace / FB_GIGABYTE);
if (_remainingDiskSpaceGB != newRemainingDiskSpaceGB) {
_remainingDiskSpaceGB = newRemainingDiskSpaceGB;
_isEncodingDirty = YES;
}
_lastGroup1CheckTime = [FBSDKAppEventsUtility unixTimeNow];
_lastGroup1CheckTime = [FBSDKAppEventsUtility unixTimeNow];
}
- (NSString *)_generateEncoding
{
// Keep a bit of precision on density as it's the most likely to become non-integer.
NSString *densityString = _density ? [NSString stringWithFormat:@"%.02f", _density] : @"";
// Keep a bit of precision on density as it's the most likely to become non-integer.
NSString *densityString = _density ? [NSString stringWithFormat:@"%.02f", _density] : @"";
NSArray *arr = @[
@"i2", // version - starts with 'i' for iOS, we'll use 'a' for Android
_bundleIdentifier ?: @"",
_longVersion ?: @"",
_shortVersion ?: @"",
_sysVersion ?: @"",
_machine ?: @"",
_language ?: @"",
_timeZoneAbbrev ?: @"",
_carrierName ?: @"",
_width ? @((unsigned long)_width) : @"",
_height ? @((unsigned long)_height) : @"",
densityString,
@(_coreCount) ?: @"",
@(_totalDiskSpaceGB) ?: @"",
@(_remainingDiskSpaceGB) ?: @"",
];
NSArray *arr = @[
@"i2", // version - starts with 'i' for iOS, we'll use 'a' for Android
_bundleIdentifier ?: @"",
_longVersion ?: @"",
_shortVersion ?: @"",
_sysVersion ?: @"",
_machine ?: @"",
_language ?: @"",
_timeZoneAbbrev ?: @"",
_carrierName ?: @"",
_width ? @((unsigned long)_width) : @"",
_height ? @((unsigned long)_height) : @"",
densityString,
@(_coreCount) ?: @"",
@(_totalDiskSpaceGB) ?: @"",
@(_remainingDiskSpaceGB) ?: @"",
_timeZoneName ?: @""
];
return [FBSDKInternalUtility JSONStringForObject:arr error:NULL invalidObjectHandler:NULL];
return [FBSDKInternalUtility JSONStringForObject:arr error:NULL invalidObjectHandler:NULL];
}
#pragma mark - Helper Methods
+ (NSNumber *)_getTotalDiskSpace
{
NSDictionary *attrs = [[[NSFileManager alloc] init] attributesOfFileSystemForPath:NSHomeDirectory()
error:nil];
return [attrs objectForKey:NSFileSystemSize];
NSDictionary *attrs = [[[NSFileManager alloc] init] attributesOfFileSystemForPath:NSHomeDirectory()
error:nil];
return [attrs objectForKey:NSFileSystemSize];
}
+ (NSNumber *)_getRemainingDiskSpace
{
NSDictionary *attrs = [[[NSFileManager alloc] init] attributesOfFileSystemForPath:NSHomeDirectory()
error:nil];
return [attrs objectForKey:NSFileSystemFreeSize];
NSDictionary *attrs = [[[NSFileManager alloc] init] attributesOfFileSystemForPath:NSHomeDirectory()
error:nil];
return [attrs objectForKey:NSFileSystemFreeSize];
}
+ (uint)_coreCount
{
return [FBSDKAppEventsDeviceInfo _readSysCtlUInt:CTL_HW type:HW_AVAILCPU];
return [FBSDKAppEventsDeviceInfo _readSysCtlUInt:CTL_HW type:HW_AVAILCPU];
}
+ (uint)_readSysCtlUInt:(int)ctl type:(int)type
{
int mib[2] = {ctl, type};
uint value;
size_t size = sizeof value;
if (0 != sysctl(mib, FB_ARRAY_COUNT(mib), &value, &size, NULL, 0)) {
return 0;
}
return value;
int mib[2] = {ctl, type};
uint value;
size_t size = sizeof value;
if (0 != sysctl(mib, FB_ARRAY_COUNT(mib), &value, &size, NULL, 0)) {
return 0;
}
return value;
}
+ (NSString *)_getCarrier
@ -248,10 +268,10 @@ static FBSDKAppEventsDeviceInfo *g_singleton;
#if TARGET_OS_TV
return @"NoCarrier";
#else
// Dynamically load class for this so calling app doesn't need to link framework in.
CTTelephonyNetworkInfo *networkInfo = [[fbsdkdfl_CTTelephonyNetworkInfoClass() alloc] init];
CTCarrier *carrier = [networkInfo subscriberCellularProvider];
return [carrier carrierName] ?: @"NoCarrier";
// Dynamically load class for this so calling app doesn't need to link framework in.
CTTelephonyNetworkInfo *networkInfo = [[fbsdkdfl_CTTelephonyNetworkInfoClass() alloc] init];
CTCarrier *carrier = [networkInfo subscriberCellularProvider];
return [carrier carrierName] ?: @"NoCarrier";
#endif
}

View File

@ -1,6 +1,6 @@
{
"name": "PNObject",
"version": "0.4.5",
"version": "0.4.6",
"summary": "PNObject is a simple replica of the more complex ParseObject",
"homepage": "https://github.com/giuseppenucifora/PNObject",
"license": "MIT",
@ -9,7 +9,7 @@
},
"source": {
"git": "https://github.com/giuseppenucifora/PNObject.git",
"tag": "0.4.5"
"tag": "0.4.6"
},
"platforms": {
"ios": "8.0"

View File

@ -26,11 +26,11 @@ PODS:
- Expecta+Snapshots (2.0.0):
- Expecta (~> 1.0)
- FBSnapshotTestCase/Core (~> 2.0.3)
- FBSDKCoreKit (4.10.0):
- FBSDKCoreKit (4.10.1):
- Bolts (~> 1.5)
- FBSDKLoginKit (4.10.0):
- FBSDKLoginKit (4.10.1):
- FBSDKCoreKit
- FBSDKShareKit (4.10.0):
- FBSDKShareKit (4.10.1):
- FBSDKCoreKit
- FBSnapshotTestCase (2.0.7):
- FBSnapshotTestCase/SwiftSupport (= 2.0.7)
@ -44,7 +44,7 @@ PODS:
- CocoaSecurity (~> 1.2.2)
- nv-ios-http-status (0.0.1)
- PEAR-FileManager-iOS (1.3.1)
- PNObject (0.4.5):
- PNObject (0.4.6):
- AFNetworking
- CodFis-Helper
- FBSDKCoreKit
@ -93,9 +93,9 @@ SPEC CHECKSUMS:
CodFis-Helper: 28be4c74d7202542459d72354f59b1215871de87
Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe
Expecta+Snapshots: 29b38dd695bc72a0ed2bea833937d78df41943ba
FBSDKCoreKit: 13bec8373fb3af94d44daf2aa1e0958687897fbd
FBSDKLoginKit: d3d4a2e9d31954deb00bfea964167a05ca1ea976
FBSDKShareKit: 54587b4624706ace1e810cf83412a918141f807a
FBSDKCoreKit: d2aaed5e9ab7d8d6301c533376a1fbff1cf3deb5
FBSDKLoginKit: 699ff169080e3072de4b9b0faca90bf23dc36deb
FBSDKShareKit: 2fd887cce0056bdda91f99b2021d724a4fed8e88
FBSnapshotTestCase: 7e85180d0d141a0cf472352edda7e80d7eaeb547
NACrypto: ce3900f1775f1b0cc27ce7c4953b94c598a74149
NSDate_Utils: 68669d2c81f310ee13026c791f4f0ed227b94c65
@ -103,7 +103,7 @@ SPEC CHECKSUMS:
NSUserDefaults-AESEncryptor: da02cfef056f1e18ebe2748767915f08b274c9c5
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
PNObject: e3104b38e9aa668a992de191cb4630440cce5cf3
PNObject: 20b785cb5cbf88322f2c268a5ba80ca3337dec51
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
StrongestPasswordValidator: 921e42615bdf353513c6f925bffd4fc29865dbd7

View File

@ -14,7 +14,7 @@
buildForArchiving = "YES">
<BuildableReference
BuildableIdentifier = 'primary'
BlueprintIdentifier = 'EEAC74642D33DB6F05CFDAD2'
BlueprintIdentifier = '24B6537E15CF8A8F679D4558'
BlueprintName = 'PNObject'
ReferencedContainer = 'container:Pods.xcodeproj'
BuildableName = 'PNObject.framework'>

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>4.10.0</string>
<string>4.10.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>4.10.0</string>
<string>4.10.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>4.10.0</string>
<string>4.10.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.4.5</string>
<string>0.4.6</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -274,11 +274,7 @@ static bool isFirstAccess = YES;
[[PNObjectConfig sharedInstance] refreshTokenForUserWithEmail:email password:password withBlockSuccess:^(BOOL refreshSuccess) {
if (refreshSuccess) {
if ([[self class] currentUser]) {
[[[self class] currentUser] resetUser];
}
PNUser *user = [[self class] currentUser];
PNUser *user = [[self class] new];
PNObjcPassword *objectPassword = [PNObjcPassword new];
[objectPassword setPassword:password];
@ -290,6 +286,8 @@ static bool isFirstAccess = YES;
[user saveLocally];
[user reloadFormServer];
USER = user;
if (success) {
success(user);
}