Respond to CR.

pull/1/head
Matthew Chen 7 years ago
parent a9aabf763a
commit 1a53005e08

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

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

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

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

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

Loading…
Cancel
Save