Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish filenames used for data storage #865

Merged
merged 1 commit into from
May 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Analytics/Classes/Integrations/SEGIntegrationsManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
#import <Foundation/Foundation.h>
#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.
*/
Expand Down
14 changes: 7 additions & 7 deletions Analytics/Classes/Integrations/SEGIntegrationsManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also changed this const name in order to follow the convention established by other filenames/constants whin the project.



@interface SEGAnalyticsConfiguration (Private)
Expand Down Expand Up @@ -331,9 +331,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
}

Expand All @@ -349,9 +349,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"]];
Expand Down
7 changes: 7 additions & 0 deletions Analytics/Classes/Internal/SEGSegmentIntegration.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <SEGIntegration>

Expand Down