From a888a7448921a531e8b9281a8ac6d4d07d63e5a5 Mon Sep 17 00:00:00 2001 From: Brandon Stalnaker Date: Mon, 30 Sep 2024 12:18:08 -0400 Subject: [PATCH] feat: Support workspace switching --- Sources/mParticle-Appboy/MPKitAppboy.m | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Sources/mParticle-Appboy/MPKitAppboy.m b/Sources/mParticle-Appboy/MPKitAppboy.m index 5b89d70..bc9dbd3 100644 --- a/Sources/mParticle-Appboy/MPKitAppboy.m +++ b/Sources/mParticle-Appboy/MPKitAppboy.m @@ -191,7 +191,7 @@ - (MPKitExecStatus *)logAppboyCustomEvent:(MPEvent *)event eventType:(NSUInteger if (self->_enableTypeDetection) { detectedEventInfo = [self simplifiedDictionary:eventInfo]; } - + // Appboy expects that the properties are non empty when present. if (detectedEventInfo && detectedEventInfo.count > 0) { [self->appboyInstance logCustomEvent:event.name properties:detectedEventInfo]; @@ -315,7 +315,7 @@ - (MPKitExecStatus *)didFinishLaunchingWithConfiguration:(NSDictionary *)configu } _configuration = configuration; - + collectIDFA = NO; forwardScreenViews = NO; @@ -356,7 +356,7 @@ - (void)start { NSNumber *flushIntervalOption = (NSNumber *)optionsDict[ABKFlushIntervalOptionKey] ?: @10; // If not set, use the default 10 seconds specified in Braze SDK header configuration.api.flushInterval = flushIntervalOption.doubleValue < 1.0 ? 1.0 : flushIntervalOption.doubleValue; // Ensure value is above the minimum of 1.0 per run time warning from Braze SDK configuration.api.trackingPropertyAllowList = brazeTrackingPropertyAllowList; - + configuration.sessionTimeout = ((NSNumber *)optionsDict[ABKSessionTimeoutKey]).doubleValue; configuration.triggerMinimumTimeInterval = ((NSNumber *)optionsDict[ABKMinimumTriggerTimeIntervalKey]).doubleValue; @@ -366,7 +366,7 @@ - (void)start { configuration.location.automaticLocationCollection = YES; configuration.location.brazeLocationProvider = brazeLocationProvider; } - + self->appboyInstance = [[Braze alloc] initWithConfiguration:configuration]; } @@ -407,6 +407,12 @@ - (void)start { }); } +- (void)stop { + self->appboyInstance = nil; + _started = NO; + _configuration = nil; +} + - (NSMutableDictionary *)optionsDictionary { NSArray *serverKeys = @[@"ABKRequestProcessingPolicyOptionKey", @"ABKFlushIntervalOptionKey", @"ABKSessionTimeoutKey", @"ABKMinimumTriggerTimeIntervalKey"]; NSArray *appboyKeys = @[ABKRequestProcessingPolicyOptionKey, ABKFlushIntervalOptionKey, ABKSessionTimeoutKey, ABKMinimumTriggerTimeIntervalKey];