2018-02-27 16:10:30 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-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 "RCTFabricUIManagerWrapper.h"
|
|
|
|
|
2018-03-19 06:49:52 +00:00
|
|
|
#include <React/RCTCxxExceptionManager.h>
|
2018-04-10 19:46:15 +00:00
|
|
|
#include <fabric/uimanager/ComponentDescriptorRegistry.h>
|
2018-03-19 02:04:30 +00:00
|
|
|
#include <fabric/uimanager/FabricUIManager.h>
|
2018-04-10 19:46:15 +00:00
|
|
|
#include <fabric/view/ViewComponentDescriptor.h>
|
2018-03-19 02:04:30 +00:00
|
|
|
#include <folly/dynamic.h>
|
|
|
|
#include <folly/json.h>
|
|
|
|
|
2018-03-08 00:40:38 +00:00
|
|
|
#import "RCTFabricPlatformUIOperationManager.h"
|
|
|
|
|
2018-02-27 16:10:30 +00:00
|
|
|
// This file contains experimental placeholders, nothing is finalized.
|
|
|
|
@implementation RCTFabricUIManagerWrapper
|
|
|
|
{
|
|
|
|
std::shared_ptr<FabricUIManager> _manager;
|
2018-03-19 06:49:52 +00:00
|
|
|
std::shared_ptr<ExceptionManager> _exceptionManager;
|
2018-03-08 00:40:38 +00:00
|
|
|
std::shared_ptr<IFabricPlatformUIOperationManager> _platformUIOperationManager;
|
2018-02-27 16:10:30 +00:00
|
|
|
}
|
|
|
|
|
2018-03-08 00:40:38 +00:00
|
|
|
- (instancetype)init
|
2018-02-27 16:10:30 +00:00
|
|
|
{
|
|
|
|
self = [super init];
|
|
|
|
if (self) {
|
2018-03-19 06:49:52 +00:00
|
|
|
_exceptionManager = std::make_shared<RCTCxxExceptionManager>();
|
2018-03-08 00:40:38 +00:00
|
|
|
_platformUIOperationManager = std::make_shared<RCTFabricPlatformUIOperationManagerConnector>();
|
2018-04-10 19:46:15 +00:00
|
|
|
|
|
|
|
auto componentDescriptorRegistry = std::make_shared<ComponentDescriptorRegistry>();
|
|
|
|
SharedComponentDescriptor viewComponentDescriptor = std::make_shared<ViewComponentDescriptor>();
|
|
|
|
componentDescriptorRegistry->registerComponentDescriptor(viewComponentDescriptor);
|
|
|
|
|
|
|
|
_manager = std::make_shared<FabricUIManager>(componentDescriptorRegistry);
|
2018-02-27 16:10:30 +00:00
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (std::shared_ptr<FabricUIManager>)manager
|
|
|
|
{
|
|
|
|
return _manager;
|
|
|
|
}
|
|
|
|
|
2018-03-19 06:49:52 +00:00
|
|
|
- (std::shared_ptr<ExceptionManager>)exceptionManager
|
|
|
|
{
|
|
|
|
return _exceptionManager;
|
|
|
|
}
|
|
|
|
|
2018-02-27 16:10:30 +00:00
|
|
|
- (void)invalidate
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation RCTBridge (RCTFabricUIManagerWrapper)
|
|
|
|
|
|
|
|
- (std::shared_ptr<FabricUIManager>)fabricUIManager
|
|
|
|
{
|
|
|
|
RCTFabricUIManagerWrapper *wrapper = [self jsBoundExtraModuleForClass:[RCTFabricUIManagerWrapper class]];
|
|
|
|
if (wrapper) {
|
|
|
|
return [wrapper manager];
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|