Add support for deleting a shared preference (#1018)
Summary: This change makes it possible to remove preferences. I also added a `Delete` context menu option to `DataInspector` because I needed it to implement this feature. passy confirmed that it makes sense to add this because delete is a common action. Fixes https://github.com/facebook/flipper/issues/451 Pull Request resolved: https://github.com/facebook/flipper/pull/1018 Reviewed By: jknoxville Differential Revision: D21086308 Pulled By: passy fbshipit-source-id: 551ff0908d5e6c93f58d6012b42e1ee3531de997
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9b8974eeb3
commit
2d1870cf7d
@@ -82,6 +82,15 @@ static NSString* const kAppSuiteUserDefaultsName = @"App Suite UserDefaults";
|
||||
forKey:preferenceName];
|
||||
[responder success:[sharedPreferences dictionaryRepresentation]];
|
||||
}];
|
||||
|
||||
[connection receive:@"deleteSharedPreference"
|
||||
withBlock:^(NSDictionary* params, id<FlipperResponder> responder) {
|
||||
NSUserDefaults* sharedPreferences =
|
||||
[self sharedPreferencesForParams:params];
|
||||
NSString* preferenceName = params[@"preferenceName"];
|
||||
[sharedPreferences removeObjectForKey:preferenceName];
|
||||
[responder success:[sharedPreferences dictionaryRepresentation]];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)didDisconnect {
|
||||
|
||||
Reference in New Issue
Block a user