Commit Graph
58 Commits
Author SHA1 Message Date
Marc RousavyandGitHub 584e38b7c7 feat: Allow using Error as type (#376)
* feat: Allow using `Error` as type

* feat: Add `throwError(error)` func to test object

* feat: Test `throwError(error)`

* Update getTests.ts

* fix: Fix bridging `std::exception_ptr` to Swift `Error`

* fix: Fix `__rejecter` still using `std.exception_ptr`

* fix: Fix Java `JThrowable` conversion

* fix: Update error message

* fix: Fix `__ndk1` prefix on Android

* fix: Make `reject` just forward to `exception_ptr`
2024-11-29 15:57:22 +01:00
Marc RousavyandGitHub b069fb69a8 fix: Fix Promise rejections not having a message by using std::exception_ptr to avoid C++ object slicing (#369)
* fix: Use `std::exception_ptr` to preserve message

* fix: Catch exception

* fix: Fix `JSIConverter`

* Update AssertPromiseState.hpp

* Ok kinda fix?

* ugh

* fix again

* Update JSIConverter+Promise.hpp

* chore: Rename `_result` to `_state`

* feat: Allow comparing message

* fix: Fix `RuntimeError.description`

* feat: Test all of those error messages as well
2024-11-22 21:14:00 +01:00
Marc RousavyandGitHub 0747e099b7 fix: Fix ref counting with recursive mutex (#368)
* fix: Fix ref counting with recursive mutex

* Xcode
2024-11-22 19:42:38 +01:00
Marc RousavyandGitHub ed24de61f0 fix: Catch cases where a Promise<T> could potentially be rseolved twice (#362)
* fix: Catch cases where a `Promise<T>` could potentially be rseolved twice

* Update AssertPromiseState.hpp
2024-11-20 22:08:58 +01:00
Marc RousavyandGitHub 7afac07a83 fix: Fix NONNULL function pointers (#250)
* fix: Fix `NONNULL` function pointers

* Revert "fix: Fix `NONNULL` function pointers"

This reverts commit 5a3acb46d0.

* fix: Replace `NONNULL` with `_Nonnull` compiler keyword

* fix: Format
2024-10-22 11:52:03 +02:00
Marc RousavyandGitHub 6803be8cd9 fix: Add _Nonnull modifier to void* types for Swift (#231) 2024-10-15 20:39:45 +02:00
Marc RousavyandGitHub 2f24d281ad feat: Prettify Prototype names (#229)
* feat: Prettify Prototype names

* perf: Make it fast in release as well.

* Update TypeInfo.hpp

* fix: Remove unnecessary method now

* perf: Make namespace removal `::` faster

* Update TypeInfo.hpp
2024-10-15 19:48:34 +02:00
Marc Rousavy 89a5995dd9 fix: Explicitly check against NDEBUG on Android 2024-09-17 15:14:58 +02:00
Marc RousavyandGitHub 03e1a716cf fix: Fix NITRO_DEBUG debug/release preprocessor directive (#132)
* fix: Use `NITRO_DEBUG` flag to predictably run debug/release code

* feat: Add `NitroModules.buildType`

* fix: Style `debug` label
2024-09-16 16:18:05 +02:00
Marc RousavyandGitHub 661bea4cec feat: Add dispose() to HybridObject (and registerRawHybridMethod(...)) (#82)
* fix: Fix `SwiftClosure` not reading `void*` properly - use `Unmanaged<T>` again

* feat: Add a `dispose()` method to `HybridObject`

* feat: Split `registerRawHybridMethod` out of `registerHybridMethod`

* fix: Throw better error for when `NativeState` is nullptr

* Better debug info

* `FunctionType` -> `FunctionKind`

* fix: Either dynamically get name, or statically through typeinfo.
2024-08-29 16:51:11 +02:00
Marc RousavyandGitHub e7b9f412eb fix: Rewrite Logger to use platform NSLog / __android_log_print (#54)
* fix: Fix wrong include..?

* fix: Reimplement NitroLogger as a platform-specific logger

* fix: Copy args, and use proper tag

* fix: Fix sprintf crash because of wrong format argument

* fix: Fix Logger usage on iOS
2024-08-20 16:20:44 +02:00
Marc Rousavy f4ef4b7665 fix: Fix raw JSI functions and add test to example module 2024-08-20 12:13:55 +02:00
Marc RousavyandGitHub 065736dc2e feat: Base for Kotlin modules (#45)
* feat: Base for Kotlin modules

* fix: Properly make sure Nitro C++ is initialized

* Update JNIOnLoad.java

* feat: Set up `initHybrid()` in JHybridObject

* chore: Fix a bunch of linter issues

* fix: Fix fbjni codegen

* Update JHybridObject.hpp

* fix: Make `initHybrid()` JVM static

* feat: Make `mHybridData` private member of each in inheritance chain

* Generate specs

* feat: Set up proper inheritance graph in FBJNI using virtual inheritance `HybridObject` (#46)

* feat: Try to set up proper inheritance in FBJNI

* Virtual inheritance

* Update JHybridImageFactorySpec.cpp

* It works...

* feat: Virtual base

* Update HybridTestObject.hpp

* Update CMakeLists.txt

* Update JHybridObject.hpp

* Virtual dtor

* Dynamic cast to NativeState 🤔

* Virtual proper

* feat: Generate as virtual base?

* chore: Change to `updateNative`

* feat: Cannot default-construct HybridObject

* fix: Use `dynamic` pointer cast for `HybridContext` because `HybridObject` is now a virtual base

* Update README.md
2024-08-19 12:40:44 +02:00
Marc RousavyandGitHub 0dd63227d8 fix: Fix Swift umbrella header includes (#19)
* feat: Try bridge more Swift

* Make all Promises `async` in swift

* Rename `Promise` to `JSPromise`

* Update JSPromise.hpp

* Update JSICache.cpp

* fix import

* fix: Init props

* fix: Remove AnyMap and ArrayBuffer apis for now

* fix import

* no more async? idk

* feat: Convert `std::optional<T>` to `swift::Optional<T>`

* Remove all funcs except hello

* fix: Generate Swift Umbrella header

* fix: Organize

* fix: Hardcode forward-decl

* feat: Properly generate umbrella header from known types

* fix: Fix indentation

* order

* feat: Try bridging some primitives over...

* Update NitroDefines.hpp

* Update Property.ts

* fallthrough looks better

* better error

* fix: Fix wrong enum `maxLength`

* feat: Try `CarSwift` experiment

* Revert "feat: Try `CarSwift` experiment"

This reverts commit 7794f38271.
2024-08-12 14:18:13 +02:00
Marc RousavyandGitHub c101faf948 feat: Cache toObject(...) using jsi::WeakObject and correctly set externalExternalMemoryPressure (#13)
* feat: Cache `toObject(...)` using `jsi::WeakObject` and set `externalMemoryPressure` properly

* feat: Support caching different JSI types - strongly typed
2024-08-08 12:28:33 +02:00
Marc Rousavy 882054e587 feat: Support JSIConverter<AnyMap>::canConvert (+ AnyValue and unordered_map<string, T>) 2024-08-07 13:56:10 +02:00
Marc Rousavy 0b7e2b5561 fix: Fix JSICache<T> being recreated each time because of C++ template specialization 2024-08-06 01:37:08 +02:00
Marc Rousavy 87eae31207 feat: Move to templates 2024-08-02 21:45:48 +02:00
Marc Rousavy a522f09327 fix: Put template<...> on a separate line 2024-08-02 12:37:03 +02:00
Marc Rousavy 1ca53519c5 chore: Format code 2024-08-02 00:10:17 +02:00
Marc Rousavy c66064aa1f fix: Use atomic_size_t to prevent race conditions in OwningReference 2024-08-01 17:13:09 +02:00
Marc Rousavy ee41df2d99 fix: lock _mutex when lock()ing or comparing OwningReference 2024-08-01 17:09:28 +02:00
Marc Rousavy 50507b693a fix: Fix imports 2024-07-31 17:41:25 +02:00
Marc Rousavy 9d69ba04ab chore: Run clang format 2024-07-31 17:39:56 +02:00
Marc Rousavy a104481e11 feat: Prettify a few edge cases in getFriendlyTypename() :) 2024-07-31 17:29:03 +02:00
Marc Rousavy f0844b047f feat: Properly check variant type at runtime 2024-07-31 17:19:39 +02:00
Marc Rousavy 404b125b8f fix: Kinda builds? 2024-07-30 13:31:22 +02:00
Marc Rousavy 3e0279a71f feat: Create JSICacheReference for safer cache access 2024-07-30 11:41:01 +02:00
Marc Rousavy 45d5342b92 feat: Use OwningLock<T> in function callbacks 2024-07-30 11:10:38 +02:00
Marc Rousavy fc4eb15a4e feat: Create OwningLock to lock mutex 2024-07-30 10:50:47 +02:00
Marc Rousavy 705efdc717 fix: Throw mutex on all pointer operations 2024-07-30 10:50:21 +02:00
Marc Rousavy 55b11ecd5a Expose a few more headers 2024-07-29 12:05:04 +02:00
Marc Rousavy 786f2e9f13 fix: Use shared NitroDefines 2024-07-29 12:03:06 +02:00
Marc Rousavy a0c7caa2a8 fix: Properly get memory size including own cache map size 2024-07-23 01:34:44 +02:00
Marc Rousavy 4257dedf64 Fix TYPEID 2024-07-22 16:31:33 +02:00
Marc Rousavy 5efd374115 Clean up ios 2024-07-18 14:18:42 +02:00
Marc Rousavy 6b15467af8 Some final declarations 2024-07-18 01:30:33 +02:00
Marc Rousavy 88d286450c Update OwningReference.hpp 2024-07-18 01:28:08 +02:00
Marc Rousavy 803c7bfbf9 feat: Implement == for OwningReference 2024-07-18 01:25:37 +02:00
Marc Rousavy 4adc79dcfc Rename to GetRuntimeID 2024-07-18 00:22:49 +02:00
Marc Rousavy 9451e4a376 Update NitroLogger.hpp 2024-07-18 00:09:34 +02:00
Marc Rousavy 3fe9d784aa fix: Fix Logger 2024-07-18 00:05:15 +02:00
Marc Rousavy c470ce0b16 Extract CXX ABI specifics to TypeInfo.hpp 2024-07-17 23:49:04 +02:00
Marc Rousavy b5d832cf2d perf: Make all JSIConverter calls inline 2024-07-17 23:31:52 +02:00
Marc Rousavy 1cc33e0aef feat: Add hashString with compile time length 2024-07-17 21:57:12 +02:00
Marc Rousavy 7bc2767348 fix: Move to namespace margelo::nitro 2024-07-17 21:49:11 +02:00
Marc Rousavy ec2be05bd6 feat: Don't expose header, fix cycle 2024-07-17 16:53:22 +02:00
Marc Rousavy 82d66ef8c8 Update Hash.hpp 2024-07-14 02:01:41 +02:00
Marc Rousavy 118614838e feat: Move Hash.hpp into core codebase 2024-07-14 01:51:43 +02:00
Marc Rousavy 295600ecd8 Comment 2024-07-14 00:52:03 +02:00