From d8321e551ca95565e7de2512e2453a426ca2097e Mon Sep 17 00:00:00 2001 From: Brandon Stalnaker Date: Tue, 10 Dec 2024 13:45:08 -0500 Subject: [PATCH] address CR --- UnitTests/MParticleTests.m | 4 ++-- .../MPAppNotificationHandler.m | 22 +++++++++---------- mParticle-Apple-SDK/Identity/MPIdentityApi.m | 12 +++++----- mParticle-Apple-SDK/Identity/MParticleUser.m | 20 ++++++++--------- mParticle-Apple-SDK/Include/mParticle.h | 3 +-- mParticle-Apple-SDK/Kits/MPKitAPI.m | 8 +++---- mParticle-Apple-SDK/Kits/MPKitActivity.m | 4 ++-- mParticle-Apple-SDK/MPConstants.swift | 14 ++++++------ .../Network/MPURLRequestBuilder.m | 4 ++-- mParticle-Apple-SDK/Utils/MPIUserDefaults.m | 2 +- .../Utils/MPResponseConfig.swift | 14 +++++------- 11 files changed, 52 insertions(+), 55 deletions(-) diff --git a/UnitTests/MParticleTests.m b/UnitTests/MParticleTests.m index fc03c051..7b85ddf6 100644 --- a/UnitTests/MParticleTests.m +++ b/UnitTests/MParticleTests.m @@ -1214,7 +1214,7 @@ - (void)testSwitchWorkspaceKitsWithoutStop { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, WORKSPACE_SWITCHING_DELAY), dispatch_get_main_queue(), ^{ registerNoStop.wrapperInstance = [[MPKitTestClassNoStartImmediately alloc] init]; - [MParticle sharedInstance].kitContainer.kitConfigurations[@42] = [[MPKitConfiguration alloc] init]; + [MParticle sharedInstance].kitContainer_PRIVATE.kitConfigurations[@42] = [[MPKitConfiguration alloc] init]; XCTAssertEqual(MPKitContainer_PRIVATE.registeredKits.count, 1); @@ -1242,7 +1242,7 @@ - (void)testSwitchWorkspaceKitsWithStop { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, WORKSPACE_SWITCHING_DELAY), dispatch_get_main_queue(), ^{ registerWithStop.wrapperInstance = [[MPKitTestClassNoStartImmediatelyWithStop alloc] init]; - [MParticle sharedInstance].kitContainer.kitConfigurations[@43] = [[MPKitConfiguration alloc] init]; + [MParticle sharedInstance].kitContainer_PRIVATE.kitConfigurations[@43] = [[MPKitConfiguration alloc] init]; XCTAssertEqual(MPKitContainer_PRIVATE.registeredKits.count, 1); diff --git a/mParticle-Apple-SDK/AppNotifications/MPAppNotificationHandler.m b/mParticle-Apple-SDK/AppNotifications/MPAppNotificationHandler.m index 81ed8263..35fcf290 100644 --- a/mParticle-Apple-SDK/AppNotifications/MPAppNotificationHandler.m +++ b/mParticle-Apple-SDK/AppNotifications/MPAppNotificationHandler.m @@ -64,7 +64,7 @@ - (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { [queueParameters addParameter:error]; dispatch_async(dispatch_get_main_queue(), ^{ - [[MParticle sharedInstance].kitContainer forwardSDKCall:failedRegistrationSelector + [[MParticle sharedInstance].kitContainer_PRIVATE forwardSDKCall:failedRegistrationSelector event:nil parameters:queueParameters messageType:MPMessageTypeUnknown @@ -98,7 +98,7 @@ - (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { [queueParameters addParameter:deviceToken]; dispatch_async(dispatch_get_main_queue(), ^{ - [[MParticle sharedInstance].kitContainer forwardSDKCall:deviceTokenSelector + [[MParticle sharedInstance].kitContainer_PRIVATE forwardSDKCall:deviceTokenSelector event:nil parameters:queueParameters messageType:MPMessageTypePushRegistration @@ -119,7 +119,7 @@ - (void)handleActionWithIdentifier:(NSString *)identifier forRemoteNotification: [queueParameters addParameter:userInfo]; dispatch_async(dispatch_get_main_queue(), ^{ - [[MParticle sharedInstance].kitContainer forwardSDKCall:handleActionWithIdentifierSelector + [[MParticle sharedInstance].kitContainer_PRIVATE forwardSDKCall:handleActionWithIdentifierSelector event:nil parameters:queueParameters messageType:MPMessageTypeUnknown @@ -141,7 +141,7 @@ - (void)handleActionWithIdentifier:(NSString *)identifier forRemoteNotification: [queueParameters addParameter:responseInfo]; dispatch_async(dispatch_get_main_queue(), ^{ - [[MParticle sharedInstance].kitContainer forwardSDKCall:handleActionWithIdentifierSelector + [[MParticle sharedInstance].kitContainer_PRIVATE forwardSDKCall:handleActionWithIdentifierSelector event:nil parameters:queueParameters messageType:MPMessageTypeUnknown @@ -176,7 +176,7 @@ - (void) didReceiveRemoteNotification:(NSDictionary *)userInfo { [queueParameters addParameter:userInfo]; dispatch_async(dispatch_get_main_queue(), ^{ - [[MParticle sharedInstance].kitContainer forwardSDKCall:receivedNotificationSelector + [[MParticle sharedInstance].kitContainer_PRIVATE forwardSDKCall:receivedNotificationSelector event:nil parameters:queueParameters messageType:MPMessageTypePushNotification @@ -197,7 +197,7 @@ - (void)didUpdateUserActivity:(nonnull NSUserActivity *)userActivity { [queueParameters addParameter:userActivity]; dispatch_async(dispatch_get_main_queue(), ^{ - [[MParticle sharedInstance].kitContainer forwardSDKCall:didUpdateUserActivitySelector + [[MParticle sharedInstance].kitContainer_PRIVATE forwardSDKCall:didUpdateUserActivitySelector event:nil parameters:queueParameters messageType:MPMessageTypeUnknown @@ -219,7 +219,7 @@ - (void)userNotificationCenter:(nonnull UNUserNotificationCenter *)center willPr dispatch_async(dispatch_get_main_queue(), ^{ SEL userNotificationCenterWillPresentNotification = @selector(userNotificationCenter:willPresentNotification:); - NSArray> *activeKitsRegistry = [[MParticle sharedInstance].kitContainer activeKitsRegistry]; + NSArray> *activeKitsRegistry = [[MParticle sharedInstance].kitContainer_PRIVATE activeKitsRegistry]; for (id kitRegister in activeKitsRegistry) { if ([kitRegister.wrapperInstance respondsToSelector:userNotificationCenterWillPresentNotification]) { @@ -254,7 +254,7 @@ - (void)userNotificationCenter:(nonnull UNUserNotificationCenter *)center didRec dispatch_async(dispatch_get_main_queue(), ^{ SEL userNotificationCenterDidReceiveNotificationResponse = @selector(userNotificationCenter:didReceiveNotificationResponse:); - NSArray> *activeKitsRegistry = [[MParticle sharedInstance].kitContainer activeKitsRegistry]; + NSArray> *activeKitsRegistry = [[MParticle sharedInstance].kitContainer_PRIVATE activeKitsRegistry]; for (id kitRegister in activeKitsRegistry) { if ([kitRegister.wrapperInstance respondsToSelector:userNotificationCenterDidReceiveNotificationResponse]) { @@ -290,7 +290,7 @@ - (BOOL)continueUserActivity:(nonnull NSUserActivity *)userActivity restorationH [queueParameters addParameter:restorationHandler]; dispatch_async(dispatch_get_main_queue(), ^{ - [[MParticle sharedInstance].kitContainer forwardSDKCall:continueUserActivitySelector + [[MParticle sharedInstance].kitContainer_PRIVATE forwardSDKCall:continueUserActivitySelector event:nil parameters:queueParameters messageType:MPMessageTypeUnknown @@ -325,7 +325,7 @@ - (void)openURL:(NSURL *)url options:(NSDictionary *)options { [queueParameters addParameter:options]; dispatch_async(dispatch_get_main_queue(), ^{ - [[MParticle sharedInstance].kitContainer forwardSDKCall:openURLOptionsSelector + [[MParticle sharedInstance].kitContainer_PRIVATE forwardSDKCall:openURLOptionsSelector event:nil parameters:queueParameters messageType:MPMessageTypeUnknown @@ -352,7 +352,7 @@ - (void)openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication ann [queueParameters addParameter:annotation]; dispatch_async(dispatch_get_main_queue(), ^{ - [[MParticle sharedInstance].kitContainer forwardSDKCall:openURLSourceAppAnnotationSelector + [[MParticle sharedInstance].kitContainer_PRIVATE forwardSDKCall:openURLSourceAppAnnotationSelector event:nil parameters:queueParameters messageType:MPMessageTypeUnknown diff --git a/mParticle-Apple-SDK/Identity/MPIdentityApi.m b/mParticle-Apple-SDK/Identity/MPIdentityApi.m index b02e500c..36a41a00 100644 --- a/mParticle-Apple-SDK/Identity/MPIdentityApi.m +++ b/mParticle-Apple-SDK/Identity/MPIdentityApi.m @@ -244,10 +244,10 @@ - (void)onMPIDChange:(MPIdentityApiRequest *)request httpResponse:(MPIdentityHTT }); } - NSArray *kitConfig = [[MParticle sharedInstance].kitContainer.originalConfig copy]; + NSArray *kitConfig = [[MParticle sharedInstance].kitContainer_PRIVATE.originalConfig copy]; if (kitConfig) { dispatch_async(dispatch_get_main_queue(), ^{ - [[MParticle sharedInstance].kitContainer configureKits:kitConfig]; + [[MParticle sharedInstance].kitContainer_PRIVATE configureKits:kitConfig]; }); } } @@ -256,7 +256,7 @@ - (void)forwardCallToKits:(MPIdentityApiRequest *)request identityRequestType:(M dispatch_async(dispatch_get_main_queue(), ^{ switch (identityRequestType) { case MPIdentityRequestIdentify: { - [[MParticle sharedInstance].kitContainer forwardIdentitySDKCall:@selector(onIdentifyComplete: request:) + [[MParticle sharedInstance].kitContainer_PRIVATE forwardIdentitySDKCall:@selector(onIdentifyComplete: request:) kitHandler:^(id kit, MPKitConfiguration *kitConfig) { FilteredMParticleUser *filteredUser = [[FilteredMParticleUser alloc] initWithMParticleUser:user kitConfiguration:kitConfig]; FilteredMPIdentityApiRequest *filteredRequest = [[FilteredMPIdentityApiRequest alloc] initWithIdentityRequest:request kitConfiguration:kitConfig]; @@ -265,7 +265,7 @@ - (void)forwardCallToKits:(MPIdentityApiRequest *)request identityRequestType:(M break; } case MPIdentityRequestLogin: { - [[MParticle sharedInstance].kitContainer forwardIdentitySDKCall:@selector(onLoginComplete: request:) + [[MParticle sharedInstance].kitContainer_PRIVATE forwardIdentitySDKCall:@selector(onLoginComplete: request:) kitHandler:^(id kit, MPKitConfiguration *kitConfig) { FilteredMParticleUser *filteredUser = [[FilteredMParticleUser alloc] initWithMParticleUser:user kitConfiguration:kitConfig]; FilteredMPIdentityApiRequest *filteredRequest = [[FilteredMPIdentityApiRequest alloc] initWithIdentityRequest:request kitConfiguration:kitConfig]; @@ -274,7 +274,7 @@ - (void)forwardCallToKits:(MPIdentityApiRequest *)request identityRequestType:(M break; } case MPIdentityRequestLogout: { - [[MParticle sharedInstance].kitContainer forwardIdentitySDKCall:@selector(onLogoutComplete: request:) + [[MParticle sharedInstance].kitContainer_PRIVATE forwardIdentitySDKCall:@selector(onLogoutComplete: request:) kitHandler:^(id kit, MPKitConfiguration *kitConfig) { FilteredMParticleUser *filteredUser = [[FilteredMParticleUser alloc] initWithMParticleUser:user kitConfiguration:kitConfig]; FilteredMPIdentityApiRequest *filteredRequest = [[FilteredMPIdentityApiRequest alloc] initWithIdentityRequest:request kitConfiguration:kitConfig]; @@ -283,7 +283,7 @@ - (void)forwardCallToKits:(MPIdentityApiRequest *)request identityRequestType:(M break; } case MPIdentityRequestModify: { - [[MParticle sharedInstance].kitContainer forwardIdentitySDKCall:@selector(onModifyComplete: request:) + [[MParticle sharedInstance].kitContainer_PRIVATE forwardIdentitySDKCall:@selector(onModifyComplete: request:) kitHandler:^(id kit, MPKitConfiguration *kitConfig) { FilteredMParticleUser *filteredUser = [[FilteredMParticleUser alloc] initWithMParticleUser:user kitConfiguration:kitConfig]; FilteredMPIdentityApiRequest *filteredRequest = [[FilteredMPIdentityApiRequest alloc] initWithIdentityRequest:request kitConfiguration:kitConfig]; diff --git a/mParticle-Apple-SDK/Identity/MParticleUser.m b/mParticle-Apple-SDK/Identity/MParticleUser.m index 27b37e8b..378a2ab6 100644 --- a/mParticle-Apple-SDK/Identity/MParticleUser.m +++ b/mParticle-Apple-SDK/Identity/MParticleUser.m @@ -203,7 +203,7 @@ - (BOOL)forwardLegacyUserIdentityToKitContainer:(NSString *)identityString ident MPILogDebug(@"Set user identity: %@", identityString); if (MParticle.sharedInstance.dataPlanFilter == nil || ![MParticle.sharedInstance.dataPlanFilter isBlockedUserIdentityType:(MPIdentity)identityType]) { dispatch_async(dispatch_get_main_queue(), ^{ - [[MParticle sharedInstance].kitContainer forwardSDKCall:@selector(setUserIdentity:identityType:) + [[MParticle sharedInstance].kitContainer_PRIVATE forwardSDKCall:@selector(setUserIdentity:identityType:) userIdentity:identityString identityType:identityType kitHandler:^(id kit, MPKitConfiguration *kitConfig) { @@ -230,7 +230,7 @@ - (nullable NSNumber *)incrementUserAttribute:(NSString *)key byValue:(NSNumber MPILogDebug(@"User attribute %@ incremented by %@. New value: %@", key, value, newValue); if (MParticle.sharedInstance.dataPlanFilter == nil || ![MParticle.sharedInstance.dataPlanFilter isBlockedUserAttributeKey:key]) { dispatch_async(dispatch_get_main_queue(), ^{ - [[MParticle sharedInstance].kitContainer forwardSDKCall:@selector(incrementUserAttribute:byValue:) + [[MParticle sharedInstance].kitContainer_PRIVATE forwardSDKCall:@selector(incrementUserAttribute:byValue:) userAttributeKey:key value:value kitHandler:^(id kit, MPKitConfiguration *kitConfig) { @@ -244,7 +244,7 @@ - (nullable NSNumber *)incrementUserAttribute:(NSString *)key byValue:(NSNumber } }]; - [[MParticle sharedInstance].kitContainer forwardSDKCall:@selector(setUserAttribute:value:) + [[MParticle sharedInstance].kitContainer_PRIVATE forwardSDKCall:@selector(setUserAttribute:value:) userAttributeKey:key value:newValue kitHandler:^(id kit, MPKitConfiguration *kitConfig) { @@ -296,7 +296,7 @@ - (void)setUserAttribute:(nonnull NSString *)key value:(nonnull id)value { if (MParticle.sharedInstance.dataPlanFilter == nil || ![MParticle.sharedInstance.dataPlanFilter isBlockedUserAttributeKey:key]) { dispatch_async(dispatch_get_main_queue(), ^{ // Forwarding calls to kits - [[MParticle sharedInstance].kitContainer forwardSDKCall:@selector(setUserAttribute:value:) + [[MParticle sharedInstance].kitContainer_PRIVATE forwardSDKCall:@selector(setUserAttribute:value:) userAttributeKey:key value:value kitHandler:^(id kit, MPKitConfiguration *kitConfig) { @@ -347,7 +347,7 @@ - (void)setUserAttributeList:(nonnull NSString *)key values:(nonnull NSArray kit, MPKitConfiguration *kitConfig) { @@ -387,7 +387,7 @@ - (void)setUserTag:(nonnull NSString *)tag { if (MParticle.sharedInstance.dataPlanFilter == nil || ![MParticle.sharedInstance.dataPlanFilter isBlockedUserAttributeKey:tag]) { // Forwarding calls to kits dispatch_async(dispatch_get_main_queue(), ^{ - [[MParticle sharedInstance].kitContainer forwardSDKCall:@selector(setUserTag:) + [[MParticle sharedInstance].kitContainer_PRIVATE forwardSDKCall:@selector(setUserTag:) userAttributeKey:tag value:nil kitHandler:^(id kit, MPKitConfiguration *kitConfig) { @@ -425,7 +425,7 @@ - (void)removeUserAttribute:(nonnull NSString *)key { if (MParticle.sharedInstance.dataPlanFilter == nil ||![MParticle.sharedInstance.dataPlanFilter isBlockedUserAttributeKey:key]) { // Forwarding calls to kits dispatch_async(dispatch_get_main_queue(), ^{ - [[MParticle sharedInstance].kitContainer forwardSDKCall:_cmd + [[MParticle sharedInstance].kitContainer_PRIVATE forwardSDKCall:_cmd userAttributeKey:key value:nil kitHandler:^(id kit, MPKitConfiguration *kitConfig) { @@ -451,15 +451,15 @@ - (void)setConsentState:(MPConsentState *)state { [MPPersistenceController setConsentState:state forMpid:self.userId]; - NSArray *kitConfig = [[MParticle sharedInstance].kitContainer.originalConfig copy]; + NSArray *kitConfig = [[MParticle sharedInstance].kitContainer_PRIVATE.originalConfig copy]; if (kitConfig) { dispatch_async(dispatch_get_main_queue(), ^{ - [[MParticle sharedInstance].kitContainer configureKits:kitConfig]; + [[MParticle sharedInstance].kitContainer_PRIVATE configureKits:kitConfig]; }); } dispatch_async(dispatch_get_main_queue(), ^{ - [[MParticle sharedInstance].kitContainer forwardSDKCall:@selector(setConsentState:) consentState:state kitHandler:^(id _Nonnull kit, MPConsentState * _Nullable filteredConsentState, MPKitConfiguration * _Nonnull kitConfiguration) { + [[MParticle sharedInstance].kitContainer_PRIVATE forwardSDKCall:@selector(setConsentState:) consentState:state kitHandler:^(id _Nonnull kit, MPConsentState * _Nullable filteredConsentState, MPKitConfiguration * _Nonnull kitConfiguration) { MPKitExecStatus *status = [kit setConsentState:filteredConsentState]; if (!status.success) { MPILogError(@"Failed to set consent state for kit=%@", status.integrationId); diff --git a/mParticle-Apple-SDK/Include/mParticle.h b/mParticle-Apple-SDK/Include/mParticle.h index 31ecc004..897b4be0 100644 --- a/mParticle-Apple-SDK/Include/mParticle.h +++ b/mParticle-Apple-SDK/Include/mParticle.h @@ -38,7 +38,6 @@ NS_ASSUME_NONNULL_BEGIN @class MPSideloadedKit; -@class MPKitContainer; /** An SDK session. @@ -644,7 +643,7 @@ Defaults to false. Prevents the eventsHost above from overwriting the alias endp /** The instance which manages all initialized kits. For internal use only */ -@property (nonatomic, strong, readonly) MPKitContainer_PRIVATE *kitContainer; +@property (nonatomic, strong, readonly) MPKitContainer_PRIVATE *kitContainer_PRIVATE; /** The Kit Configuration needed should the initialization of kits need to be deferred until identity or consent is resolve. For internal use only diff --git a/mParticle-Apple-SDK/Kits/MPKitAPI.m b/mParticle-Apple-SDK/Kits/MPKitAPI.m index 871b840e..658a0f87 100644 --- a/mParticle-Apple-SDK/Kits/MPKitAPI.m +++ b/mParticle-Apple-SDK/Kits/MPKitAPI.m @@ -97,7 +97,7 @@ - (id)initWithKitCode:(NSNumber *)kitCode { } - (NSDictionary *)integrationAttributes { - NSDictionary *dictionary = [[MParticle sharedInstance].kitContainer integrationAttributesForKit:_kitCode]; + NSDictionary *dictionary = [[MParticle sharedInstance].kitContainer_PRIVATE integrationAttributesForKit:_kitCode]; return dictionary; } @@ -122,20 +122,20 @@ - (void)onAttributionCompleteWithResult:(MPAttributionResult *)result error:(NSE userInfo[MPKitAPIErrorKey] = errorMessage; NSError *attributionError = [NSError errorWithDomain:MPKitAPIErrorDomain code:0 userInfo:userInfo]; - [MParticle sharedInstance].kitContainer.attributionCompletionHandler(nil, attributionError); + [MParticle sharedInstance].kitContainer_PRIVATE.attributionCompletionHandler(nil, attributionError); return; } result.kitCode = _kitCode; result.kitName = [self kitName]; - [MParticle sharedInstance].kitContainer.attributionCompletionHandler(result, nil); + [MParticle sharedInstance].kitContainer_PRIVATE.attributionCompletionHandler(result, nil); } #pragma mark Kit Identity methods - (FilteredMParticleUser *_Nonnull)getCurrentUserWithKit:(id _Nonnull)kit { - return [[FilteredMParticleUser alloc] initWithMParticleUser:[[[MParticle sharedInstance] identity] currentUser] kitConfiguration:[MParticle sharedInstance].kitContainer.kitConfigurations[[[kit class] kitCode]]]; + return [[FilteredMParticleUser alloc] initWithMParticleUser:[[[MParticle sharedInstance] identity] currentUser] kitConfiguration:[MParticle sharedInstance].kitContainer_PRIVATE.kitConfigurations[[[kit class] kitCode]]]; } - (nullable NSNumber *)incrementUserAttribute:(NSString *_Nonnull)key byValue:(NSNumber *_Nonnull)value forUser:(FilteredMParticleUser *_Nonnull)filteredUser { diff --git a/mParticle-Apple-SDK/Kits/MPKitActivity.m b/mParticle-Apple-SDK/Kits/MPKitActivity.m index 1faf71ec..745b6862 100644 --- a/mParticle-Apple-SDK/Kits/MPKitActivity.m +++ b/mParticle-Apple-SDK/Kits/MPKitActivity.m @@ -65,7 +65,7 @@ - (instancetype)init { #pragma mark Private methods - (void)kitInstanceAndConfiguration:(NSNumber *)integrationId handler:(void(^)(id instance, NSDictionary *configuration))handler { NSPredicate *predicate = [NSPredicate predicateWithFormat:@"code == %@", integrationId]; - id kitRegister = [[[[MParticle sharedInstance].kitContainer activeKitsRegistry] filteredArrayUsingPredicate:predicate] firstObject]; + id kitRegister = [[[[MParticle sharedInstance].kitContainer_PRIVATE activeKitsRegistry] filteredArrayUsingPredicate:predicate] firstObject]; id wrapperInstance = kitRegister.wrapperInstance; id kitInstance = [wrapperInstance respondsToSelector:@selector(providerKitInstance)] ? [wrapperInstance providerKitInstance] : nil; @@ -77,7 +77,7 @@ - (void)kitInstanceAndConfiguration:(NSNumber *)integrationId handler:(void(^)(i #pragma mark Public methods - (BOOL)isKitActive:(nonnull NSNumber *)integrationId { NSPredicate *predicate = [NSPredicate predicateWithFormat:@"code == %@", integrationId]; - id kitRegister = [[[[MParticle sharedInstance].kitContainer activeKitsRegistry] filteredArrayUsingPredicate:predicate] firstObject]; + id kitRegister = [[[[MParticle sharedInstance].kitContainer_PRIVATE activeKitsRegistry] filteredArrayUsingPredicate:predicate] firstObject]; return kitRegister != nil; } diff --git a/mParticle-Apple-SDK/MPConstants.swift b/mParticle-Apple-SDK/MPConstants.swift index 16cdad34..142203d3 100644 --- a/mParticle-Apple-SDK/MPConstants.swift +++ b/mParticle-Apple-SDK/MPConstants.swift @@ -154,11 +154,11 @@ struct ConsentFiltering { } struct Notifications { - static let kMPCrashReportOccurredNotification = "MPCrashReportOccurredNotification" - static let kMPConfigureExceptionHandlingNotification = "MPConfigureExceptionHandlingNotification" - static let kMPUserNotificationDictionaryKey = "MPUserNotificationDictionaryKey" - static let kMPUserNotificationActionKey = "MPUserNotificationActionKey" - static let kMPRemoteNotificationDeviceTokenNotification = "MPRemoteNotificationDeviceTokenNotification" - static let kMPRemoteNotificationDeviceTokenKey = "MPRemoteNotificationDeviceTokenKey" - static let kMPRemoteNotificationOldDeviceTokenKey = "MPRemoteNotificationOldDeviceTokenKey" + static let kMPCrashReportOccurredNotification = Notification.Name("MPCrashReportOccurredNotification") + static let kMPConfigureExceptionHandlingNotification = Notification.Name("MPConfigureExceptionHandlingNotification") + static let kMPUserNotificationDictionaryKey = Notification.Name("MPUserNotificationDictionaryKey") + static let kMPUserNotificationActionKey = Notification.Name("MPUserNotificationActionKey") + static let kMPRemoteNotificationDeviceTokenNotification = Notification.Name("MPRemoteNotificationDeviceTokenNotification") + static let kMPRemoteNotificationDeviceTokenKey = Notification.Name("MPRemoteNotificationDeviceTokenKey") + static let kMPRemoteNotificationOldDeviceTokenKey = Notification.Name("MPRemoteNotificationOldDeviceTokenKey") } diff --git a/mParticle-Apple-SDK/Network/MPURLRequestBuilder.m b/mParticle-Apple-SDK/Network/MPURLRequestBuilder.m index 29064c99..9aa91924 100644 --- a/mParticle-Apple-SDK/Network/MPURLRequestBuilder.m +++ b/mParticle-Apple-SDK/Network/MPURLRequestBuilder.m @@ -152,7 +152,7 @@ - (NSMutableURLRequest *)build { if (_SDKURLRequest || isIdentityRequest) { NSString *deviceLocale = [[NSLocale autoupdatingCurrentLocale] localeIdentifier]; - MPKitContainer_PRIVATE *kitContainer = !isIdentityRequest ? [MParticle sharedInstance].kitContainer : nil; + MPKitContainer_PRIVATE *kitContainer = !isIdentityRequest ? [MParticle sharedInstance].kitContainer_PRIVATE : nil; NSArray *supportedKits = [kitContainer supportedKits]; NSString *contentType = nil; NSString *kits = nil; @@ -178,7 +178,7 @@ - (NSMutableURLRequest *)build { kits = nil; } - kits = [MParticle.sharedInstance.kitContainer.configuredKitsRegistry componentsJoinedByString:@","]; + kits = [MParticle.sharedInstance.kitContainer_PRIVATE.configuredKitsRegistry componentsJoinedByString:@","]; range = [_message rangeOfString:kMPMessageTypeNetworkPerformance]; if (range.location != NSNotFound) { diff --git a/mParticle-Apple-SDK/Utils/MPIUserDefaults.m b/mParticle-Apple-SDK/Utils/MPIUserDefaults.m index 508b1327..ba66b876 100644 --- a/mParticle-Apple-SDK/Utils/MPIUserDefaults.m +++ b/mParticle-Apple-SDK/Utils/MPIUserDefaults.m @@ -411,7 +411,7 @@ - (NSString *)currentConfigurationParameters { NSMutableString *supportedKitsString = [NSMutableString string]; NSSortDescriptor* sortOrder = [NSSortDescriptor sortDescriptorWithKey: @"self" ascending: YES]; - NSArray *supportedKits = [[[MParticle sharedInstance].kitContainer supportedKits] sortedArrayUsingDescriptors: [NSArray arrayWithObject: sortOrder]]; + NSArray *supportedKits = [[[MParticle sharedInstance].kitContainer_PRIVATE supportedKits] sortedArrayUsingDescriptors: [NSArray arrayWithObject: sortOrder]]; if (supportedKits != nil) { for (NSNumber *kitID in supportedKits) { [supportedKitsString appendFormat:@"%@\n", kitID]; diff --git a/mParticle-Apple-SDK/Utils/MPResponseConfig.swift b/mParticle-Apple-SDK/Utils/MPResponseConfig.swift index 50f4e15e..789fd265 100644 --- a/mParticle-Apple-SDK/Utils/MPResponseConfig.swift +++ b/mParticle-Apple-SDK/Utils/MPResponseConfig.swift @@ -30,7 +30,7 @@ import Foundation @objc private func setUp(dataReceivedFromServer: Bool) { if let config = self.configuration { - if (dataReceivedFromServer) { + if dataReceivedFromServer { var hasConsentFilters = false if let configKitDictionary = config[RemoteConfig.kMPRemoteConfigKitsKey] as? [[String : Any]] { @@ -60,9 +60,9 @@ import Foundation } let shouldDefer = hasConsentFilters && !hasInitialIdentity - if (!shouldDefer) { + if !shouldDefer { DispatchQueue.main.async { - MParticle.sharedInstance().kitContainer.configureKits(config[RemoteConfig.kMPRemoteConfigKitsKey] as? [[AnyHashable : Any]]) + MParticle.sharedInstance().kitContainer_PRIVATE.configureKits(config[RemoteConfig.kMPRemoteConfigKitsKey] as? [[AnyHashable : Any]]) } } else { MParticle.sharedInstance().deferredKitConfiguration_PRIVATE = config[RemoteConfig.kMPRemoteConfigKitsKey] as? [[AnyHashable : Any]] @@ -81,9 +81,7 @@ import Foundation // Exception handling if let auxString = config[RemoteConfig.kMPRemoteConfigExceptionHandlingModeKey] as? String { stateMachine.exceptionHandlingMode = auxString - - let exceptionHandlingNotification = Notification(name: Notification.Name(Notifications.kMPConfigureExceptionHandlingNotification)) - NotificationCenter.default.post(exceptionHandlingNotification) + NotificationCenter.default.post(Notification(name: Notifications.kMPConfigureExceptionHandlingNotification)) } // Crash size limiting @@ -117,8 +115,8 @@ import Foundation #if !MPARTICLE_LOCATION_DISABLE if locationMode == RemoteConfig.kMPRemoteConfigForceTrue { - if let accurary = locationDictionary[RemoteConfig.kMPRemoteConfigLocationAccuracyKey] as? NSNumber, let minimumDistance = locationDictionary[RemoteConfig.kMPRemoteConfigLocationMinimumDistanceKey] as? NSNumber { - MParticle.sharedInstance().beginLocationTracking(accurary.doubleValue, minDistance: minimumDistance.doubleValue, authorizationRequest: MPLocationAuthorizationRequest.always) + if let accuracy = locationDictionary[RemoteConfig.kMPRemoteConfigLocationAccuracyKey] as? NSNumber, let minimumDistance = locationDictionary[RemoteConfig.kMPRemoteConfigLocationMinimumDistanceKey] as? NSNumber { + MParticle.sharedInstance().beginLocationTracking(accuracy.doubleValue, minDistance: minimumDistance.doubleValue, authorizationRequest: MPLocationAuthorizationRequest.always) } } else if locationMode == RemoteConfig.kMPRemoteConfigForceFalse { MParticle.sharedInstance().endLocationTracking()