Fixe the iOS UserDefaultsPlugin (#340)

Summary:
The `getAllSharedPreferences` API is not implemented in the iOS UserDefaultsPlugin and thus the data is not shown in the `Shared Preference Viewer`.

This PR implements the missing API and present the Standard UserDefaults data from the target application.
Pull Request resolved: https://github.com/facebook/flipper/pull/340

Reviewed By: danielbuechele

Differential Revision: D13464765

Pulled By: priteshrnandgaonkar

fbshipit-source-id: 8c6cf4e9f7094fcf75c71cce43cb6c34f9f957e7
This commit is contained in:
Qichuan
2018-12-17 09:54:03 -08:00
committed by Facebook Github Bot
parent cc5fba6975
commit d7ecd3af5a

View File

@@ -40,6 +40,13 @@
- (void)didConnect:(id<FlipperConnection>)connection {
self.flipperConnection = connection;
[connection receive:@"getAllSharedPreferences" withBlock:^(NSDictionary *params, id<FlipperResponder> responder) {
NSDictionary *userDefaults = @{
@"Standard UserDefaults": [self.userDefaults dictionaryRepresentation]
};
[responder success: userDefaults];
}];
[connection receive:@"getSharedPreferences" withBlock:^(NSDictionary *params, id<FlipperResponder> responder) {
[responder success:[self.userDefaults dictionaryRepresentation]];
}];
@@ -73,7 +80,7 @@
} else {
[params setObject:value forKey:@"value"];
}
[params setObject:@"Standard UserDefaults" forKey:@"preferences"];
[self.flipperConnection send:@"sharedPreferencesChange" withParams:[params copy]];
}