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;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
97
Localytics/LocalyticsSession.m
Normal file → Executable file
97
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,48 +200,54 @@ 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) {
|
return YES;
|
||||||
resumed = YES;
|
|
||||||
return;
|
BOOL ret = NO;
|
||||||
}
|
// conditions for resuming previous session
|
||||||
|
if(self.sessionHasBeenOpen &&
|
||||||
if([self ll_isOptedIn] == false) {
|
(!self.sessionCloseTime ||
|
||||||
[self logMessage:@"Can't resume session because user is opted out."];
|
[self.sessionCloseTime timeIntervalSinceNow]*-1 <= self.backgroundSessionTimeout)) {
|
||||||
resumed = NO;
|
// Note that we allow the session to be resumed even if the database size exceeds the
|
||||||
return;
|
// maximum. This is because we don't want to create incomplete sessions. If the DB was large
|
||||||
}
|
// 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
|
||||||
// conditions for resuming previous session
|
// from being created.
|
||||||
if(self.sessionHasBeenOpen &&
|
ret = YES;
|
||||||
(!self.sessionCloseTime ||
|
dispatch_async(_queue, ^{
|
||||||
[self.sessionCloseTime timeIntervalSinceNow]*-1 <= self.backgroundSessionTimeout)) {
|
@try {
|
||||||
// Note that we allow the session to be resumed even if the database size exceeds the
|
if([self ll_isOptedIn] == false) {
|
||||||
// maximum. This is because we don't want to create incomplete sessions. If the DB was large
|
[self logMessage:@"Can't resume session because user is opted out."];
|
||||||
// enough that the previous session could not be opened, there will be nothing to resume. But
|
} else {
|
||||||
// if this session caused it to go over it is better to let it complete and stop the next one
|
[self logMessage:@"Resume called - Resuming previous session."];
|
||||||
// from being created.
|
[self reopenPreviousSession];
|
||||||
[self logMessage:@"Resume called - Resuming previous session."];
|
}
|
||||||
[self reopenPreviousSession];
|
}
|
||||||
|
@catch (NSException * e) {}
|
||||||
resumed = YES;
|
});
|
||||||
} else {
|
|
||||||
// otherwise open new session and upload
|
} else {
|
||||||
[self logMessage:@"Resume called - Opening a new session."];
|
ret = NO;
|
||||||
[self ll_open];
|
dispatch_async(_queue, ^{
|
||||||
|
@try {
|
||||||
resumed = NO;
|
if([self ll_isOptedIn] == false) {
|
||||||
}
|
[self logMessage:@"Can't resume session because user is opted out."];
|
||||||
self.sessionCloseTime = nil;
|
} else {
|
||||||
} @catch (NSException *e) {}
|
// otherwise open new session and upload
|
||||||
});
|
[self logMessage:@"Resume called - Opening a new session."];
|
||||||
return resumed;
|
[self ll_open];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@catch (NSException * e) {}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
self.sessionCloseTime = nil;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)close {
|
- (void)close {
|
||||||
@ -1120,10 +1126,11 @@ 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