Respond to CR.

This commit is contained in:
Matthew Chen 2018-10-22 14:43:07 -04:00
parent a9aabf763a
commit 1a53005e08
5 changed files with 15 additions and 6 deletions

View File

@ -293,6 +293,11 @@ NS_ASSUME_NONNULL_BEGIN
return [groupContainerDirectoryURL path];
}
- (NSUserDefaults *)appUserDefaults
{
return [[NSUserDefaults alloc] initWithSuiteName:SignalApplicationGroup];
}
@end
NS_ASSUME_NONNULL_END

View File

@ -15,6 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic) SSKTestKeychainStorage *testKeychainStorage;
@property (nonatomic) NSString *mockAppDocumentDirectoryPath;
@property (nonatomic) NSString *mockAppSharedDataDirectoryPath;
@property (nonatomic) NSUserDefaults *appUserDefaults;
@end
@ -37,7 +38,7 @@ NS_ASSUME_NONNULL_BEGIN
NSString *temporaryDirectory = OWSTemporaryDirectory();
self.mockAppDocumentDirectoryPath = [temporaryDirectory stringByAppendingPathComponent:NSUUID.UUID.UUIDString];
self.mockAppSharedDataDirectoryPath = [temporaryDirectory stringByAppendingPathComponent:NSUUID.UUID.UUIDString];
self.appUserDefaults = [[NSUserDefaults alloc] init];
_appLaunchTime = [NSDate new];
return self;

View File

@ -100,6 +100,8 @@ NSString *NSStringForUIApplicationState(UIApplicationState value);
- (NSString *)appSharedDataDirectoryPath;
- (NSUserDefaults *)appUserDefaults;
@end
id<AppContext> CurrentAppContext(void);

View File

@ -12,11 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (NSUserDefaults *)appUserDefaults
{
if (CurrentAppContext().isRunningTests) {
return [[NSUserDefaults alloc] init];
}
return [[NSUserDefaults alloc] initWithSuiteName:SignalApplicationGroup];
return CurrentAppContext().appUserDefaults;
}
+ (void)migrateToSharedUserDefaults

View File

@ -229,6 +229,11 @@ NS_ASSUME_NONNULL_BEGIN
return [groupContainerDirectoryURL path];
}
- (NSUserDefaults *)appUserDefaults
{
return [[NSUserDefaults alloc] initWithSuiteName:SignalApplicationGroup];
}
@end
NS_ASSUME_NONNULL_END