mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
930 B
Matlab
38 lines
930 B
Matlab
8 years ago
|
//
|
||
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import "NSUserDefaults+OWS.h"
|
||
|
|
||
|
NS_ASSUME_NONNULL_BEGIN
|
||
|
|
||
|
@implementation NSUserDefaults (OWS)
|
||
|
|
||
|
+ (NSUserDefaults *)appUserDefaults
|
||
|
{
|
||
|
return [[NSUserDefaults alloc] initWithSuiteName:@"group.org.whispersystems.signal.group"];
|
||
|
}
|
||
|
|
||
|
+ (void)migrateToSharedUserDefaults
|
||
|
{
|
||
|
NSUserDefaults *appUserDefaults = self.appUserDefaults;
|
||
|
|
||
|
NSDictionary<NSString *, id> *dictionary = [NSUserDefaults standardUserDefaults].dictionaryRepresentation;
|
||
|
for (NSString *key in dictionary) {
|
||
|
id value = dictionary[key];
|
||
|
OWSAssert(value);
|
||
|
[appUserDefaults setObject:value forKey:key];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
+ (void)removeAll
|
||
|
{
|
||
|
NSString *appDomain = NSBundle.mainBundle.bundleIdentifier;
|
||
|
[NSUserDefaults.standardUserDefaults removePersistentDomainForName:appDomain];
|
||
|
// TODO: How to clear the shared user defaults?
|
||
|
}
|
||
|
|
||
|
@end
|
||
|
|
||
|
NS_ASSUME_NONNULL_END
|