Localytics SDK update because of startup issue.
This commit is contained in:
parent
850978cbe3
commit
b1f0f70849
0
Localytics/LocalyticsDatabase.h
Normal file → Executable file
0
Localytics/LocalyticsDatabase.h
Normal file → Executable file
0
Localytics/LocalyticsDatabase.m
Normal file → Executable file
0
Localytics/LocalyticsDatabase.m
Normal file → Executable file
8
Localytics/LocalyticsSession.h
Normal file → Executable file
8
Localytics/LocalyticsSession.h
Normal file → Executable file
@ -154,10 +154,10 @@
|
|||||||
closed and the time of closing is recorded. When the app returns to the foreground, the session
|
closed and the time of closing is recorded. When the app returns to the foreground, the session
|
||||||
is resumed. If the time since closing is greater than BACKGROUND_SESSION_TIMEOUT, (15 seconds
|
is resumed. If the time since closing is greater than BACKGROUND_SESSION_TIMEOUT, (15 seconds
|
||||||
by default) a new session is created, and uploading is triggered. Otherwise, the previous session
|
by default) a new session is created, and uploading is triggered. Otherwise, the previous session
|
||||||
is reopened. It is possible to use the return value to determine whether or not a session was resumed.
|
is reopened.
|
||||||
This may be useful to some customers looking to do conditional instrumentation at the close of a session.
|
@return Returns whether the session was resumed or a new session was started. If the user has opted
|
||||||
It is perfectly reasonable to ignore the return value.
|
out of analytics then the return from this method is undefined.
|
||||||
@result YES if the sesion was resumed NO if it wasn't (suggesting a new session was created instead).*/
|
*/
|
||||||
- (BOOL)resume;
|
- (BOOL)resume;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
53
Localytics/LocalyticsSession.m
Normal file → Executable file
53
Localytics/LocalyticsSession.m
Normal file → Executable file
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#pragma mark Constants
|
#pragma mark Constants
|
||||||
#define PREFERENCES_KEY @"_localytics_install_id" // The randomly generated ID for each install of the app
|
#define PREFERENCES_KEY @"_localytics_install_id" // The randomly generated ID for each install of the app
|
||||||
#define CLIENT_VERSION @"iOS_2.12" // The version of this library
|
#define CLIENT_VERSION @"iOS_2.14" // The version of this library
|
||||||
#define LOCALYTICS_DIR @".localytics" // The directory in which the Localytics database is stored
|
#define LOCALYTICS_DIR @".localytics" // The directory in which the Localytics database is stored
|
||||||
#define IFT_ETHER 0x6 // Ethernet CSMACD
|
#define IFT_ETHER 0x6 // Ethernet CSMACD
|
||||||
#define PATH_TO_APT @"/private/var/lib/apt/"
|
#define PATH_TO_APT @"/private/var/lib/apt/"
|
||||||
@ -200,24 +200,14 @@ CLLocationCoordinate2D lastDeviceLocation = {0};
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (BOOL)resume {
|
- (BOOL)resume {
|
||||||
__block BOOL resumed = NO;
|
|
||||||
|
|
||||||
dispatch_sync(_queue,^{
|
|
||||||
@try {
|
|
||||||
// Do nothing if session is already open
|
// Do nothing if session is already open
|
||||||
if(self.isSessionOpen == YES) {
|
if(self.isSessionOpen == YES)
|
||||||
resumed = YES;
|
return YES;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if([self ll_isOptedIn] == false) {
|
|
||||||
[self logMessage:@"Can't resume session because user is opted out."];
|
|
||||||
resumed = NO;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
BOOL ret = NO;
|
||||||
// conditions for resuming previous session
|
// conditions for resuming previous session
|
||||||
if(self.sessionHasBeenOpen &&
|
if(self.sessionHasBeenOpen &&
|
||||||
(!self.sessionCloseTime ||
|
(!self.sessionCloseTime ||
|
||||||
@ -227,21 +217,37 @@ CLLocationCoordinate2D lastDeviceLocation = {0};
|
|||||||
// enough that the previous session could not be opened, there will be nothing to resume. But
|
// enough that the previous session could not be opened, there will be nothing to resume. But
|
||||||
// if this session caused it to go over it is better to let it complete and stop the next one
|
// if this session caused it to go over it is better to let it complete and stop the next one
|
||||||
// from being created.
|
// from being created.
|
||||||
|
ret = YES;
|
||||||
|
dispatch_async(_queue, ^{
|
||||||
|
@try {
|
||||||
|
if([self ll_isOptedIn] == false) {
|
||||||
|
[self logMessage:@"Can't resume session because user is opted out."];
|
||||||
|
} else {
|
||||||
[self logMessage:@"Resume called - Resuming previous session."];
|
[self logMessage:@"Resume called - Resuming previous session."];
|
||||||
[self reopenPreviousSession];
|
[self reopenPreviousSession];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@catch (NSException * e) {}
|
||||||
|
});
|
||||||
|
|
||||||
resumed = YES;
|
} else {
|
||||||
|
ret = NO;
|
||||||
|
dispatch_async(_queue, ^{
|
||||||
|
@try {
|
||||||
|
if([self ll_isOptedIn] == false) {
|
||||||
|
[self logMessage:@"Can't resume session because user is opted out."];
|
||||||
} else {
|
} else {
|
||||||
// otherwise open new session and upload
|
// otherwise open new session and upload
|
||||||
[self logMessage:@"Resume called - Opening a new session."];
|
[self logMessage:@"Resume called - Opening a new session."];
|
||||||
[self ll_open];
|
[self ll_open];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@catch (NSException * e) {}
|
||||||
|
});
|
||||||
|
|
||||||
resumed = NO;
|
|
||||||
}
|
}
|
||||||
self.sessionCloseTime = nil;
|
self.sessionCloseTime = nil;
|
||||||
} @catch (NSException *e) {}
|
return ret;
|
||||||
});
|
|
||||||
return resumed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)close {
|
- (void)close {
|
||||||
@ -1120,9 +1126,10 @@ CLLocationCoordinate2D lastDeviceLocation = {0};
|
|||||||
*/
|
*/
|
||||||
- (NSString *)advertisingIdentifier {
|
- (NSString *)advertisingIdentifier {
|
||||||
NSString *adId = nil;
|
NSString *adId = nil;
|
||||||
SEL adidSelector = NSSelectorFromString(@"identifierForAdvertising");
|
Class advertisingClass = NSClassFromString(@"ASIdentifierManager");
|
||||||
if ([[UIDevice currentDevice] respondsToSelector:adidSelector]) {
|
if (advertisingClass) {
|
||||||
adId = [[[UIDevice currentDevice] performSelector:adidSelector] performSelector:NSSelectorFromString(@"UUIDString")];
|
SEL adidSelector = NSSelectorFromString(@"advertisingIdentifier");
|
||||||
|
adId = [[[advertisingClass performSelector:NSSelectorFromString(@"sharedManager")] performSelector:adidSelector] performSelector:NSSelectorFromString(@"UUIDString")];
|
||||||
}
|
}
|
||||||
return adId;
|
return adId;
|
||||||
}
|
}
|
||||||
|
0
Localytics/LocalyticsUploader.h
Normal file → Executable file
0
Localytics/LocalyticsUploader.h
Normal file → Executable file
0
Localytics/LocalyticsUploader.m
Normal file → Executable file
0
Localytics/LocalyticsUploader.m
Normal file → Executable file
0
Localytics/WebserviceConstants.h
Normal file → Executable file
0
Localytics/WebserviceConstants.h
Normal file → Executable file
Loading…
Reference in New Issue
Block a user