Summary: I have a few details left, but its almost done. This PR addresses #145 - The NSUserDefaults plugin uses the SharedPreferences Desktop Part since we can reuse all of it. - The NSUserDefaults plugin uses swizzling in order to be notified of what specific event changed at runtime. - Added Test harness in both Sample Swift and Sample apps for iOS in order to test the plugin. - Updated the documentation in `docs/shared-preferences-plugin.md` and` README.md` I am open to suggestions since the desktop sharedPreferences version doesn't support deletion of preferences. Most likely I would have to modify the UI, and for that matter, I might as well build a user defaults desktop version I wanted to add xiphirx in this MR since he developed the shared preferences plugin for Android and Desktop. I don't see a way to remove preferences from the flipper desktop app so I was wondering if you would be OK with me adding that. Pull Request resolved: https://github.com/facebook/flipper/pull/291 Reviewed By: passy Differential Revision: D10334685 Pulled By: priteshrnandgaonkar fbshipit-source-id: d798c01a46df7ddecf713924799f046b560ea922
59 lines
2.4 KiB
Plaintext
59 lines
2.4 KiB
Plaintext
/*
|
|
* Copyright (c) 2018-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the LICENSE
|
|
* file in the root directory of this source tree.
|
|
*
|
|
*/
|
|
#import "AppDelegate.h"
|
|
|
|
#import <FlipperKit/FlipperClient.h>
|
|
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
|
|
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
|
|
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
|
|
#import <FlipperKitLayoutComponentKitSupport/FlipperKitLayoutComponentKitSupport.h>
|
|
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
|
|
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
|
|
|
|
#import "MainViewController.h"
|
|
#import "RootViewController.h"
|
|
|
|
#if !FB_SONARKIT_ENABLED
|
|
#error "Sample need to be run with SonarKit enabled in order to properly interact with Sonar. SonarKit is enabled by default if its a debug build."
|
|
#endif
|
|
|
|
@implementation AppDelegate {
|
|
UIWindow *_window;
|
|
}
|
|
|
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
{
|
|
_window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
|
FlipperClient *client = [FlipperClient sharedClient];
|
|
|
|
SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
|
|
[FlipperKitLayoutComponentKitSupport setUpWithDescriptorMapper: layoutDescriptorMapper];
|
|
[client addPlugin: [[FlipperKitLayoutPlugin alloc] initWithRootNode: application
|
|
withDescriptorMapper: layoutDescriptorMapper]];
|
|
|
|
[client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
|
|
|
|
[[FlipperClient sharedClient] addPlugin: [[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
|
|
[client start];
|
|
|
|
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryBoard" bundle:nil];
|
|
MainViewController *mainViewController = [storyboard instantiateViewControllerWithIdentifier:@"MainViewController"];
|
|
|
|
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController: mainViewController];
|
|
navigationController.navigationBar.topItem.title = @"Sample";
|
|
navigationController.navigationBar.translucent = NO;
|
|
|
|
[_window setRootViewController: [[UINavigationController alloc] initWithRootViewController: mainViewController]];
|
|
[_window makeKeyAndVisible];
|
|
|
|
NSLog(@"Hello from Flipper in an Objc app!");
|
|
return YES;
|
|
}
|
|
|
|
@end
|