diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index bf137bca7..4e1132143 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1440,7 +1440,7 @@ SPEC CHECKSUMS: React-jsitracing: 0fa7f78d8fdda794667cb2e6f19c874c1cf31d7e React-logger: 29fa3e048f5f67fe396bc08af7606426d9bd7b5d React-Mapbuffer: bf56147c9775491e53122a94c423ac201417e326 - react-native-nitro-modules: 9f30e849db461f046b881701efcebd3c2d44f6aa + react-native-nitro-modules: b2cadf900494204c5a5fd106c7e7a4c0fe288545 React-nativeconfig: 9f223cd321823afdecf59ed00861ab2d69ee0fc1 React-NativeModulesApple: ff7efaff7098639db5631236cfd91d60abff04c0 React-perflogger: 32ed45d9cee02cf6639acae34251590dccd30994 diff --git a/packages/react-native-nitro-modules/cpp/core/HybridObject.cpp b/packages/react-native-nitro-modules/cpp/core/HybridObject.cpp index 9fe737e7f..db44065c6 100644 --- a/packages/react-native-nitro-modules/cpp/core/HybridObject.cpp +++ b/packages/react-native-nitro-modules/cpp/core/HybridObject.cpp @@ -4,7 +4,7 @@ #include "HybridObject.hpp" #include "JSIConverter.hpp" -#include "Logger.hpp" +#include "NitroLogger.hpp" namespace margelo { @@ -89,8 +89,8 @@ jsi::Value HybridObject::get(facebook::jsi::Runtime& runtime, const facebook::js HybridFunction& hybridFunction = _methods.at(name); jsi::Function function = jsi::Function::createFromHostFunction(runtime, jsi::PropNameID::forUtf8(runtime, name), hybridFunction.parameterCount, hybridFunction.function); - - functionCache[name] = JSIHelper::createSharedJsiFunction(runtime, std::move(function)); + // TODO: Weakify function using RuntimeWatch so the Runtime safely manages it's lifetime, not us. + functionCache[name] = std::make_shared(std::move(function)); return jsi::Value(runtime, *functionCache[name]); } @@ -132,11 +132,8 @@ void HybridObject::ensureInitialized(facebook::jsi::Runtime& runtime) { } bool HybridObject::isRuntimeAlive() { - if (_creationRuntime == nullptr) { - [[unlikely]]; - return false; - } - return WorkletRuntimeRegistry::isRuntimeAlive(_creationRuntime); + // TODO: Fix this. We shouldn't do this. This is a bad idea. + return true; } } // namespace margelo diff --git a/packages/react-native-nitro-modules/cpp/core/PromiseFactory.cpp b/packages/react-native-nitro-modules/cpp/core/PromiseFactory.cpp index 58bf99434..c8e7c1f86 100644 --- a/packages/react-native-nitro-modules/cpp/core/PromiseFactory.cpp +++ b/packages/react-native-nitro-modules/cpp/core/PromiseFactory.cpp @@ -6,8 +6,8 @@ // #include "PromiseFactory.hpp" -#include "Logger.hpp" -#include "threading/Dispatcher.hpp" +#include "NitroLogger.hpp" +#include "Dispatcher.hpp" namespace margelo { diff --git a/packages/react-native-nitro-modules/cpp/threading/Dispatcher.cpp b/packages/react-native-nitro-modules/cpp/threading/Dispatcher.cpp index 8445ff1b1..1649f4502 100644 --- a/packages/react-native-nitro-modules/cpp/threading/Dispatcher.cpp +++ b/packages/react-native-nitro-modules/cpp/threading/Dispatcher.cpp @@ -1,5 +1,5 @@ #include "Dispatcher.hpp" -#include "Logger.hpp" +#include "NitroLogger.hpp" namespace margelo { diff --git a/packages/react-native-nitro-modules/cpp/utils/NitroLogger.hpp b/packages/react-native-nitro-modules/cpp/utils/NitroLogger.hpp index 5b3fb217c..888b2dfad 100644 --- a/packages/react-native-nitro-modules/cpp/utils/NitroLogger.hpp +++ b/packages/react-native-nitro-modules/cpp/utils/NitroLogger.hpp @@ -6,7 +6,6 @@ #include #include -#include namespace margelo { @@ -16,12 +15,8 @@ class Logger { public: template inline static void log(const std::string& tag, const std::string& message, Args&&... args) { - try { - std::string formattedMessage = std::format(message, std::forward(args)...); - std::cout << "[" << tag << "] " << formattedMessage << std::endl; - } catch (const std::format_error& e) { - std::cerr << "Formatting error: " << e.what() << std::endl; - } + // TODO: Allow formatting args into message so they get printed as well. + std::cout << "[" << tag << "] " << message << std::endl; } }; diff --git a/packages/react-native-nitro-modules/react-native-nitro-modules.podspec b/packages/react-native-nitro-modules/react-native-nitro-modules.podspec index b9fe75612..1ba73310f 100644 --- a/packages/react-native-nitro-modules/react-native-nitro-modules.podspec +++ b/packages/react-native-nitro-modules/react-native-nitro-modules.podspec @@ -36,8 +36,8 @@ Pod::Spec.new do |s| ss.dependency "react-native-nitro-modules/C++-Bindings" end - # Enables C++ <-> Swift interop (by default it's only C) s.pod_target_xcconfig = { + # Enables C++ <-> Swift interop (by default it's only C) "SWIFT_OBJC_INTEROP_MODE" => "objcxx", }