Skip to content

Commit

Permalink
fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
mrousavy committed Jun 20, 2024
1 parent 84b995e commit caf953f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 20 deletions.
2 changes: 1 addition & 1 deletion example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 5 additions & 8 deletions packages/react-native-nitro-modules/cpp/core/HybridObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "HybridObject.hpp"
#include "JSIConverter.hpp"
#include "Logger.hpp"
#include "NitroLogger.hpp"

namespace margelo {

Expand Down Expand Up @@ -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<jsi::Function>(std::move(function));
return jsi::Value(runtime, *functionCache[name]);
}

Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//

#include "PromiseFactory.hpp"
#include "Logger.hpp"
#include "threading/Dispatcher.hpp"
#include "NitroLogger.hpp"
#include "Dispatcher.hpp"

namespace margelo {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Dispatcher.hpp"
#include "Logger.hpp"
#include "NitroLogger.hpp"

namespace margelo {

Expand Down
9 changes: 2 additions & 7 deletions packages/react-native-nitro-modules/cpp/utils/NitroLogger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include <iostream>
#include <string>
#include <format>

namespace margelo {

Expand All @@ -16,12 +15,8 @@ class Logger {

public:
template <typename... Args> inline static void log(const std::string& tag, const std::string& message, Args&&... args) {
try {
std::string formattedMessage = std::format(message, std::forward<decltype(args)>(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;
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}

Expand Down

0 comments on commit caf953f

Please sign in to comment.