@@ -58,27 +58,23 @@ static bool checkGetCallableModuleIsActive(jsi::Runtime &runtime) {
58
58
return true ;
59
59
}
60
60
61
- std::shared_ptr<UIManagerBinding> UIManagerBinding::createAndInstallIfNeeded (
61
+ void UIManagerBinding::createAndInstallIfNeeded (
62
62
jsi::Runtime &runtime,
63
- RuntimeExecutor const &runtimeExecutor) {
63
+ RuntimeExecutor const &runtimeExecutor,
64
+ std::shared_ptr<UIManager> const &uiManager) {
64
65
auto uiManagerModuleName = " nativeFabricUIManager" ;
65
66
66
67
auto uiManagerValue =
67
68
runtime.global ().getProperty (runtime, uiManagerModuleName);
68
69
if (uiManagerValue.isUndefined ()) {
69
70
// The global namespace does not have an instance of the binding;
70
71
// we need to create, install and return it.
71
- auto uiManagerBinding = std::make_shared<UIManagerBinding>(runtimeExecutor);
72
+ auto uiManagerBinding =
73
+ std::make_shared<UIManagerBinding>(uiManager, runtimeExecutor);
72
74
auto object = jsi::Object::createFromHostObject (runtime, uiManagerBinding);
73
75
runtime.global ().setProperty (
74
76
runtime, uiManagerModuleName, std::move (object));
75
- return uiManagerBinding;
76
77
}
77
-
78
- // The global namespace already has an instance of the binding;
79
- // we need to return that.
80
- auto uiManagerObject = uiManagerValue.asObject (runtime);
81
- return uiManagerObject.getHostObject <UIManagerBinding>(runtime);
82
78
}
83
79
84
80
std::shared_ptr<UIManagerBinding> UIManagerBinding::getBinding (
@@ -95,18 +91,16 @@ std::shared_ptr<UIManagerBinding> UIManagerBinding::getBinding(
95
91
return uiManagerObject.getHostObject <UIManagerBinding>(runtime);
96
92
}
97
93
98
- UIManagerBinding::UIManagerBinding (RuntimeExecutor const &runtimeExecutor)
99
- : runtimeExecutor_(runtimeExecutor) {}
94
+ UIManagerBinding::UIManagerBinding (
95
+ std::shared_ptr<UIManager> const &uiManager,
96
+ RuntimeExecutor const &runtimeExecutor)
97
+ : uiManager_(uiManager), runtimeExecutor_(runtimeExecutor) {}
100
98
101
99
UIManagerBinding::~UIManagerBinding () {
102
100
LOG (WARNING) << " UIManagerBinding::~UIManagerBinding() was called (address: "
103
101
<< this << " )." ;
104
102
}
105
103
106
- void UIManagerBinding::attach (std::shared_ptr<UIManager> const &uiManager) {
107
- uiManager_ = uiManager;
108
- }
109
-
110
104
static jsi::Value callMethodOfModule (
111
105
jsi::Runtime &runtime,
112
106
std::string const &moduleName,
0 commit comments