diff --git a/Assets/Amplitude/Amplitude.cs b/Assets/Amplitude/Amplitude.cs index 1ef7e6a..166d23b 100644 --- a/Assets/Amplitude/Amplitude.cs +++ b/Assets/Amplitude/Amplitude.cs @@ -9,7 +9,7 @@ public class Amplitude { private static readonly string UnityLibraryName = "amplitude-unity"; - private static readonly string UnityLibraryVersion = "2.3.0"; + private static readonly string UnityLibraryVersion = "2.4.0"; private static Dictionary instances; private static readonly object instanceLock = new object(); @@ -56,6 +56,10 @@ public class Amplitude { [DllImport ("__Internal")] private static extern void _Amplitude_setServerUrl(string instanceName, string serverUrl); [DllImport ("__Internal")] + private static extern void _Amplitude_setServerZone(string instanceName, string serverZone, bool updateServerUrl); + [DllImport ("__Internal")] + private static extern void _Amplitude_setUseDynamicConfig(string instanceName, bool useDynamicConfig); + [DllImport ("__Internal")] private static extern void _Amplitude_logRevenueAmount(string instanceName, double amount); [DllImport ("__Internal")] private static extern void _Amplitude_logRevenue(string instanceName, string productIdentifier, int quantity, double price); @@ -703,6 +707,48 @@ public void setServerUrl(string serverUrl) { #endif } + /// + /// Turning dynamic config on will find the best server url automatically based on users' geo location. + /// Note: + /// 1. If you have your own proxy server and use `setServerUrl` API, please leave this off. + /// 2. If you have users in China Mainland, we suggest you turn this on. + /// + public void setUseDynamicConfig(bool useDynamicConfig) { + Log (string.Format("C# setUseDynamicConfig")); +#if (UNITY_IPHONE || UNITY_TVOS) + if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.tvOS) { + _Amplitude_setUseDynamicConfig(instanceName, useDynamicConfig); + } +#endif + +#if UNITY_ANDROID + if (Application.platform == RuntimePlatform.Android) { + pluginClass.CallStatic("setUseDynamicConfig", instanceName, useDynamicConfig); + } +#endif + } + + /// + /// Set Amplitude Server Zone, switch to zone related configuration, including dynamic configuration and server url. + /// To send data to Amplitude's EU servers, you need to configure the serverZone to EU like client.setServerZone("EU"); + /// serverZone could be EU or US. Recommend to keep updateServerUrl to be true for alignment unless use own proxy server. + /// + public void setServerZone(AmplitudeServerZone serverZone, bool updateServerUrl = true) { + Log (string.Format("C# setServerZone")); + string serverZoneStr = serverZone.ToString(); +#if (UNITY_IPHONE || UNITY_TVOS) + if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.tvOS) { + _Amplitude_setServerZone(instanceName, serverZoneStr, updateServerUrl); + } +#endif + +#if UNITY_ANDROID + if (Application.platform == RuntimePlatform.Android) { + pluginClass.CallStatic("setServerZone", instanceName, serverZoneStr, updateServerUrl); + } +#endif + } + [System.Obsolete("Please call setUserProperties instead", false)] public void setGlobalUserProperties(IDictionary properties) { setUserProperties(properties); diff --git a/Assets/Amplitude/AmplitudeServerZone.cs b/Assets/Amplitude/AmplitudeServerZone.cs new file mode 100644 index 0000000..b653bea --- /dev/null +++ b/Assets/Amplitude/AmplitudeServerZone.cs @@ -0,0 +1,4 @@ +public enum AmplitudeServerZone { + US, + EU +} \ No newline at end of file diff --git a/Assets/Amplitude/AmplitudeServerZone.cs.meta b/Assets/Amplitude/AmplitudeServerZone.cs.meta new file mode 100644 index 0000000..2bdf201 --- /dev/null +++ b/Assets/Amplitude/AmplitudeServerZone.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3e5faec7cfd814b9184afb52e5770382 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/AmplitudeDependencies.xml b/Assets/Editor/AmplitudeDependencies.xml index 35d356c..f9be129 100755 --- a/Assets/Editor/AmplitudeDependencies.xml +++ b/Assets/Editor/AmplitudeDependencies.xml @@ -4,7 +4,7 @@ https://repo.maven.apache.org/maven2 - + https://maven.google.com diff --git a/Assets/Plugins/Android/com.amplitude.android-sdk-2.32.0.aar b/Assets/Plugins/Android/com.amplitude.android-sdk-2.32.0.aar deleted file mode 100644 index a4d3821..0000000 Binary files a/Assets/Plugins/Android/com.amplitude.android-sdk-2.32.0.aar and /dev/null differ diff --git a/Assets/Plugins/Android/com.amplitude.android-sdk-2.34.1.aar b/Assets/Plugins/Android/com.amplitude.android-sdk-2.34.1.aar new file mode 100644 index 0000000..a7d0cc3 Binary files /dev/null and b/Assets/Plugins/Android/com.amplitude.android-sdk-2.34.1.aar differ diff --git a/Assets/Plugins/Android/com.amplitude.android-sdk-2.32.0.aar.meta b/Assets/Plugins/Android/com.amplitude.android-sdk-2.34.1.aar.meta similarity index 93% rename from Assets/Plugins/Android/com.amplitude.android-sdk-2.32.0.aar.meta rename to Assets/Plugins/Android/com.amplitude.android-sdk-2.34.1.aar.meta index 313c2bf..8e7014f 100644 --- a/Assets/Plugins/Android/com.amplitude.android-sdk-2.32.0.aar.meta +++ b/Assets/Plugins/Android/com.amplitude.android-sdk-2.34.1.aar.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 142f04b871f7d40a2aefba3cb1f30af5 +guid: 61cd2854beae44acda124a6ddf7abed0 labels: - gpsr PluginImporter: diff --git a/Assets/Plugins/iOS/Amplitude/AMPBackgroundNotifier.h b/Assets/Plugins/iOS/Amplitude/AMPBackgroundNotifier.h new file mode 100644 index 0000000..beb2fdb --- /dev/null +++ b/Assets/Plugins/iOS/Amplitude/AMPBackgroundNotifier.h @@ -0,0 +1,46 @@ +// +// AMPBackgroundNotifier.h +// Copyright (c) 2020 Amplitude Inc. (https://amplitude.com/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +#import + +#if TARGET_OS_WATCH + +NS_ASSUME_NONNULL_BEGIN + +extern NSNotificationName const AMPAppWillEnterForegroundNotification; +extern NSNotificationName const AMPAppDidEnterBackgroundNotification; + +/// watchOS adds support for background notifications in watchOS 7.0 with `WKExtension.applicationDidEnterBackgroundNotification` +/// and related notifications. But since this SDK is backwards compatible with watchOS 3.0, these notifications are not available. Instead, the user +/// should implement the appropriate background methods on their Extension Delegate and call the `AMPBackgroundNotifier` from those +/// methods. +@interface AMPBackgroundNotifier : NSObject + ++ (void)applicationWillEnterForeground; ++ (void)applicationDidEnterBackground; + +@end + +NS_ASSUME_NONNULL_END + +#endif diff --git a/Assets/Plugins/iOS/Amplitude/AMPBubbleView.m.meta b/Assets/Plugins/iOS/Amplitude/AMPBackgroundNotifier.h.meta similarity index 93% rename from Assets/Plugins/iOS/Amplitude/AMPBubbleView.m.meta rename to Assets/Plugins/iOS/Amplitude/AMPBackgroundNotifier.h.meta index 164268d..1877d41 100644 --- a/Assets/Plugins/iOS/Amplitude/AMPBubbleView.m.meta +++ b/Assets/Plugins/iOS/Amplitude/AMPBackgroundNotifier.h.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f3b9417a15870421ab48476261a564cf +guid: 81d8d078629554d429c77b0a311b48c0 PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/iOS/Amplitude/AMPBubbleView.m b/Assets/Plugins/iOS/Amplitude/AMPBackgroundNotifier.m similarity index 60% rename from Assets/Plugins/iOS/Amplitude/AMPBubbleView.m rename to Assets/Plugins/iOS/Amplitude/AMPBackgroundNotifier.m index b040e8e..ae2387f 100644 --- a/Assets/Plugins/iOS/Amplitude/AMPBubbleView.m +++ b/Assets/Plugins/iOS/Amplitude/AMPBackgroundNotifier.m @@ -1,7 +1,5 @@ // -// AMPBubbleView.m -// Amplitude -// +// AMPBackgroundNotifier.m // Copyright (c) 2020 Amplitude Inc. (https://amplitude.com/) // // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -23,38 +21,23 @@ // THE SOFTWARE. // -#import "AMPBubbleView.h" +#import "AMPBackgroundNotifier.h" -@implementation AMPBubbleView +#if TARGET_OS_WATCH -- (instancetype)initWithCoder:(NSCoder *)coder { - self = [super initWithCoder:coder]; - - if (self) { - [self loadViewFromNib]; - } - - return self; -} +NSNotificationName const AMPAppWillEnterForegroundNotification = @"com.amplitude.appWillEnterForegroundNotification"; +NSNotificationName const AMPAppDidEnterBackgroundNotification = @"com.amplitude.appDidEnterBackgroundNotification"; -- (instancetype)initWithFrame:(CGRect)frame { - self = [super initWithFrame:frame]; - - if (self) { - [self loadViewFromNib]; - } - - return self; +@implementation AMPBackgroundNotifier + ++ (void)applicationWillEnterForeground { + [[NSNotificationCenter defaultCenter] postNotificationName:AMPAppWillEnterForegroundNotification object:self]; } -- (void)loadViewFromNib { - NSBundle *bundle = [NSBundle bundleForClass:[AMPBubbleView class]]; - UINib *nib = [UINib nibWithNibName:@"AMPBubbleView" bundle:bundle]; - - NSArray *views = [nib instantiateWithOwner:self options:nil]; - UIView *view = [views objectAtIndex:0]; - view.frame = self.bounds; - [self addSubview:view]; ++ (void)applicationDidEnterBackground { + [[NSNotificationCenter defaultCenter] postNotificationName:AMPAppDidEnterBackgroundNotification object:self]; } @end + +#endif diff --git a/Assets/Plugins/iOS/Amplitude/AMPEventExplorer.h.meta b/Assets/Plugins/iOS/Amplitude/AMPBackgroundNotifier.m.meta similarity index 93% rename from Assets/Plugins/iOS/Amplitude/AMPEventExplorer.h.meta rename to Assets/Plugins/iOS/Amplitude/AMPBackgroundNotifier.m.meta index a395881..237bb32 100644 --- a/Assets/Plugins/iOS/Amplitude/AMPEventExplorer.h.meta +++ b/Assets/Plugins/iOS/Amplitude/AMPBackgroundNotifier.m.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 5c04c10bac7cf42e1b5df510803f7629 +guid: 5547e12f37c1f41ee8771fe10fffc9d9 PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/iOS/Amplitude/AMPBubbleView.xib b/Assets/Plugins/iOS/Amplitude/AMPBubbleView.xib deleted file mode 100644 index 81ef01e..0000000 --- a/Assets/Plugins/iOS/Amplitude/AMPBubbleView.xib +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Assets/Plugins/iOS/Amplitude/AMPConfigManager.h b/Assets/Plugins/iOS/Amplitude/AMPConfigManager.h index f3fb554..5603663 100644 --- a/Assets/Plugins/iOS/Amplitude/AMPConfigManager.h +++ b/Assets/Plugins/iOS/Amplitude/AMPConfigManager.h @@ -22,6 +22,7 @@ // #import +#import "AMPServerZone.h" NS_ASSUME_NONNULL_BEGIN @@ -30,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, strong, readonly) NSString *ingestionEndpoint; + (instancetype)sharedInstance; -- (void)refresh:(void(^)(void))completionHandler; +- (void)refresh:(void(^)(void))completionHandler serverZone:(AMPServerZone)serverZone; @end diff --git a/Assets/Plugins/iOS/Amplitude/AMPConfigManager.m b/Assets/Plugins/iOS/Amplitude/AMPConfigManager.m index b055979..8b61a6d 100644 --- a/Assets/Plugins/iOS/Amplitude/AMPConfigManager.m +++ b/Assets/Plugins/iOS/Amplitude/AMPConfigManager.m @@ -23,6 +23,8 @@ #import "AMPConfigManager.h" #import "AMPConstants.h" +#import "AMPServerZone.h" +#import "AMPServerZoneUtil.h" @interface AMPConfigManager () @@ -48,8 +50,8 @@ - (instancetype)init { return self; } -- (void)refresh:(void(^)(void))completionHandler { - NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:kAMPDyanmicConfigUrl]]; +- (void)refresh:(void(^)(void))completionHandler serverZone:(AMPServerZone)serverZone { + NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:[AMPServerZoneUtil getDynamicConfigApi:serverZone]]]; NSURLSession *session = [NSURLSession sharedSession]; NSURLSessionDataTask *task = [session dataTaskWithRequest:request diff --git a/Assets/Plugins/iOS/Amplitude/AMPConstants.h b/Assets/Plugins/iOS/Amplitude/AMPConstants.h index c9f039b..e1cc054 100644 --- a/Assets/Plugins/iOS/Amplitude/AMPConstants.h +++ b/Assets/Plugins/iOS/Amplitude/AMPConstants.h @@ -31,7 +31,10 @@ extern NSString *const kAMPPlatform; extern NSString *const kAMPOSName; extern NSString *const kAMPEventLogDomain; extern NSString *const kAMPEventLogUrl; +extern NSString *const kAMPEventLogEuUrl; +extern NSString *const kAMPContentTypeHeader; extern NSString *const kAMPDyanmicConfigUrl; +extern NSString *const kAMPDyanmicConfigEuUrl; extern NSString *const kAMPDefaultInstance; extern const int kAMPApiVersion; extern const int kAMPDBVersion; @@ -82,3 +85,8 @@ extern NSString *const AMP_TRACKING_OPTION_OS_VERSION; extern NSString *const AMP_TRACKING_OPTION_PLATFORM; extern NSString *const AMP_TRACKING_OPTION_REGION; extern NSString *const AMP_TRACKING_OPTION_VERSION_NAME; + +// Plan +extern NSString *const AMP_PLAN_BRANCH; +extern NSString *const AMP_PLAN_SOURCE; +extern NSString *const AMP_PLAN_VERSION; diff --git a/Assets/Plugins/iOS/Amplitude/AMPConstants.m b/Assets/Plugins/iOS/Amplitude/AMPConstants.m index 63aa810..3c13572 100644 --- a/Assets/Plugins/iOS/Amplitude/AMPConstants.m +++ b/Assets/Plugins/iOS/Amplitude/AMPConstants.m @@ -24,12 +24,15 @@ #import "AMPConstants.h" NSString *const kAMPLibrary = @"amplitude-ios"; -NSString *const kAMPVersion = @"7.2.2"; // Version is managed automatically by semantic-release, please don't change it manually +NSString *const kAMPVersion = @"8.5.0"; // Version is managed automatically by semantic-release, please don't change it manually NSString *const kAMPUnknownLibrary = @"unknown-library"; NSString *const kAMPUnknownVersion = @"unknown-version"; NSString *const kAMPEventLogDomain = @"api2.amplitude.com"; NSString *const kAMPEventLogUrl = @"https://api2.amplitude.com/"; +NSString *const kAMPEventLogEuUrl = @"https://api.eu.amplitude.com/"; +NSString *const kAMPContentTypeHeader = @"application/x-www-form-urlencoded"; NSString *const kAMPDyanmicConfigUrl = @"https://regionconfig.amplitude.com/"; +NSString *const kAMPDyanmicConfigEuUrl = @"https://regionconfig.eu.amplitude.com/"; NSString *const kAMPDefaultInstance = @"$default_instance"; const int kAMPApiVersion = 3; const int kAMPDBVersion = 3; @@ -50,6 +53,11 @@ const int kAMPEventMaxCount = 1000; NSString *const kAMPPlatform = @"macOS"; NSString *const kAMPOSName = @"macos"; +#elif TARGET_OS_WATCH // watchOS, simulator, etc. + const int kAMPEventUploadThreshold = 30; + const int kAMPEventMaxCount = 1000; + NSString *const kAMPPlatform = @"watchOS"; + NSString *const kAMPOSName = @"watchos"; #else // iOS, simulator, etc. const int kAMPEventUploadThreshold = 30; const int kAMPEventMaxCount = 1000; @@ -99,3 +107,7 @@ NSString *const AMP_TRACKING_OPTION_PLATFORM = @"platform"; NSString *const AMP_TRACKING_OPTION_REGION = @"region"; NSString *const AMP_TRACKING_OPTION_VERSION_NAME = @"version_name"; + +NSString *const AMP_PLAN_BRANCH = @"branch"; +NSString *const AMP_PLAN_SOURCE = @"source"; +NSString *const AMP_PLAN_VERSION = @"version"; diff --git a/Assets/Plugins/iOS/Amplitude/AMPDeviceInfo.m b/Assets/Plugins/iOS/Amplitude/AMPDeviceInfo.m index 9d4e61d..2f82f8a 100644 --- a/Assets/Plugins/iOS/Amplitude/AMPDeviceInfo.m +++ b/Assets/Plugins/iOS/Amplitude/AMPDeviceInfo.m @@ -28,7 +28,9 @@ #import #import -#if !TARGET_OS_OSX +#if TARGET_OS_WATCH +#import +#elif !TARGET_OS_OSX #import #else #import @@ -72,7 +74,9 @@ - (NSString *)osName { - (NSString *)osVersion { if (!_osVersion) { - #if !TARGET_OS_OSX + #if TARGET_OS_WATCH + _osVersion = [[WKInterfaceDevice currentDevice] systemVersion]; + #elif !TARGET_OS_OSX _osVersion = [[UIDevice currentDevice] systemVersion]; #else NSOperatingSystemVersion systemVersion = [[NSProcessInfo processInfo] operatingSystemVersion]; @@ -139,7 +143,7 @@ - (NSString *)language { - (NSString *)vendorID { if (!_vendorID) { -#if !TARGET_OS_OSX +#if !TARGET_OS_OSX && !TARGET_OS_WATCH if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 6.0) { #endif NSString *identifierForVendor = [AMPDeviceInfo getVendorID:5]; @@ -148,14 +152,22 @@ - (NSString *)vendorID { _vendorID = identifierForVendor; } } -#if !TARGET_OS_OSX +#if !TARGET_OS_OSX && !TARGET_OS_WATCH } #endif return _vendorID; } + (NSString *)getVendorID:(int)maxAttempts { -#if !TARGET_OS_OSX +#if TARGET_OS_WATCH + NSString *identifier; + if (@available(watchOS 6.2, *)) { + identifier = [[[WKInterfaceDevice currentDevice] identifierForVendor] UUIDString]; + } else { + // Identifier for vendor is not available on this version. + identifier = [[NSUUID UUID] UUIDString]; + } +#elif !TARGET_OS_OSX NSString *identifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; #else NSString *identifier = [self getMacAddress]; @@ -328,6 +340,30 @@ + (NSString *)getDeviceModel { // iPad Mini 5 if ([platform isEqualToString:@"iPad11,1"]) return @"iPad Mini 5"; if ([platform isEqualToString:@"iPad11,2"]) return @"iPad Mini 5"; + + // == Apple Watch == + if ([platform isEqualToString:@"Watch1,1"]) return @"Apple Watch 38mm"; + if ([platform isEqualToString:@"Watch1,2"]) return @"Apple Watch 42mm"; + if ([platform isEqualToString:@"Watch2,3"]) return @"Apple Watch Series 2 38mm"; + if ([platform isEqualToString:@"Watch2,4"]) return @"Apple Watch Series 2 42mm"; + if ([platform isEqualToString:@"Watch2,6"]) return @"Apple Watch Series 1 38mm"; + if ([platform isEqualToString:@"Watch2,7"]) return @"Apple Watch Series 1 42mm"; + if ([platform isEqualToString:@"Watch3,1"]) return @"Apple Watch Series 3 38mm Cellular"; + if ([platform isEqualToString:@"Watch3,2"]) return @"Apple Watch Series 3 42mm Cellular"; + if ([platform isEqualToString:@"Watch3,3"]) return @"Apple Watch Series 3 38mm"; + if ([platform isEqualToString:@"Watch3,4"]) return @"Apple Watch Series 3 42mm"; + if ([platform isEqualToString:@"Watch4,1"]) return @"Apple Watch Series 4 40mm"; + if ([platform isEqualToString:@"Watch4,2"]) return @"Apple Watch Series 4 44mm"; + if ([platform isEqualToString:@"Watch4,3"]) return @"Apple Watch Series 4 40mm Cellular"; + if ([platform isEqualToString:@"Watch4,4"]) return @"Apple Watch Series 4 44mm Cellular"; + if ([platform isEqualToString:@"Watch5,1"]) return @"Apple Watch Series 5 40mm"; + if ([platform isEqualToString:@"Watch5,2"]) return @"Apple Watch Series 5 44mm"; + if ([platform isEqualToString:@"Watch5,3"]) return @"Apple Watch Series 5 40mm Cellular"; + if ([platform isEqualToString:@"Watch5,4"]) return @"Apple Watch Series 5 44mm Cellular"; + if ([platform isEqualToString:@"Watch6,1"]) return @"Apple Watch Series 6 40mm"; + if ([platform isEqualToString:@"Watch6,2"]) return @"Apple Watch Series 6 44mm"; + if ([platform isEqualToString:@"Watch6,3"]) return @"Apple Watch Series 6 40mm Cellular"; + if ([platform isEqualToString:@"Watch6,4"]) return @"Apple Watch Series 6 44mm Cellular"; // == Others == if ([platform isEqualToString:@"i386"]) return @"Simulator"; diff --git a/Assets/Plugins/iOS/Amplitude/AMPEventExplorer.m b/Assets/Plugins/iOS/Amplitude/AMPEventExplorer.m deleted file mode 100644 index 4192e79..0000000 --- a/Assets/Plugins/iOS/Amplitude/AMPEventExplorer.m +++ /dev/null @@ -1,105 +0,0 @@ -// -// AMPEventExplorer.m -// Amplitude -// -// Copyright (c) 2020 Amplitude Inc. (https://amplitude.com/) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -#import "AMPEventExplorer.h" -#import -#import "AMPBubbleView.h" -#import "AMPUtils.h" -#import "AMPInfoViewController.h" - -@interface AMPEventExplorer () - -@property (strong, nonatomic, readwrite) AMPBubbleView *bubbleView; -@property (strong, nonatomic, readwrite) NSString *instanceName; - -@end - -@implementation AMPEventExplorer - -- (instancetype)initWithInstanceName:(NSString *)instanceName { - if ((self = [super init])) { - self.instanceName = instanceName; - } - return self; -} - -- (void)showBubbleView { - dispatch_async(dispatch_get_main_queue(), ^{ - CGRect screenRect = [[UIScreen mainScreen] bounds]; - CGFloat screenWidth = screenRect.size.width; - CGFloat screenHeight = screenRect.size.height; - NSInteger bottomOffset = [AMPUtils barBottomOffset]; - - self.bubbleView = [[AMPBubbleView alloc] initWithFrame:CGRectMake(screenWidth - 50, - screenHeight - 50 - bottomOffset, - 35, - 35)]; - - dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)); - dispatch_after(popTime, dispatch_get_main_queue(), ^{ - [[AMPUtils getKeyWindow] addSubview:self.bubbleView]; - }); - - [self.bubbleView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showInfoView)]]; - [self.bubbleView addGestureRecognizer:[[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(bubbleViewDragged:)]]; - }); -} - -- (void)showInfoView { - dispatch_async(dispatch_get_main_queue(), ^{ - if (self.bubbleView != nil) { - UIViewController *rootViewController = [[AMPUtils getKeyWindow] rootViewController]; - - NSBundle *bundle = [NSBundle bundleForClass:[AMPInfoViewController class]]; - AMPInfoViewController *infoVC = [[AMPInfoViewController alloc] initWithNibName:@"AMPInfoViewController" bundle:bundle]; - infoVC.instanceName = self.instanceName; - - [infoVC setModalPresentationStyle:UIModalPresentationFullScreen]; - [rootViewController presentViewController:infoVC animated:YES completion:nil]; - } - }); -} - -- (void)bubbleViewDragged:(UIPanGestureRecognizer *)sender { - CGPoint translation = [sender translationInView:self.bubbleView]; - - CGFloat statusBarHeight = [AMPUtils statusBarHeight]; - NSInteger bottomOffset = [AMPUtils barBottomOffset]; - - CGRect screenRect = [[UIScreen mainScreen] bounds]; - CGFloat screenWidth = screenRect.size.width; - CGFloat screenHeight = screenRect.size.height; - - CGFloat newY = MIN(self.bubbleView.center.y + translation.y, screenHeight - bottomOffset); - newY = MAX(statusBarHeight + (CGRectGetHeight(self.bubbleView.bounds) / 2), newY); - - CGFloat newX = MIN(self.bubbleView.center.x + translation.x, screenWidth); - newX = MAX((CGRectGetWidth(self.bubbleView.bounds) / 2), newX); - - self.bubbleView.center = CGPointMake(newX, newY); - [sender setTranslation:CGPointZero inView:self.bubbleView]; -} - -@end diff --git a/Assets/Plugins/iOS/Amplitude/AMPEventExplorer.m.meta b/Assets/Plugins/iOS/Amplitude/AMPEventExplorer.m.meta deleted file mode 100644 index 01a3b92..0000000 --- a/Assets/Plugins/iOS/Amplitude/AMPEventExplorer.m.meta +++ /dev/null @@ -1,33 +0,0 @@ -fileFormatVersion: 2 -guid: 10aca1916750242b7a2b10b8ec2ffa36 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - iPhone: iOS - second: - enabled: 1 - settings: - AddToEmbeddedBinaries: false - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/iOS/Amplitude/AMPIdentify.h b/Assets/Plugins/iOS/Amplitude/AMPIdentify.h index c51f770..6120770 100644 --- a/Assets/Plugins/iOS/Amplitude/AMPIdentify.h +++ b/Assets/Plugins/iOS/Amplitude/AMPIdentify.h @@ -155,9 +155,13 @@ /** Pre-insert the value of a given user property. If the value already exists, it will do no operation. + @param property The user property key + @param value A value or values to set. + @returns the same [AMPIdentify](#) object, allowing you to chain multiple method calls together. + @see [User Properties and User Property Operations](https://github.com/amplitude/amplitude-ios#user-properties-and-user-property-operations) */ - (AMPIdentify *)preInsert:(NSString *)property value:(NSObject *)value; @@ -165,9 +169,13 @@ /** Post-insert the value of a given user property. If the value already exists, it will do no operation. + @param property The user property key + @param value A value or values to set. + @returns the same [AMPIdentify](#) object, allowing you to chain multiple method calls together. + @see [User Properties and User Property Operations](https://github.com/amplitude/amplitude-ios#user-properties-and-user-property-operations) */ - (AMPIdentify *)postInsert:(NSString *)property value:(NSObject *)value; @@ -175,9 +183,13 @@ /** Remove the value of a given user property, if the value exists. If the value doesn't exsit, it will do no opearation. + @param property The user property key + @param value A value or values to set. + @returns the same [AMPIdentify](#) object, allowing you to chain multiple method calls together. + @see [User Properties and User Property Operations](https://github.com/amplitude/amplitude-ios#user-properties-and-user-property-operations) */ - (AMPIdentify *)remove:(NSString *)property value:(NSObject *)value; diff --git a/Assets/Plugins/iOS/Amplitude/AMPInfoViewController.h.meta b/Assets/Plugins/iOS/Amplitude/AMPInfoViewController.h.meta deleted file mode 100644 index bfaae48..0000000 --- a/Assets/Plugins/iOS/Amplitude/AMPInfoViewController.h.meta +++ /dev/null @@ -1,33 +0,0 @@ -fileFormatVersion: 2 -guid: f8ae725ef90b94be8bcd0ee03a332595 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - iPhone: iOS - second: - enabled: 1 - settings: - AddToEmbeddedBinaries: false - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/iOS/Amplitude/AMPInfoViewController.m b/Assets/Plugins/iOS/Amplitude/AMPInfoViewController.m deleted file mode 100644 index b0068b9..0000000 --- a/Assets/Plugins/iOS/Amplitude/AMPInfoViewController.m +++ /dev/null @@ -1,93 +0,0 @@ -// -// AMPInfoViewController.m -// Amplitude -// -// Copyright (c) 2020 Amplitude Inc. (https://amplitude.com/) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -#import "AMPInfoViewController.h" -#import "Amplitude.h" - -@interface AMPInfoViewController () - -@property (weak, nonatomic) IBOutlet UILabel *deviceIdLabel; -@property (weak, nonatomic) IBOutlet UILabel *userIdLabel; -@property (weak, nonatomic) IBOutlet UIButton *deviceIdCopyButton; -@property (weak, nonatomic) IBOutlet UIButton *userIdCopyButton; -@property (weak, nonatomic) IBOutlet UIImageView *dismissButton; -@property (weak, nonatomic) IBOutlet UILabel *copiedLabel; - -@end - -@implementation AMPInfoViewController - -- (void)viewDidLoad { - [super viewDidLoad]; - - [self.dismissButton addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissSelf)]]; - - NSString *deviceId = [Amplitude instanceWithName:self.instanceName].deviceId; - NSString *userId = [Amplitude instanceWithName:self.instanceName].userId; - - // Populate deviceId and userId - self.deviceIdLabel.text = deviceId; - self.userIdLabel.text = userId; - - // Customize styles - self.deviceIdCopyButton.layer.borderWidth = 1; - self.deviceIdCopyButton.layer.borderColor = [[UIColor colorWithRed:198.0/255.0 green:208.0/255.0 blue:217.0/255.0 alpha:1] CGColor]; - self.userIdCopyButton.layer.borderWidth = 1; - self.userIdCopyButton.layer.borderColor = [[UIColor colorWithRed:198.0/255.0 green:208.0/255.0 blue:217.0/255.0 alpha:1] CGColor]; - - self.copiedLabel.alpha = 0; - self.copiedLabel.layer.borderWidth = 1; - self.copiedLabel.layer.borderColor = [[UIColor colorWithRed:198.0/255.0 green:208.0/255.0 blue:217.0/255.0 alpha:1] CGColor]; -} - -- (void)dismissSelf { - [self dismissViewControllerAnimated:YES completion:nil]; -} - -- (IBAction)deviceIdCopyTapped:(id)sender { - UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; - pasteboard.string = self.deviceIdLabel.text; - - [self showAndDismissCopiedLabel]; -} - -- (IBAction)userIdCopyTapped:(id)sender { - UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; - pasteboard.string = self.userIdLabel.text; - - [self showAndDismissCopiedLabel]; -} - -- (void)showAndDismissCopiedLabel { - self.copiedLabel.alpha = 1; - [UIView animateWithDuration:2 - delay:0.0 - options:UIViewAnimationOptionTransitionCrossDissolve - animations:^{ - [self.copiedLabel setAlpha:0]; - } - completion:NULL]; -} - -@end diff --git a/Assets/Plugins/iOS/Amplitude/AMPInfoViewController.m.meta b/Assets/Plugins/iOS/Amplitude/AMPInfoViewController.m.meta deleted file mode 100644 index 5029691..0000000 --- a/Assets/Plugins/iOS/Amplitude/AMPInfoViewController.m.meta +++ /dev/null @@ -1,33 +0,0 @@ -fileFormatVersion: 2 -guid: 51ea67e4d34654547b4626d311240a7f -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - iPhone: iOS - second: - enabled: 1 - settings: - AddToEmbeddedBinaries: false - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/iOS/Amplitude/AMPInfoViewController.xib b/Assets/Plugins/iOS/Amplitude/AMPInfoViewController.xib deleted file mode 100644 index 8144d53..0000000 --- a/Assets/Plugins/iOS/Amplitude/AMPInfoViewController.xib +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Assets/Plugins/iOS/Amplitude/AMPInfoViewController.xib.meta b/Assets/Plugins/iOS/Amplitude/AMPInfoViewController.xib.meta deleted file mode 100644 index 826dcab..0000000 --- a/Assets/Plugins/iOS/Amplitude/AMPInfoViewController.xib.meta +++ /dev/null @@ -1,33 +0,0 @@ -fileFormatVersion: 2 -guid: c2080360a3f83488ab9bb2f74bbc697e -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - iPhone: iOS - second: - enabled: 1 - settings: - AddToEmbeddedBinaries: false - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/iOS/Amplitude/AMPEventExplorer.h b/Assets/Plugins/iOS/Amplitude/AMPPlan.h similarity index 70% rename from Assets/Plugins/iOS/Amplitude/AMPEventExplorer.h rename to Assets/Plugins/iOS/Amplitude/AMPPlan.h index 8990db1..83c62ef 100644 --- a/Assets/Plugins/iOS/Amplitude/AMPEventExplorer.h +++ b/Assets/Plugins/iOS/Amplitude/AMPPlan.h @@ -1,8 +1,6 @@ // -// AMPEventExplorer.h -// Amplitude -// -// Copyright (c) 2020 Amplitude Inc. (https://amplitude.com/) +// AMPPlan.h +// Copyright (c) 2021 Amplitude Inc. (https://amplitude.com/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -22,16 +20,24 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // - #import -NS_ASSUME_NONNULL_BEGIN +@interface AMPPlan : NSObject -@interface AMPEventExplorer : NSObject +@property (nonatomic, strong, readonly) NSString *branch; -- (instancetype)initWithInstanceName:(NSString *)instanceName; -- (void)showBubbleView; +@property (nonatomic, strong, readonly) NSString *source; -@end +@property (nonatomic, strong, readonly) NSString *version; + ++ (instancetype)plan; + +- (AMPPlan *)setBranch:(NSString *)branch; -NS_ASSUME_NONNULL_END +- (AMPPlan *)setSource:(NSString *)source; + +- (AMPPlan *)setVersion:(NSString *)version; + +- (NSDictionary *)toNSDictionary; + +@end diff --git a/Assets/Plugins/iOS/Amplitude/AMPBubbleView.xib.meta b/Assets/Plugins/iOS/Amplitude/AMPPlan.h.meta similarity index 93% rename from Assets/Plugins/iOS/Amplitude/AMPBubbleView.xib.meta rename to Assets/Plugins/iOS/Amplitude/AMPPlan.h.meta index 3d75fcc..4a6d722 100644 --- a/Assets/Plugins/iOS/Amplitude/AMPBubbleView.xib.meta +++ b/Assets/Plugins/iOS/Amplitude/AMPPlan.h.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 51fb2863dc2d2497e8152200a21e1d5d +guid: 3aa8c006c35b3478f8671dd55473cb2e PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/iOS/Amplitude/AMPPlan.m b/Assets/Plugins/iOS/Amplitude/AMPPlan.m new file mode 100644 index 0000000..4769538 --- /dev/null +++ b/Assets/Plugins/iOS/Amplitude/AMPPlan.m @@ -0,0 +1,89 @@ +// +// AMPPlan.m +// Copyright (c) 2021 Amplitude Inc. (https://amplitude.com/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +#ifndef AMPLITUDE_LOG +#if AMPLITUDE_DEBUG +# define AMPLITUDE_LOG(fmt, ...) NSLog(fmt, ##__VA_ARGS__) +#else +# define AMPLITUDE_LOG(...) +#endif +#endif + +#import "AMPPlan.h" +#import "AMPConstants.h" +#import "AMPUtils.h" + +@implementation AMPPlan + +/* + * Create an AMPPlan object + */ ++ (instancetype)plan { + return [[self alloc] init]; +} + +- (AMPPlan *)setBranch:(NSString *)branch { + if ([AMPUtils isEmptyString:branch]) { + AMPLITUDE_LOG(@"Invalid empty branch"); + return self; + } + + _branch = branch; + return self; +} + +- (AMPPlan *)setSource:(NSString *)source { + if ([AMPUtils isEmptyString:source]) { + AMPLITUDE_LOG(@"Invalid empty source"); + return self; + } + + _source = source; + return self; +} + +- (AMPPlan *)setVersion:(NSString *)version { + if ([AMPUtils isEmptyString:version]) { + AMPLITUDE_LOG(@"Invalid empty version"); + return self; + } + + _version = version; + return self; +} + +- (NSDictionary *)toNSDictionary { + NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; + if (_branch) { + [dict setValue:_branch forKey:AMP_PLAN_BRANCH]; + } + if (_source) { + [dict setValue:_source forKey:AMP_PLAN_SOURCE]; + } + if (_version) { + [dict setValue:_version forKey:AMP_PLAN_VERSION]; + } + return dict; +} + +@end diff --git a/Assets/Plugins/iOS/Amplitude/AMPBubbleView.h.meta b/Assets/Plugins/iOS/Amplitude/AMPPlan.m.meta similarity index 93% rename from Assets/Plugins/iOS/Amplitude/AMPBubbleView.h.meta rename to Assets/Plugins/iOS/Amplitude/AMPPlan.m.meta index a360d05..30b05ec 100644 --- a/Assets/Plugins/iOS/Amplitude/AMPBubbleView.h.meta +++ b/Assets/Plugins/iOS/Amplitude/AMPPlan.m.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 54a063d22d047480da61c5c05862ce57 +guid: 666dc0a85df7947c7875f91557c234ca PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/iOS/Amplitude/AMPInfoViewController.h b/Assets/Plugins/iOS/Amplitude/AMPServerZone.h similarity index 65% rename from Assets/Plugins/iOS/Amplitude/AMPInfoViewController.h rename to Assets/Plugins/iOS/Amplitude/AMPServerZone.h index d94d1cd..ba7a8d2 100644 --- a/Assets/Plugins/iOS/Amplitude/AMPInfoViewController.h +++ b/Assets/Plugins/iOS/Amplitude/AMPServerZone.h @@ -1,8 +1,6 @@ // -// AMPInfoViewController.h -// Amplitude -// -// Copyright (c) 2020 Amplitude Inc. (https://amplitude.com/) +// AMPServerZone.h +// Copyright (c) 2021 Amplitude Inc. (https://amplitude.com/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -22,15 +20,20 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // +#import +/** + * AMPServerZone is for Data Residency and handling server zone related properties. + * The server zones now are US and EU. + * + * For usage like sending data to Amplitude's EU servers, you need to configure the serverZone + * property after initializing the client with setServerZone method. + */ +typedef NS_ENUM(NSInteger, AMPServerZone); -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface AMPInfoViewController : UIViewController - -@property (strong, nonatomic, readwrite) NSString *instanceName; - -@end - -NS_ASSUME_NONNULL_END +#ifndef AMPServerZone_h +#define AMPServerZone_h +typedef NS_ENUM(NSInteger, AMPServerZone) { + US, + EU +}; +#endif diff --git a/Assets/Plugins/iOS/Amplitude/AMPServerZone.h.meta b/Assets/Plugins/iOS/Amplitude/AMPServerZone.h.meta new file mode 100644 index 0000000..65c326f --- /dev/null +++ b/Assets/Plugins/iOS/Amplitude/AMPServerZone.h.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 00ea8249e17f648e09ef84423812359f +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: + AddToEmbeddedBinaries: false + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/iOS/Amplitude/AMPBubbleView.h b/Assets/Plugins/iOS/Amplitude/AMPServerZoneUtil.h similarity index 80% rename from Assets/Plugins/iOS/Amplitude/AMPBubbleView.h rename to Assets/Plugins/iOS/Amplitude/AMPServerZoneUtil.h index c3a5a01..4453ca0 100644 --- a/Assets/Plugins/iOS/Amplitude/AMPBubbleView.h +++ b/Assets/Plugins/iOS/Amplitude/AMPServerZoneUtil.h @@ -1,8 +1,6 @@ // -// AMPBubbleView.h -// Amplitude -// -// Copyright (c) 2020 Amplitude Inc. (https://amplitude.com/) +// AMPServerZoneUtil.h +// Copyright (c) 2021 Amplitude Inc. (https://amplitude.com/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -24,12 +22,12 @@ // #import -#import +#import "AMPServerZone.h" -NS_ASSUME_NONNULL_BEGIN +@interface AMPServerZoneUtil : NSObject -@interface AMPBubbleView : UIView ++ (NSString *)getEventLogApi:(AMPServerZone)serverZone; -@end ++ (NSString *)getDynamicConfigApi:(AMPServerZone)serverZone; -NS_ASSUME_NONNULL_END +@end diff --git a/Assets/Plugins/iOS/Amplitude/AMPServerZoneUtil.h.meta b/Assets/Plugins/iOS/Amplitude/AMPServerZoneUtil.h.meta new file mode 100644 index 0000000..7432825 --- /dev/null +++ b/Assets/Plugins/iOS/Amplitude/AMPServerZoneUtil.h.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: d7d48757dbb2a4ab88d414c540dbd564 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: + AddToEmbeddedBinaries: false + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/iOS/Amplitude/AMPServerZoneUtil.m b/Assets/Plugins/iOS/Amplitude/AMPServerZoneUtil.m new file mode 100644 index 0000000..d32ae2d --- /dev/null +++ b/Assets/Plugins/iOS/Amplitude/AMPServerZoneUtil.m @@ -0,0 +1,63 @@ +// +// AMPServerZoneUtil.m +// Copyright (c) 2021 Amplitude Inc. (https://amplitude.com/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +#import +#import "AMPServerZone.h" +#import "AMPServerZoneUtil.h" +#import "AMPConstants.h" + +@implementation AMPServerZoneUtil + ++ (NSString *)getEventLogApi:(AMPServerZone)serverZone { + NSString *eventLogUrl = kAMPEventLogUrl; + switch (serverZone) { + case EU: + eventLogUrl = kAMPEventLogEuUrl; + break; + case US: + eventLogUrl = kAMPEventLogUrl; + break; + + default: + break; + } + return eventLogUrl; +} + ++ (NSString *)getDynamicConfigApi:(AMPServerZone)serverZone { + NSString *dynamicConfigUrl = kAMPDyanmicConfigUrl; + switch (serverZone) { + case EU: + dynamicConfigUrl = kAMPDyanmicConfigEuUrl; + break; + case US: + dynamicConfigUrl = kAMPDyanmicConfigUrl; + break; + + default: + break; + } + return dynamicConfigUrl; +} + +@end diff --git a/Assets/Plugins/iOS/Amplitude/AMPServerZoneUtil.m.meta b/Assets/Plugins/iOS/Amplitude/AMPServerZoneUtil.m.meta new file mode 100644 index 0000000..ed8f0b6 --- /dev/null +++ b/Assets/Plugins/iOS/Amplitude/AMPServerZoneUtil.m.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 637faf4e8976a4cee81bfb1f01de057b +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: + AddToEmbeddedBinaries: false + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/iOS/Amplitude/AMPTrackingOptions.h b/Assets/Plugins/iOS/Amplitude/AMPTrackingOptions.h index edf36e4..fa10ed0 100644 --- a/Assets/Plugins/iOS/Amplitude/AMPTrackingOptions.h +++ b/Assets/Plugins/iOS/Amplitude/AMPTrackingOptions.h @@ -23,6 +23,13 @@ #import +/** + Used with [Amplitude setTrackingOptions:] to disable individual fields. + + AMPTrackingOptions *options = [[[[AMPTrackingOptions options] disableCity] disableIPAddress] disablePlatform]; + [[Amplitude instance] setTrackingOptions:options]; + +*/ @interface AMPTrackingOptions : NSObject @property (nonatomic, strong, readonly) NSMutableSet *disabledFields; diff --git a/Assets/Plugins/iOS/Amplitude/AMPUtils.h b/Assets/Plugins/iOS/Amplitude/AMPUtils.h index 637b9e1..c4ac09b 100644 --- a/Assets/Plugins/iOS/Amplitude/AMPUtils.h +++ b/Assets/Plugins/iOS/Amplitude/AMPUtils.h @@ -22,7 +22,7 @@ // #import -#if !TARGET_OS_OSX +#if !TARGET_OS_OSX && !TARGET_OS_WATCH #import #endif @@ -34,7 +34,7 @@ + (NSDictionary *)validateGroups:(NSDictionary *)obj; + (NSString *)platformDataDirectory; -#if !TARGET_OS_OSX +#if !TARGET_OS_OSX && !TARGET_OS_WATCH + (UIApplication *)getSharedApplication; #endif diff --git a/Assets/Plugins/iOS/Amplitude/AMPUtils.m b/Assets/Plugins/iOS/Amplitude/AMPUtils.m index 7df7e71..35a3ffe 100644 --- a/Assets/Plugins/iOS/Amplitude/AMPUtils.m +++ b/Assets/Plugins/iOS/Amplitude/AMPUtils.m @@ -154,7 +154,7 @@ + (NSString *)platformDataDirectory { #endif } -#if !TARGET_OS_OSX +#if !TARGET_OS_OSX && !TARGET_OS_WATCH + (UIApplication *)getSharedApplication { Class UIApplicationClass = NSClassFromString(@"UIApplication"); if (UIApplicationClass && [UIApplicationClass respondsToSelector:@selector(sharedApplication)]) { diff --git a/Assets/Plugins/iOS/Amplitude/Amplitude.h b/Assets/Plugins/iOS/Amplitude/Amplitude.h index d07ca06..fc973f5 100644 --- a/Assets/Plugins/iOS/Amplitude/Amplitude.h +++ b/Assets/Plugins/iOS/Amplitude/Amplitude.h @@ -25,12 +25,14 @@ #import "AMPIdentify.h" #import "AMPRevenue.h" #import "AMPTrackingOptions.h" +#import "AMPPlan.h" +#import "AMPServerZone.h" NS_ASSUME_NONNULL_BEGIN typedef NSString *_Nonnull (^AMPAdSupportBlock)(void); typedef NSDictionary *_Nullable (^AMPLocationInfoBlock)(void); - +typedef void (^AMPInitCompletionBlock)(void); /** Amplitude iOS SDK. @@ -108,7 +110,7 @@ typedef NSDictionary *_Nullable (^AMPLocationInfoBlock)(void); @property (nonatomic, assign) int eventUploadMaxBatchSize; /** - The maximum number of events that can be stored lcoally. The default is 1000 events. + The maximum number of events that can be stored locally. The default is 1000 events. */ @property (nonatomic, assign) int eventMaxCount; @@ -176,13 +178,21 @@ typedef NSDictionary *_Nullable (^AMPLocationInfoBlock)(void); */ @property (nonatomic, strong, nullable) AMPLocationInfoBlock locationInfoBlock; -#if TARGET_OS_IOS || TARGET_OS_MACCATALYST /** - Show Amplitude Event Explorer when you're running a debug build. + Content-Type header for event sending requests. Only relevant for sending events to a different URL (e.g. proxy server) */ -@property (nonatomic, assign, readwrite) BOOL showEventExplorer; +@property (nonatomic, copy, readonly) NSString *contentTypeHeader; -#endif +/** + * Sets a block to be called after completely initialized. + * + * Example: + * __typeof(amp) __weak weakAmp = amp; + * amp.initCompletionBlock = ^(void){ + * NSLog(@"deviceId: %@, userId: %@", weakAmp.deviceId, weakAmp.userId); + * }; + */ +@property (nonatomic, strong, nullable) AMPInitCompletionBlock initCompletionBlock; #pragma mark - Methods @@ -594,6 +604,14 @@ typedef NSDictionary *_Nullable (^AMPLocationInfoBlock)(void); */ - (void)useAdvertisingIdForDeviceId; +/** + By default the iOS SDK will track several user properties such as carrier, city, country, ip_address, language, platform, etc. You can use the provided AMPTrackingOptions interface to customize and disable individual fields. + + Note: Each operation on the AMPTrackingOptions object returns the same instance which allows you to chain multiple operations together. + + AMPTrackingOptions *options = [[[[AMPTrackingOptions options] disableCity] disableIPAddress] disablePlatform]; + [[Amplitude instance] setTrackingOptions:options]; + */ - (void)setTrackingOptions:(AMPTrackingOptions *)options; /** @@ -607,10 +625,35 @@ typedef NSDictionary *_Nullable (^AMPLocationInfoBlock)(void); */ - (void)disableCoppaControl; +/** + Sends events to a different URL other than kAMPEventLogUrl. Used for proxy servers + + We now have a new method setServerZone. To send data to Amplitude's EU servers, recommend to use setServerZone + method like [client setServerZone:EU] + */ - (void)setServerUrl:(NSString *)serverUrl; +/** + Sets Content-Type header for event sending requests +*/ +- (void)setContentTypeHeader:(NSString *)contentType; + - (void)setBearerToken:(NSString *)token; +- (void)setPlan:(AMPPlan *)plan; + +/** + * Set Amplitude Server Zone, switch to zone related configuration, including dynamic configuration and server url. + * To send data to Amplitude's EU servers, you need to configure the serverZone to EU like [client setServerZone:EU] + */ +- (void)setServerZone:(AMPServerZone)serverZone; + +/** + * Set Amplitude Server Zone, switch to zone related configuration, including dynamic configuration and server url. + * If updateServerUrl is true, including server url as well. Recommend to keep updateServerUrl to be true for alignment. + */ +- (void)setServerZone:(AMPServerZone)serverZone updateServerUrl:(BOOL)updateServerUrl; + /**----------------------------------------------------------------------------- * @name Other Methods * ----------------------------------------------------------------------------- @@ -669,6 +712,9 @@ typedef NSDictionary *_Nullable (^AMPLocationInfoBlock)(void); */ - (BOOL)startOrContinueSession:(long long)timestamp; + +- (NSString *)getContentTypeHeader; + @end #pragma mark - constants diff --git a/Assets/Plugins/iOS/Amplitude/Amplitude.m b/Assets/Plugins/iOS/Amplitude/Amplitude.m index b86e262..2e725d0 100644 --- a/Assets/Plugins/iOS/Amplitude/Amplitude.m +++ b/Assets/Plugins/iOS/Amplitude/Amplitude.m @@ -48,6 +48,7 @@ #import "Amplitude.h" #import "AmplitudePrivate.h" +#import "AMPBackgroundNotifier.h" #import "AMPConstants.h" #import "AMPConfigManager.h" #import "AMPDeviceInfo.h" @@ -58,6 +59,9 @@ #import "AMPIdentify.h" #import "AMPRevenue.h" #import "AMPTrackingOptions.h" +#import "AMPPlan.h" +#import "AMPServerZone.h" +#import "AMPServerZoneUtil.h" #import #import @@ -67,16 +71,14 @@ #import #import -#if !TARGET_OS_OSX +#if TARGET_OS_WATCH +#import +#elif !TARGET_OS_OSX #import #else #import #endif -#if TARGET_OS_IOS || TARGET_OS_MACCATALYST -#import "AMPEventExplorer.h" -#endif - @interface Amplitude () @property (nonatomic, strong) NSOperationQueue *backgroundQueue; @@ -89,9 +91,7 @@ @interface Amplitude () @property (nonatomic, assign) int backoffUploadBatchSize; @property (nonatomic, copy, readwrite, nullable) NSString *userId; @property (nonatomic, copy, readwrite) NSString *deviceId; -#if TARGET_OS_IOS || TARGET_OS_MACCATALYST -@property (nonatomic, strong) AMPEventExplorer *eventExplorer; -#endif +@property (nonatomic, copy, readwrite) NSString *contentTypeHeader; @end NSString *const kAMPSessionStartEvent = @"session_start"; @@ -119,7 +119,7 @@ @implementation Amplitude { BOOL _updateScheduled; BOOL _updatingCurrently; -#if !TARGET_OS_OSX +#if !TARGET_OS_OSX && !TARGET_OS_WATCH UIBackgroundTaskIdentifier _uploadTaskID; #endif @@ -136,6 +136,8 @@ @implementation Amplitude { NSString *_serverUrl; NSString *_token; + AMPPlan *_plan; + AMPServerZone _serverZone; } #pragma clang diagnostic push @@ -198,8 +200,10 @@ - (instancetype)initWithInstanceName:(NSString *)instanceName { _backoffUpload = NO; _offline = NO; _serverUrl = kAMPEventLogUrl; + _serverZone = US; self.libraryName = kAMPLibrary; self.libraryVersion = kAMPVersion; + self.contentTypeHeader = kAMPContentTypeHeader; _inputTrackingOptions = [AMPTrackingOptions options]; _appliedTrackingOptions = [AMPTrackingOptions copyOf:_inputTrackingOptions]; _apiPropertiesTrackingOptions = [NSDictionary dictionary]; @@ -225,7 +229,7 @@ - (instancetype)initWithInstanceName:(NSString *)instanceName { [_initializerQueue addOperationWithBlock:^{ - #if !TARGET_OS_OSX + #if !TARGET_OS_OSX && !TARGET_OS_WATCH self->_uploadTaskID = UIBackgroundTaskInvalid; #endif @@ -345,7 +349,16 @@ - (BOOL)migrateEventsDataToDB { - (void)addObservers { NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; -#if !TARGET_OS_OSX +#if TARGET_OS_WATCH + [center addObserver:self + selector:@selector(enterForeground) + name:AMPAppWillEnterForegroundNotification + object:nil]; + [center addObserver:self + selector:@selector(enterBackground) + name:AMPAppDidEnterBackgroundNotification + object:nil]; +#elif !TARGET_OS_OSX [center addObserver:self selector:@selector(enterForeground) name:UIApplicationWillEnterForegroundNotification @@ -368,7 +381,10 @@ - (void)addObservers { - (void)removeObservers { NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; -#if !TARGET_OS_OSX +#if TARGET_OS_WATCH + [center removeObserver:self name:AMPAppWillEnterForegroundNotification object:nil]; + [center removeObserver:self name:AMPAppDidEnterBackgroundNotification object:nil]; +#elif !TARGET_OS_OSX [center removeObserver:self name:UIApplicationWillEnterForegroundNotification object:nil]; [center removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:nil]; #else @@ -428,13 +444,16 @@ - (void)initializeApiKey:(NSString *)apiKey } else { self.userId = [self.dbHelper getValue:USER_ID]; } + if (self.initCompletionBlock != nil) { + self.initCompletionBlock(); + } }]; // Normally _inForeground is set by the enterForeground callback, but initializeWithApiKey will be called after the app's enterForeground // notification is already triggered, so we need to manually check and set it now. // UIApplication methods are only allowed on the main thread so need to dispatch this synchronously to the main thread. void (^checkInForeground)(void) = ^{ - #if !TARGET_OS_OSX + #if !TARGET_OS_OSX && !TARGET_OS_WATCH UIApplication *app = [AMPUtils getSharedApplication]; if (app != nil) { UIApplicationState state = app.applicationState; @@ -447,7 +466,7 @@ - (void)initializeApiKey:(NSString *)apiKey NSNumber *now = [NSNumber numberWithLongLong:[[self currentTime] timeIntervalSince1970] * 1000]; [self startOrContinueSessionNSNumber:now]; self->_inForeground = YES; - #if !TARGET_OS_OSX + #if !TARGET_OS_OSX && !TARGET_OS_WATCH }]; } @@ -456,21 +475,6 @@ - (void)initializeApiKey:(NSString *)apiKey }; [self runSynchronouslyOnMainQueue:checkInForeground]; _initialized = YES; - - #if TARGET_OS_IOS || TARGET_OS_MACCATALYST - // Release build - #if !RELEASE - if (self.showEventExplorer) { - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - - if (self.eventExplorer == nil) { - self.eventExplorer = [[AMPEventExplorer alloc] initWithInstanceName:self.instanceName]; - } - [self.eventExplorer showBubbleView]; - }); - } - #endif - #endif } } @@ -660,6 +664,10 @@ - (void)annotateEvent:(NSMutableDictionary *)event { [event setValue:library forKey:@"library"]; [event setValue:[AMPUtils generateUUID] forKey:@"uuid"]; [event setValue:[NSNumber numberWithLongLong:[self getNextSequenceNumber]] forKey:@"sequence_number"]; + + if (_plan) { + [event setValue:[_plan toNSDictionary] forKey:@"plan"]; + } NSMutableDictionary *apiProperties = [event valueForKey:@"api_properties"]; @@ -831,7 +839,7 @@ - (void)refreshDynamicConfig { return; } strongSelf->_serverUrl = [AMPConfigManager sharedInstance].ingestionEndpoint; - }]; + } serverZone:_serverZone]; } } @@ -929,7 +937,7 @@ - (void)makeEventUploadPostRequest:(NSString *)url events:(NSString *)events num [postData appendData:[checksum dataUsingEncoding:NSUTF8StringEncoding]]; [request setHTTPMethod:@"POST"]; - [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; + [request setValue:self.contentTypeHeader forHTTPHeaderField:@"Content-Type"]; [request setValue:[NSString stringWithFormat:@"%lu", (unsigned long)[postData length]] forHTTPHeaderField:@"Content-Length"]; if (_token != nil) { @@ -1013,7 +1021,7 @@ - (void)makeEventUploadPostRequest:(NSString *)url events:(NSString *)events num if (uploadSuccessful && [self.dbHelper getEventCount] > self.eventUploadThreshold) { int limit = self->_backoffUpload ? self->_backoffUploadBatchSize : 0; [self uploadEventsWithLimit:limit]; - #if !TARGET_OS_OSX + #if !TARGET_OS_OSX && !TARGET_OS_WATCH } else if (self->_uploadTaskID != UIBackgroundTaskInvalid) { if (uploadSuccessful) { self->_backoffUpload = NO; @@ -1032,7 +1040,7 @@ - (void)makeEventUploadPostRequest:(NSString *)url events:(NSString *)events num #pragma mark - application lifecycle methods - (void)enterForeground { -#if !TARGET_OS_OSX +#if !TARGET_OS_OSX && !TARGET_OS_WATCH UIApplication *app = [AMPUtils getSharedApplication]; if (app == nil) { return; @@ -1041,7 +1049,7 @@ - (void)enterForeground { NSNumber *now = [NSNumber numberWithLongLong:[[self currentTime] timeIntervalSince1970] * 1000]; -#if !TARGET_OS_OSX +#if !TARGET_OS_OSX && !TARGET_OS_WATCH // Stop uploading [self endBackgroundTaskIfNeeded]; #endif @@ -1056,7 +1064,7 @@ - (void)enterForeground { } - (void)enterBackground { -#if !TARGET_OS_OSX +#if !TARGET_OS_OSX && !TARGET_OS_WATCH UIApplication *app = [AMPUtils getSharedApplication]; if (app == nil) { return; @@ -1065,7 +1073,7 @@ - (void)enterBackground { NSNumber *now = [NSNumber numberWithLongLong:[[self currentTime] timeIntervalSince1970] * 1000]; -#if !TARGET_OS_OSX +#if !TARGET_OS_OSX && !TARGET_OS_WATCH // Stop uploading [self endBackgroundTaskIfNeeded]; _uploadTaskID = [app beginBackgroundTaskWithExpirationHandler:^{ @@ -1082,7 +1090,7 @@ - (void)enterBackground { } - (void)endBackgroundTaskIfNeeded { -#if !TARGET_OS_OSX +#if !TARGET_OS_OSX && !TARGET_OS_WATCH if (_uploadTaskID != UIBackgroundTaskInvalid) { UIApplication *app = [AMPUtils getSharedApplication]; if (app == nil) { @@ -1378,6 +1386,14 @@ - (void)setServerUrl:(NSString *)serverUrl { self->_serverUrl = serverUrl; } +- (void)setContentTypeHeader:(NSString *)contentTypeHeader { + self->_contentTypeHeader = contentTypeHeader; +} + +- (NSString *)getContentTypeHeader { + return self.contentTypeHeader; + } + - (void)setBearerToken:(NSString *)token { if (!(token == nil || [self isArgument:token validType:[NSString class] methodName:@"setBearerToken:"])) { return; @@ -1416,6 +1432,21 @@ - (void)useAdvertisingIdForDeviceId { _useAdvertisingIdForDeviceId = YES; } +- (void)setPlan:(AMPPlan *)plan { + _plan = plan; +} + +- (void)setServerZone:(AMPServerZone)serverZone { + [self setServerZone:serverZone updateServerUrl:YES]; +} + +- (void)setServerZone:(AMPServerZone)serverZone updateServerUrl:(BOOL)updateServerUrl { + _serverZone = serverZone; + if (updateServerUrl) { + [self setServerUrl:[AMPServerZoneUtil getEventLogApi:serverZone]]; + } +} + #pragma mark - Getters for device data - (NSString *)getAdSupportID { NSString *result = nil; @@ -1686,7 +1717,7 @@ - (id)unarchive:(NSString *)path { } - (id)unarchive:(NSData *)data error:(NSError **)error { - if (@available(iOS 12, tvOS 11.0, macOS 10.13, *)) { + if (@available(iOS 12, tvOS 11.0, macOS 10.13, watchOS 4.0, *)) { return [NSKeyedUnarchiver unarchivedObjectOfClass:[NSDictionary class] fromData:data error:error]; } else { #pragma clang diagnostic push @@ -1702,7 +1733,7 @@ - (id)unarchive:(NSData *)data error:(NSError **)error { } - (BOOL)archive:(id)obj toFile:(NSString *)path { - if (@available(tvOS 11.0, iOS 12, macOS 10.13, *)) { + if (@available(tvOS 11.0, iOS 12, macOS 10.13, watchOS 4.0, *)) { NSError *archiveError = nil; NSData *data = [NSKeyedArchiver archivedDataWithRootObject:obj requiringSecureCoding:NO error:&archiveError]; if (archiveError != nil) { diff --git a/Assets/Plugins/iOS/Amplitude/AmplitudeCWrapper.m b/Assets/Plugins/iOS/Amplitude/AmplitudeCWrapper.m index 7520411..fec051c 100644 --- a/Assets/Plugins/iOS/Amplitude/AmplitudeCWrapper.m +++ b/Assets/Plugins/iOS/Amplitude/AmplitudeCWrapper.m @@ -3,6 +3,7 @@ #import "AMPIdentify.h" #import "AMPRevenue.h" #import "AMPTrackingOptions.h" +#import "AMPServerZone.h" // Used to allocate a C string on the heap for C# char* MakeCString(const char* string) { @@ -180,6 +181,15 @@ void _Amplitude_setServerUrl(const char* instanceName, const char* serverUrl) { [[Amplitude instanceWithName:ToNSString(instanceName)] setServerUrl:ToNSString(serverUrl)]; } +void _Amplitude_setServerZone(const char* instanceName, const char* serverZone, const bool updateServerUrl) { + AMPServerZone ampServerZone = (strcmp("EU",serverZone) == 0) ? EU : US; + [[Amplitude instanceWithName:ToNSString(instanceName)] setServerZone:ampServerZone updateServerUrl:updateServerUrl]; +} + +void _Amplitude_setUseDynamicConfig(const char* instanceName, const bool useDynamicConfig) { + [Amplitude instanceWithName:ToNSString(instanceName)].useDynamicConfig = useDynamicConfig; +} + void _Amplitude_logRevenueAmount(const char* instanceName, double amount) { [[Amplitude instanceWithName:ToNSString(instanceName)] logRevenue:[NSNumber numberWithDouble:amount]]; } diff --git a/Assets/Plugins/iOS/Amplitude/Images.meta b/Assets/Plugins/iOS/Amplitude/Images.meta deleted file mode 100644 index 5f1d974..0000000 --- a/Assets/Plugins/iOS/Amplitude/Images.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 0d79f971e2f8542919ec2fefb5ec16d9 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/iOS/Amplitude/Images/cancel.png b/Assets/Plugins/iOS/Amplitude/Images/cancel.png deleted file mode 100644 index 485467c..0000000 Binary files a/Assets/Plugins/iOS/Amplitude/Images/cancel.png and /dev/null differ diff --git a/Assets/Plugins/iOS/Amplitude/Images/cancel.png.meta b/Assets/Plugins/iOS/Amplitude/Images/cancel.png.meta deleted file mode 100644 index 9dffb8b..0000000 --- a/Assets/Plugins/iOS/Amplitude/Images/cancel.png.meta +++ /dev/null @@ -1,92 +0,0 @@ -fileFormatVersion: 2 -guid: f9174ac2bcf8a4fcdad9156f5744bd69 -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 11 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: -1 - aniso: -1 - mipBias: -100 - wrapU: -1 - wrapV: -1 - wrapW: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 0 - textureShape: 1 - singleChannelComponent: 0 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - applyGammaDecoding: 0 - platformSettings: - - serializedVersion: 3 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - spritePackingTag: - pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/iOS/Amplitude/Images/cancel@2x.png b/Assets/Plugins/iOS/Amplitude/Images/cancel@2x.png deleted file mode 100644 index 3d0b124..0000000 Binary files a/Assets/Plugins/iOS/Amplitude/Images/cancel@2x.png and /dev/null differ diff --git a/Assets/Plugins/iOS/Amplitude/Images/cancel@2x.png.meta b/Assets/Plugins/iOS/Amplitude/Images/cancel@2x.png.meta deleted file mode 100644 index 29712b3..0000000 --- a/Assets/Plugins/iOS/Amplitude/Images/cancel@2x.png.meta +++ /dev/null @@ -1,92 +0,0 @@ -fileFormatVersion: 2 -guid: 8d5bcefc0269f4e7b84b47fbb1429109 -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 11 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: -1 - aniso: -1 - mipBias: -100 - wrapU: -1 - wrapV: -1 - wrapW: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 0 - textureShape: 1 - singleChannelComponent: 0 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - applyGammaDecoding: 0 - platformSettings: - - serializedVersion: 3 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - spritePackingTag: - pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/iOS/Amplitude/Images/cancel@3x.png b/Assets/Plugins/iOS/Amplitude/Images/cancel@3x.png deleted file mode 100644 index 091021c..0000000 Binary files a/Assets/Plugins/iOS/Amplitude/Images/cancel@3x.png and /dev/null differ diff --git a/Assets/Plugins/iOS/Amplitude/Images/cancel@3x.png.meta b/Assets/Plugins/iOS/Amplitude/Images/cancel@3x.png.meta deleted file mode 100644 index 079a5c8..0000000 --- a/Assets/Plugins/iOS/Amplitude/Images/cancel@3x.png.meta +++ /dev/null @@ -1,92 +0,0 @@ -fileFormatVersion: 2 -guid: 5a3bf4606add14f65bb54b68f1c354ee -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 11 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: -1 - aniso: -1 - mipBias: -100 - wrapU: -1 - wrapV: -1 - wrapW: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 0 - textureShape: 1 - singleChannelComponent: 0 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - applyGammaDecoding: 0 - platformSettings: - - serializedVersion: 3 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - spritePackingTag: - pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/iOS/Amplitude/Images/logo-banner.png b/Assets/Plugins/iOS/Amplitude/Images/logo-banner.png deleted file mode 100644 index ccb612a..0000000 Binary files a/Assets/Plugins/iOS/Amplitude/Images/logo-banner.png and /dev/null differ diff --git a/Assets/Plugins/iOS/Amplitude/Images/logo-banner.png.meta b/Assets/Plugins/iOS/Amplitude/Images/logo-banner.png.meta deleted file mode 100644 index 15cc998..0000000 --- a/Assets/Plugins/iOS/Amplitude/Images/logo-banner.png.meta +++ /dev/null @@ -1,92 +0,0 @@ -fileFormatVersion: 2 -guid: be5bdc4823ac840c0954aaea5f26a101 -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 11 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: -1 - aniso: -1 - mipBias: -100 - wrapU: -1 - wrapV: -1 - wrapW: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 0 - textureShape: 1 - singleChannelComponent: 0 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - applyGammaDecoding: 0 - platformSettings: - - serializedVersion: 3 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - spritePackingTag: - pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/iOS/Amplitude/Images/logo-banner@2x.png b/Assets/Plugins/iOS/Amplitude/Images/logo-banner@2x.png deleted file mode 100644 index 7738230..0000000 Binary files a/Assets/Plugins/iOS/Amplitude/Images/logo-banner@2x.png and /dev/null differ diff --git a/Assets/Plugins/iOS/Amplitude/Images/logo-banner@2x.png.meta b/Assets/Plugins/iOS/Amplitude/Images/logo-banner@2x.png.meta deleted file mode 100644 index 2051b7a..0000000 --- a/Assets/Plugins/iOS/Amplitude/Images/logo-banner@2x.png.meta +++ /dev/null @@ -1,92 +0,0 @@ -fileFormatVersion: 2 -guid: f9a0c4a224d894acab62808589c04e28 -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 11 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: -1 - aniso: -1 - mipBias: -100 - wrapU: -1 - wrapV: -1 - wrapW: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 0 - textureShape: 1 - singleChannelComponent: 0 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - applyGammaDecoding: 0 - platformSettings: - - serializedVersion: 3 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - spritePackingTag: - pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/iOS/Amplitude/Images/logo-banner@3x.png b/Assets/Plugins/iOS/Amplitude/Images/logo-banner@3x.png deleted file mode 100644 index f385e22..0000000 Binary files a/Assets/Plugins/iOS/Amplitude/Images/logo-banner@3x.png and /dev/null differ diff --git a/Assets/Plugins/iOS/Amplitude/Images/logo-banner@3x.png.meta b/Assets/Plugins/iOS/Amplitude/Images/logo-banner@3x.png.meta deleted file mode 100644 index 789236b..0000000 --- a/Assets/Plugins/iOS/Amplitude/Images/logo-banner@3x.png.meta +++ /dev/null @@ -1,92 +0,0 @@ -fileFormatVersion: 2 -guid: e540102818784400199e535abdc3d271 -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 11 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: -1 - aniso: -1 - mipBias: -100 - wrapU: -1 - wrapV: -1 - wrapW: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 0 - textureShape: 1 - singleChannelComponent: 0 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - applyGammaDecoding: 0 - platformSettings: - - serializedVersion: 3 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - spritePackingTag: - pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/iOS/Amplitude/Images/logo-button.png b/Assets/Plugins/iOS/Amplitude/Images/logo-button.png deleted file mode 100644 index 686b67b..0000000 Binary files a/Assets/Plugins/iOS/Amplitude/Images/logo-button.png and /dev/null differ diff --git a/Assets/Plugins/iOS/Amplitude/Images/logo-button.png.meta b/Assets/Plugins/iOS/Amplitude/Images/logo-button.png.meta deleted file mode 100644 index 82fbfc3..0000000 --- a/Assets/Plugins/iOS/Amplitude/Images/logo-button.png.meta +++ /dev/null @@ -1,92 +0,0 @@ -fileFormatVersion: 2 -guid: 748f588b596a548218d019fbeb2c19a7 -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 11 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: -1 - aniso: -1 - mipBias: -100 - wrapU: -1 - wrapV: -1 - wrapW: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 0 - textureShape: 1 - singleChannelComponent: 0 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - applyGammaDecoding: 0 - platformSettings: - - serializedVersion: 3 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - spritePackingTag: - pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/iOS/Amplitude/Images/logo-button@2x.png b/Assets/Plugins/iOS/Amplitude/Images/logo-button@2x.png deleted file mode 100644 index e84808f..0000000 Binary files a/Assets/Plugins/iOS/Amplitude/Images/logo-button@2x.png and /dev/null differ diff --git a/Assets/Plugins/iOS/Amplitude/Images/logo-button@2x.png.meta b/Assets/Plugins/iOS/Amplitude/Images/logo-button@2x.png.meta deleted file mode 100644 index 06ddd8f..0000000 --- a/Assets/Plugins/iOS/Amplitude/Images/logo-button@2x.png.meta +++ /dev/null @@ -1,92 +0,0 @@ -fileFormatVersion: 2 -guid: 2f69724bc884d49a2a189c2c4e11b8ac -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 11 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: -1 - aniso: -1 - mipBias: -100 - wrapU: -1 - wrapV: -1 - wrapW: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 0 - textureShape: 1 - singleChannelComponent: 0 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - applyGammaDecoding: 0 - platformSettings: - - serializedVersion: 3 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - spritePackingTag: - pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/iOS/Amplitude/Images/logo-button@3x.png b/Assets/Plugins/iOS/Amplitude/Images/logo-button@3x.png deleted file mode 100644 index ccd2600..0000000 Binary files a/Assets/Plugins/iOS/Amplitude/Images/logo-button@3x.png and /dev/null differ diff --git a/Assets/Plugins/iOS/Amplitude/Images/logo-button@3x.png.meta b/Assets/Plugins/iOS/Amplitude/Images/logo-button@3x.png.meta deleted file mode 100644 index 13c7d86..0000000 --- a/Assets/Plugins/iOS/Amplitude/Images/logo-button@3x.png.meta +++ /dev/null @@ -1,92 +0,0 @@ -fileFormatVersion: 2 -guid: 03175f6573ec04a1aa088dcdc4088cbd -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 11 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: -1 - aniso: -1 - mipBias: -100 - wrapU: -1 - wrapV: -1 - wrapW: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 0 - textureShape: 1 - singleChannelComponent: 0 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - applyGammaDecoding: 0 - platformSettings: - - serializedVersion: 3 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - spritePackingTag: - pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/AmplitudeDemo.cs b/Assets/Scripts/AmplitudeDemo.cs index 6ca0af9..d18b136 100644 --- a/Assets/Scripts/AmplitudeDemo.cs +++ b/Assets/Scripts/AmplitudeDemo.cs @@ -12,6 +12,8 @@ void Awake () { amplitude.logging = true; amplitude.trackSessionEvents(true); amplitude.useAdvertisingIdForDeviceId(); + amplitude.setUseDynamicConfig(true); + amplitude.setServerZone(AmplitudeServerZone.US); amplitude.init("e7177d872ff62c0356c973848c7bffba"); Debug.Log(amplitude.getDeviceId()); diff --git a/Assets/package.json b/Assets/package.json index 6a9ca5d..d35ef0d 100644 --- a/Assets/package.json +++ b/Assets/package.json @@ -1,6 +1,6 @@ { "name": "com.amplitude.unityplugin", - "version": "2.3.0", + "version": "2.4.0", "displayName": "Amplitude Unity SDK", "description": "A plugin to simplify the integration of Amplitude iOS and Android SDKs into your Unity project. This repository also contains a sample project with the Unity plugin integrated.", "unity": "2019.4", diff --git a/CHANGELOG.md b/CHANGELOG.md index 5342610..da52d82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Versioned Releases +## 2.4.0 +* Upgrade nativeAndroid SDK to v2.34.1. +* Upgrade native iOS SDK to v8.5.0. +* Add `setServerZone` and `setUseDynamicConfig` API. +* Support EU server zone and dynamic configuration. + ## 2.3.0 * Add `useAppSetIdForDeviceId` API. diff --git a/ProjectSettings/AndroidResolverDependencies.xml b/ProjectSettings/AndroidResolverDependencies.xml index 0a6db50..127eee6 100644 --- a/ProjectSettings/AndroidResolverDependencies.xml +++ b/ProjectSettings/AndroidResolverDependencies.xml @@ -1,10 +1,10 @@ - com.amplitude:android-sdk:2.32.0 + com.amplitude:android-sdk:2.34.1 com.squareup.okhttp3:okhttp:4.2.2 - Assets/Plugins/Android/com.amplitude.android-sdk-2.32.0.aar + Assets/Plugins/Android/com.amplitude.android-sdk-2.34.1.aar Assets/Plugins/Android/com.squareup.okhttp3.okhttp-4.2.2.jar Assets/Plugins/Android/com.squareup.okio.okio-2.2.2.jar Assets/Plugins/Android/org.jetbrains.annotations-13.0.jar