Skip to content

Commit

Permalink
update Amplitude iOS v3.14.1
Browse files Browse the repository at this point in the history
  • Loading branch information
djih committed Apr 18, 2017
1 parent 6e9744e commit 4c61555
Show file tree
Hide file tree
Showing 49 changed files with 22,176 additions and 195 deletions.
276 changes: 146 additions & 130 deletions Assets/Amplitude/Amplitude.cs

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion Assets/Plugins/Android/amplitude-unity-2.10.0.jar.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 19 additions & 1 deletion Assets/Plugins/iOS/Amplitude/AMPARCMacros.h.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Assets/Plugins/iOS/Amplitude/AMPConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

extern NSString *const kAMPLibrary;
extern NSString *const kAMPPlatform;
extern NSString *const kAMPOSName;
extern NSString *const kAMPVersion;
extern NSString *const kAMPEventLogDomain;
extern NSString *const kAMPEventLogUrl;
Expand Down
20 changes: 19 additions & 1 deletion Assets/Plugins/iOS/Amplitude/AMPConstants.h.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 14 additions & 3 deletions Assets/Plugins/iOS/Amplitude/AMPConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,28 @@
#import "AMPConstants.h"

NSString *const kAMPLibrary = @"amplitude-ios";
NSString *const kAMPPlatform = @"iOS";
NSString *const kAMPVersion = @"3.9.0";
NSString *const kAMPVersion = @"3.14.1";
NSString *const kAMPEventLogDomain = @"api.amplitude.com";
NSString *const kAMPEventLogUrl = @"https://api.amplitude.com/";
NSString *const kAMPDefaultInstance = @"$default_instance";
const int kAMPApiVersion = 3;
const int kAMPDBVersion = 3;
const int kAMPDBFirstVersion = 2; // to detect if DB exists yet

// for tvOS, upload events immediately, don't save too many events locally
#if TARGET_OS_TV
const int kAMPEventUploadThreshold = 1;
const int kAMPEventMaxCount = 100;
NSString *const kAMPPlatform = @"tvOS";
NSString *const kAMPOSName = @"tvos";
#else // iOS
const int kAMPEventUploadThreshold = 30;
const int kAMPEventUploadMaxBatchSize = 100;
const int kAMPEventMaxCount = 1000;
NSString *const kAMPPlatform = @"iOS";
NSString *const kAMPOSName = @"ios";
#endif

const int kAMPEventUploadMaxBatchSize = 100;
const int kAMPEventRemoveBatchSize = 20;
const int kAMPEventUploadPeriodSeconds = 30; // 30s
const long kAMPMinTimeBetweenSessionsMillis = 5 * 60 * 1000; // 5m
Expand Down
20 changes: 19 additions & 1 deletion Assets/Plugins/iOS/Amplitude/AMPConstants.m.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/Plugins/iOS/Amplitude/AMPDatabaseHelper.h.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Assets/Plugins/iOS/Amplitude/AMPDatabaseHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ - (id)initWithInstanceName:(NSString*) instanceName
instanceName = [instanceName lowercaseString];

if ((self = [super init])) {
NSString *databaseDirectory = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex: 0];
NSString *databaseDirectory = [AMPUtils platformDataDirectory];
NSString *databasePath = [databaseDirectory stringByAppendingPathComponent:@"com.amplitude.database"];
if (![instanceName isEqualToString:kAMPDefaultInstance]) {
databasePath = [NSString stringWithFormat:@"%@_%@", databasePath, instanceName];
Expand Down
8 changes: 8 additions & 0 deletions Assets/Plugins/iOS/Amplitude/AMPDatabaseHelper.m.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Assets/Plugins/iOS/Amplitude/AMPDeviceInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
@property (readonly) NSString *advertiserID;
@property (readonly) NSString *vendorID;

-(NSString*) generateUUID;
+(NSString*) generateUUID;

@end
@end
20 changes: 19 additions & 1 deletion Assets/Plugins/iOS/Amplitude/AMPDeviceInfo.h.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 29 additions & 16 deletions Assets/Plugins/iOS/Amplitude/AMPDeviceInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#import "AMPARCMacros.h"
#import "AMPDeviceInfo.h"
#import "AMPUtils.h"
#import "AMPConstants.h"
#import <UIKit/UIKit.h>
#import <sys/sysctl.h>

Expand Down Expand Up @@ -54,7 +55,7 @@ -(NSString*) appVersion {
}

-(NSString*) osName {
return @"ios";
return kAMPOSName;
}

-(NSString*) osVersion {
Expand All @@ -77,23 +78,28 @@ -(NSString*) model {

-(NSString*) carrier {
if (!_carrier) {
Class CTTelephonyNetworkInfo = NSClassFromString(@"CTTelephonyNetworkInfo");
SEL subscriberCellularProvider = NSSelectorFromString(@"subscriberCellularProvider");
SEL carrierName = NSSelectorFromString(@"carrierName");
if (CTTelephonyNetworkInfo && subscriberCellularProvider && carrierName) {
networkInfo = SAFE_ARC_RETAIN([[NSClassFromString(@"CTTelephonyNetworkInfo") alloc] init]);
id carrier = nil;
id (*imp1)(id, SEL) = (id (*)(id, SEL))[networkInfo methodForSelector:subscriberCellularProvider];
if (imp1) {
carrier = imp1(networkInfo, subscriberCellularProvider);
@try {
Class CTTelephonyNetworkInfo = NSClassFromString(@"CTTelephonyNetworkInfo");
SEL subscriberCellularProvider = NSSelectorFromString(@"subscriberCellularProvider");
SEL carrierName = NSSelectorFromString(@"carrierName");
if (CTTelephonyNetworkInfo && subscriberCellularProvider && carrierName) {
networkInfo = SAFE_ARC_RETAIN([[NSClassFromString(@"CTTelephonyNetworkInfo") alloc] init]);
id carrier = nil;
id (*imp1)(id, SEL) = (id (*)(id, SEL))[networkInfo methodForSelector:subscriberCellularProvider];
if (imp1) {
carrier = imp1(networkInfo, subscriberCellularProvider);
}
NSString* (*imp2)(id, SEL) = (NSString* (*)(id, SEL))[carrier methodForSelector:carrierName];
if (imp2) {
_carrier = SAFE_ARC_RETAIN(imp2(carrier, carrierName));
}
}
NSString* (*imp2)(id, SEL) = (NSString* (*)(id, SEL))[carrier methodForSelector:carrierName];
if (imp2) {
_carrier = SAFE_ARC_RETAIN(imp2(carrier, carrierName));
else {
_carrier = SAFE_ARC_RETAIN(@"Unknown");
}
}
else {
return @"Unknown";
@catch (NSException *exception) {
_carrier = SAFE_ARC_RETAIN(@"Unknown");
}
}
return _carrier;
Expand Down Expand Up @@ -186,7 +192,7 @@ + (NSString*)getVendorID:(int) maxAttempts
}
}

- (NSString*)generateUUID
+ (NSString*)generateUUID
{
// Add "R" at the end of the ID to distinguish it from advertiserId
NSString *result = [[AMPUtils generateUUID] stringByAppendingString:@"R"];
Expand All @@ -210,17 +216,24 @@ + (NSString*)getPhoneModel{
if ([platform isEqualToString:@"iPhone1,2"]) return @"iPhone 3G";
if ([platform isEqualToString:@"iPhone2,1"]) return @"iPhone 3GS";
if ([platform isEqualToString:@"iPhone3,1"]) return @"iPhone 4";
if ([platform isEqualToString:@"iPhone3,2"]) return @"iPhone 4";
if ([platform isEqualToString:@"iPhone3,3"]) return @"iPhone 4";
if ([platform isEqualToString:@"iPhone4,1"]) return @"iPhone 4S";
if ([platform isEqualToString:@"iPhone5,1"]) return @"iPhone 5";
if ([platform isEqualToString:@"iPhone5,2"]) return @"iPhone 5";
if ([platform isEqualToString:@"iPhone5,3"]) return @"iPhone 5c";
if ([platform isEqualToString:@"iPhone5,4"]) return @"iPhone 5c";
if ([platform isEqualToString:@"iPhone6,1"]) return @"iPhone 5s";
if ([platform isEqualToString:@"iPhone6,2"]) return @"iPhone 5s";
if ([platform isEqualToString:@"iPhone7,1"]) return @"iPhone 6 Plus";
if ([platform isEqualToString:@"iPhone7,2"]) return @"iPhone 6";
if ([platform isEqualToString:@"iPhone8,1"]) return @"iPhone 6s";
if ([platform isEqualToString:@"iPhone8,2"]) return @"iPhone 6s Plus";
if ([platform isEqualToString:@"iPhone8,4"]) return @"iPhone SE";
if ([platform isEqualToString:@"iPhone9,1"]) return @"iPhone 7";
if ([platform isEqualToString:@"iPhone9,2"]) return @"iPhone 7 Plus";
if ([platform isEqualToString:@"iPhone9,3"]) return @"iPhone 7";
if ([platform isEqualToString:@"iPhone9,4"]) return @"iPhone 7 Plus";
if ([platform isEqualToString:@"iPod1,1"]) return @"iPod Touch 1G";
if ([platform isEqualToString:@"iPod2,1"]) return @"iPod Touch 2G";
if ([platform isEqualToString:@"iPod3,1"]) return @"iPod Touch 3G";
Expand Down
20 changes: 19 additions & 1 deletion Assets/Plugins/iOS/Amplitude/AMPDeviceInfo.m.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/Plugins/iOS/Amplitude/AMPIdentify.h.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/Plugins/iOS/Amplitude/AMPIdentify.m.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 19 additions & 1 deletion Assets/Plugins/iOS/Amplitude/AMPLocationManagerDelegate.h.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4c61555

Please sign in to comment.