From e848f2a8d436fc26375978f239bb48e071c400e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Biesiada?= Date: Fri, 1 May 2020 20:23:04 +0200 Subject: [PATCH] Publish filenames used for data storage (#865) --- .../Classes/Integrations/SEGIntegrationsManager.h | 6 ++++++ .../Classes/Integrations/SEGIntegrationsManager.m | 14 +++++++------- Analytics/Classes/Internal/SEGSegmentIntegration.h | 7 +++++++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Analytics/Classes/Integrations/SEGIntegrationsManager.h b/Analytics/Classes/Integrations/SEGIntegrationsManager.h index bbd0e24ba..ec17275cb 100644 --- a/Analytics/Classes/Integrations/SEGIntegrationsManager.h +++ b/Analytics/Classes/Integrations/SEGIntegrationsManager.h @@ -9,6 +9,12 @@ #import #import "SEGMiddleware.h" +/** + * Filenames of "Application Support" files where essential data is stored. + */ +extern NSString *_Nonnull const kSEGAnonymousIdFilename; +extern NSString *_Nonnull const kSEGCachedSettingsFilename; + /** * NSNotification name, that is posted after integrations are loaded. */ diff --git a/Analytics/Classes/Integrations/SEGIntegrationsManager.m b/Analytics/Classes/Integrations/SEGIntegrationsManager.m index 7fdd46340..07399aa58 100644 --- a/Analytics/Classes/Integrations/SEGIntegrationsManager.m +++ b/Analytics/Classes/Integrations/SEGIntegrationsManager.m @@ -26,9 +26,9 @@ #import "SEGAliasPayload.h" NSString *SEGAnalyticsIntegrationDidStart = @"io.segment.analytics.integration.did.start"; -static NSString *const SEGAnonymousIdKey = @"SEGAnonymousId"; -static NSString *const kSEGAnonymousIdFilename = @"segment.anonymousId"; -static NSString *const SEGCachedSettingsKey = @"analytics.settings.v2.plist"; +NSString *const SEGAnonymousIdKey = @"SEGAnonymousId"; +NSString *const kSEGAnonymousIdFilename = @"segment.anonymousId"; +NSString *const kSEGCachedSettingsFilename = @"analytics.settings.v2.plist"; @interface SEGIdentifyPayload (AnonymousId) @@ -357,9 +357,9 @@ - (NSDictionary *)cachedSettings { if (!_cachedSettings) { #if TARGET_OS_TV - _cachedSettings = [self.userDefaultsStorage dictionaryForKey:SEGCachedSettingsKey] ?: @{}; + _cachedSettings = [self.userDefaultsStorage dictionaryForKey:kSEGCachedSettingsFilename] ?: @{}; #else - _cachedSettings = [self.fileStorage dictionaryForKey:SEGCachedSettingsKey] ?: @{}; + _cachedSettings = [self.fileStorage dictionaryForKey:kSEGCachedSettingsFilename] ?: @{}; #endif } @@ -375,9 +375,9 @@ - (void)setCachedSettings:(NSDictionary *)settings } #if TARGET_OS_TV - [self.userDefaultsStorage setDictionary:_cachedSettings forKey:SEGCachedSettingsKey]; + [self.userDefaultsStorage setDictionary:_cachedSettings forKey:kSEGCachedSettingsFilename]; #else - [self.fileStorage setDictionary:_cachedSettings forKey:SEGCachedSettingsKey]; + [self.fileStorage setDictionary:_cachedSettings forKey:kSEGCachedSettingsFilename]; #endif [self updateIntegrationsWithSettings:settings[@"integrations"]]; diff --git a/Analytics/Classes/Internal/SEGSegmentIntegration.h b/Analytics/Classes/Internal/SEGSegmentIntegration.h index 63942277c..c32e01d70 100644 --- a/Analytics/Classes/Internal/SEGSegmentIntegration.h +++ b/Analytics/Classes/Internal/SEGSegmentIntegration.h @@ -9,6 +9,13 @@ extern NSString *const SEGSegmentDidSendRequestNotification; extern NSString *const SEGSegmentRequestDidSucceedNotification; extern NSString *const SEGSegmentRequestDidFailNotification; +/** + * Filenames of "Application Support" files where essential data is stored. + */ +extern NSString *const kSEGUserIdFilename; +extern NSString *const kSEGQueueFilename; +extern NSString *const kSEGTraitsFilename; + @interface SEGSegmentIntegration : NSObject