@onekeyfe/react-native-app-update 1.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +36 -0
  3. package/ReactNativeAppUpdate.podspec +30 -0
  4. package/android/CMakeLists.txt +24 -0
  5. package/android/build.gradle +141 -0
  6. package/android/gradle.properties +4 -0
  7. package/android/src/main/AndroidManifest.xml +17 -0
  8. package/android/src/main/cpp/cpp-adapter.cpp +6 -0
  9. package/android/src/main/java/com/margelo/nitro/reactnativeappupdate/ReactNativeAppUpdate.kt +819 -0
  10. package/android/src/main/java/com/margelo/nitro/reactnativeappupdate/ReactNativeAppUpdatePackage.kt +24 -0
  11. package/android/src/main/res/xml/app_update_file_paths.xml +4 -0
  12. package/ios/ReactNativeAppUpdate.swift +41 -0
  13. package/lib/module/ReactNativeAppUpdate.nitro.js +4 -0
  14. package/lib/module/ReactNativeAppUpdate.nitro.js.map +1 -0
  15. package/lib/module/index.js +6 -0
  16. package/lib/module/index.js.map +1 -0
  17. package/lib/module/package.json +1 -0
  18. package/lib/typescript/package.json +1 -0
  19. package/lib/typescript/src/ReactNativeAppUpdate.nitro.d.ts +28 -0
  20. package/lib/typescript/src/ReactNativeAppUpdate.nitro.d.ts.map +1 -0
  21. package/lib/typescript/src/index.d.ts +4 -0
  22. package/lib/typescript/src/index.d.ts.map +1 -0
  23. package/nitro.json +17 -0
  24. package/nitrogen/generated/android/c++/JAppUpdateDownloadParams.hpp +65 -0
  25. package/nitrogen/generated/android/c++/JAppUpdateFileParams.hpp +57 -0
  26. package/nitrogen/generated/android/c++/JDownloadEvent.hpp +65 -0
  27. package/nitrogen/generated/android/c++/JFunc_void_DownloadEvent.hpp +78 -0
  28. package/nitrogen/generated/android/c++/JHybridReactNativeAppUpdateSpec.cpp +162 -0
  29. package/nitrogen/generated/android/c++/JHybridReactNativeAppUpdateSpec.hpp +72 -0
  30. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeappupdate/AppUpdateDownloadParams.kt +44 -0
  31. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeappupdate/AppUpdateFileParams.kt +38 -0
  32. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeappupdate/DownloadEvent.kt +44 -0
  33. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeappupdate/Func_void_DownloadEvent.kt +80 -0
  34. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeappupdate/HybridReactNativeAppUpdateSpec.kt +91 -0
  35. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeappupdate/reactnativeappupdateOnLoad.kt +35 -0
  36. package/nitrogen/generated/android/reactnativeappupdate+autolinking.cmake +81 -0
  37. package/nitrogen/generated/android/reactnativeappupdate+autolinking.gradle +27 -0
  38. package/nitrogen/generated/android/reactnativeappupdateOnLoad.cpp +46 -0
  39. package/nitrogen/generated/android/reactnativeappupdateOnLoad.hpp +25 -0
  40. package/nitrogen/generated/ios/ReactNativeAppUpdate+autolinking.rb +60 -0
  41. package/nitrogen/generated/ios/ReactNativeAppUpdate-Swift-Cxx-Bridge.cpp +57 -0
  42. package/nitrogen/generated/ios/ReactNativeAppUpdate-Swift-Cxx-Bridge.hpp +154 -0
  43. package/nitrogen/generated/ios/ReactNativeAppUpdate-Swift-Cxx-Umbrella.hpp +55 -0
  44. package/nitrogen/generated/ios/ReactNativeAppUpdateAutolinking.mm +33 -0
  45. package/nitrogen/generated/ios/ReactNativeAppUpdateAutolinking.swift +25 -0
  46. package/nitrogen/generated/ios/c++/HybridReactNativeAppUpdateSpecSwift.cpp +11 -0
  47. package/nitrogen/generated/ios/c++/HybridReactNativeAppUpdateSpecSwift.hpp +140 -0
  48. package/nitrogen/generated/ios/swift/AppUpdateDownloadParams.swift +58 -0
  49. package/nitrogen/generated/ios/swift/AppUpdateFileParams.swift +36 -0
  50. package/nitrogen/generated/ios/swift/DownloadEvent.swift +58 -0
  51. package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
  52. package/nitrogen/generated/ios/swift/Func_void_DownloadEvent.swift +47 -0
  53. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
  54. package/nitrogen/generated/ios/swift/HybridReactNativeAppUpdateSpec.swift +63 -0
  55. package/nitrogen/generated/ios/swift/HybridReactNativeAppUpdateSpec_cxx.swift +261 -0
  56. package/nitrogen/generated/shared/c++/AppUpdateDownloadParams.hpp +83 -0
  57. package/nitrogen/generated/shared/c++/AppUpdateFileParams.hpp +75 -0
  58. package/nitrogen/generated/shared/c++/DownloadEvent.hpp +83 -0
  59. package/nitrogen/generated/shared/c++/HybridReactNativeAppUpdateSpec.cpp +28 -0
  60. package/nitrogen/generated/shared/c++/HybridReactNativeAppUpdateSpec.hpp +78 -0
  61. package/package.json +169 -0
  62. package/src/ReactNativeAppUpdate.nitro.ts +30 -0
  63. package/src/index.tsx +8 -0
@@ -0,0 +1,44 @@
1
+ ///
2
+ /// AppUpdateDownloadParams.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.reactnativeappupdate
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "AppUpdateDownloadParams".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class AppUpdateDownloadParams(
20
+ @DoNotStrip
21
+ @Keep
22
+ val downloadUrl: String,
23
+ @DoNotStrip
24
+ @Keep
25
+ val notificationTitle: String,
26
+ @DoNotStrip
27
+ @Keep
28
+ val fileSize: Double
29
+ ) {
30
+ /* primary constructor */
31
+
32
+ private companion object {
33
+ /**
34
+ * Constructor called from C++
35
+ */
36
+ @DoNotStrip
37
+ @Keep
38
+ @Suppress("unused")
39
+ @JvmStatic
40
+ private fun fromCpp(downloadUrl: String, notificationTitle: String, fileSize: Double): AppUpdateDownloadParams {
41
+ return AppUpdateDownloadParams(downloadUrl, notificationTitle, fileSize)
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,38 @@
1
+ ///
2
+ /// AppUpdateFileParams.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.reactnativeappupdate
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "AppUpdateFileParams".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class AppUpdateFileParams(
20
+ @DoNotStrip
21
+ @Keep
22
+ val downloadUrl: String
23
+ ) {
24
+ /* primary constructor */
25
+
26
+ private companion object {
27
+ /**
28
+ * Constructor called from C++
29
+ */
30
+ @DoNotStrip
31
+ @Keep
32
+ @Suppress("unused")
33
+ @JvmStatic
34
+ private fun fromCpp(downloadUrl: String): AppUpdateFileParams {
35
+ return AppUpdateFileParams(downloadUrl)
36
+ }
37
+ }
38
+ }
@@ -0,0 +1,44 @@
1
+ ///
2
+ /// DownloadEvent.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.reactnativeappupdate
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "DownloadEvent".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class DownloadEvent(
20
+ @DoNotStrip
21
+ @Keep
22
+ val type: String,
23
+ @DoNotStrip
24
+ @Keep
25
+ val progress: Double,
26
+ @DoNotStrip
27
+ @Keep
28
+ val message: String
29
+ ) {
30
+ /* primary constructor */
31
+
32
+ private companion object {
33
+ /**
34
+ * Constructor called from C++
35
+ */
36
+ @DoNotStrip
37
+ @Keep
38
+ @Suppress("unused")
39
+ @JvmStatic
40
+ private fun fromCpp(type: String, progress: Double, message: String): DownloadEvent {
41
+ return DownloadEvent(type, progress, message)
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,80 @@
1
+ ///
2
+ /// Func_void_DownloadEvent.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.reactnativeappupdate
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import dalvik.annotation.optimization.FastNative
14
+
15
+
16
+ /**
17
+ * Represents the JavaScript callback `(event: struct) => void`.
18
+ * This can be either implemented in C++ (in which case it might be a callback coming from JS),
19
+ * or in Kotlin/Java (in which case it is a native callback).
20
+ */
21
+ @DoNotStrip
22
+ @Keep
23
+ @Suppress("ClassName", "RedundantUnitReturnType")
24
+ fun interface Func_void_DownloadEvent: (DownloadEvent) -> Unit {
25
+ /**
26
+ * Call the given JS callback.
27
+ * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
28
+ */
29
+ @DoNotStrip
30
+ @Keep
31
+ override fun invoke(event: DownloadEvent): Unit
32
+ }
33
+
34
+ /**
35
+ * Represents the JavaScript callback `(event: struct) => void`.
36
+ * This is implemented in C++, via a `std::function<...>`.
37
+ * The callback might be coming from JS.
38
+ */
39
+ @DoNotStrip
40
+ @Keep
41
+ @Suppress(
42
+ "KotlinJniMissingFunction", "unused",
43
+ "RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
44
+ "ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
45
+ )
46
+ class Func_void_DownloadEvent_cxx: Func_void_DownloadEvent {
47
+ @DoNotStrip
48
+ @Keep
49
+ private val mHybridData: HybridData
50
+
51
+ @DoNotStrip
52
+ @Keep
53
+ private constructor(hybridData: HybridData) {
54
+ mHybridData = hybridData
55
+ }
56
+
57
+ @DoNotStrip
58
+ @Keep
59
+ override fun invoke(event: DownloadEvent): Unit
60
+ = invoke_cxx(event)
61
+
62
+ @FastNative
63
+ private external fun invoke_cxx(event: DownloadEvent): Unit
64
+ }
65
+
66
+ /**
67
+ * Represents the JavaScript callback `(event: struct) => void`.
68
+ * This is implemented in Java/Kotlin, via a `(DownloadEvent) -> Unit`.
69
+ * The callback is always coming from native.
70
+ */
71
+ @DoNotStrip
72
+ @Keep
73
+ @Suppress("ClassName", "RedundantUnitReturnType", "unused")
74
+ class Func_void_DownloadEvent_java(private val function: (DownloadEvent) -> Unit): Func_void_DownloadEvent {
75
+ @DoNotStrip
76
+ @Keep
77
+ override fun invoke(event: DownloadEvent): Unit {
78
+ return this.function(event)
79
+ }
80
+ }
@@ -0,0 +1,91 @@
1
+ ///
2
+ /// HybridReactNativeAppUpdateSpec.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.reactnativeappupdate
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.core.Promise
14
+ import com.margelo.nitro.core.HybridObject
15
+
16
+ /**
17
+ * A Kotlin class representing the ReactNativeAppUpdate HybridObject.
18
+ * Implement this abstract class to create Kotlin-based instances of ReactNativeAppUpdate.
19
+ */
20
+ @DoNotStrip
21
+ @Keep
22
+ @Suppress(
23
+ "KotlinJniMissingFunction", "unused",
24
+ "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
25
+ "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
26
+ )
27
+ abstract class HybridReactNativeAppUpdateSpec: HybridObject() {
28
+ @DoNotStrip
29
+ private var mHybridData: HybridData = initHybrid()
30
+
31
+ init {
32
+ super.updateNative(mHybridData)
33
+ }
34
+
35
+ override fun updateNative(hybridData: HybridData) {
36
+ mHybridData = hybridData
37
+ super.updateNative(hybridData)
38
+ }
39
+
40
+ // Default implementation of `HybridObject.toString()`
41
+ override fun toString(): String {
42
+ return "[HybridObject ReactNativeAppUpdate]"
43
+ }
44
+
45
+ // Properties
46
+
47
+
48
+ // Methods
49
+ @DoNotStrip
50
+ @Keep
51
+ abstract fun downloadAPK(params: AppUpdateDownloadParams): Promise<Unit>
52
+
53
+ @DoNotStrip
54
+ @Keep
55
+ abstract fun downloadASC(params: AppUpdateFileParams): Promise<Unit>
56
+
57
+ @DoNotStrip
58
+ @Keep
59
+ abstract fun verifyASC(params: AppUpdateFileParams): Promise<Unit>
60
+
61
+ @DoNotStrip
62
+ @Keep
63
+ abstract fun verifyAPK(params: AppUpdateFileParams): Promise<Unit>
64
+
65
+ @DoNotStrip
66
+ @Keep
67
+ abstract fun installAPK(params: AppUpdateFileParams): Promise<Unit>
68
+
69
+ @DoNotStrip
70
+ @Keep
71
+ abstract fun clearCache(): Promise<Unit>
72
+
73
+ abstract fun addDownloadListener(callback: (event: DownloadEvent) -> Unit): Double
74
+
75
+ @DoNotStrip
76
+ @Keep
77
+ private fun addDownloadListener_cxx(callback: Func_void_DownloadEvent): Double {
78
+ val __result = addDownloadListener(callback)
79
+ return __result
80
+ }
81
+
82
+ @DoNotStrip
83
+ @Keep
84
+ abstract fun removeDownloadListener(id: Double): Unit
85
+
86
+ private external fun initHybrid(): HybridData
87
+
88
+ companion object {
89
+ protected const val TAG = "HybridReactNativeAppUpdateSpec"
90
+ }
91
+ }
@@ -0,0 +1,35 @@
1
+ ///
2
+ /// reactnativeappupdateOnLoad.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.reactnativeappupdate
9
+
10
+ import android.util.Log
11
+
12
+ internal class reactnativeappupdateOnLoad {
13
+ companion object {
14
+ private const val TAG = "reactnativeappupdateOnLoad"
15
+ private var didLoad = false
16
+ /**
17
+ * Initializes the native part of "reactnativeappupdate".
18
+ * This method is idempotent and can be called more than once.
19
+ */
20
+ @JvmStatic
21
+ fun initializeNative() {
22
+ if (didLoad) return
23
+ try {
24
+ Log.i(TAG, "Loading reactnativeappupdate C++ library...")
25
+ System.loadLibrary("reactnativeappupdate")
26
+ Log.i(TAG, "Successfully loaded reactnativeappupdate C++ library!")
27
+ didLoad = true
28
+ } catch (e: Error) {
29
+ Log.e(TAG, "Failed to load reactnativeappupdate C++ library! Is it properly installed and linked? " +
30
+ "Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
31
+ throw e
32
+ }
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,81 @@
1
+ #
2
+ # reactnativeappupdate+autolinking.cmake
3
+ # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ # https://github.com/mrousavy/nitro
5
+ # Copyright © 2026 Marc Rousavy @ Margelo
6
+ #
7
+
8
+ # This is a CMake file that adds all files generated by Nitrogen
9
+ # to the current CMake project.
10
+ #
11
+ # To use it, add this to your CMakeLists.txt:
12
+ # ```cmake
13
+ # include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/reactnativeappupdate+autolinking.cmake)
14
+ # ```
15
+
16
+ # Define a flag to check if we are building properly
17
+ add_definitions(-DBUILDING_REACTNATIVEAPPUPDATE_WITH_GENERATED_CMAKE_PROJECT)
18
+
19
+ # Enable Raw Props parsing in react-native (for Nitro Views)
20
+ add_definitions(-DRN_SERIALIZABLE_STATE)
21
+
22
+ # Add all headers that were generated by Nitrogen
23
+ include_directories(
24
+ "../nitrogen/generated/shared/c++"
25
+ "../nitrogen/generated/android/c++"
26
+ "../nitrogen/generated/android/"
27
+ )
28
+
29
+ # Add all .cpp sources that were generated by Nitrogen
30
+ target_sources(
31
+ # CMake project name (Android C++ library name)
32
+ reactnativeappupdate PRIVATE
33
+ # Autolinking Setup
34
+ ../nitrogen/generated/android/reactnativeappupdateOnLoad.cpp
35
+ # Shared Nitrogen C++ sources
36
+ ../nitrogen/generated/shared/c++/HybridReactNativeAppUpdateSpec.cpp
37
+ # Android-specific Nitrogen C++ sources
38
+ ../nitrogen/generated/android/c++/JHybridReactNativeAppUpdateSpec.cpp
39
+ )
40
+
41
+ # From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
42
+ # Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
43
+ target_compile_definitions(
44
+ reactnativeappupdate PRIVATE
45
+ -DFOLLY_NO_CONFIG=1
46
+ -DFOLLY_HAVE_CLOCK_GETTIME=1
47
+ -DFOLLY_USE_LIBCPP=1
48
+ -DFOLLY_CFG_NO_COROUTINES=1
49
+ -DFOLLY_MOBILE=1
50
+ -DFOLLY_HAVE_RECVMMSG=1
51
+ -DFOLLY_HAVE_PTHREAD=1
52
+ # Once we target android-23 above, we can comment
53
+ # the following line. NDK uses GNU style stderror_r() after API 23.
54
+ -DFOLLY_HAVE_XSI_STRERROR_R=1
55
+ )
56
+
57
+ # Add all libraries required by the generated specs
58
+ find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
59
+ find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
60
+ find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
61
+
62
+ # Link all libraries together
63
+ target_link_libraries(
64
+ reactnativeappupdate
65
+ fbjni::fbjni # <-- Facebook C++ JNI helpers
66
+ ReactAndroid::jsi # <-- RN: JSI
67
+ react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
68
+ )
69
+
70
+ # Link react-native (different prefab between RN 0.75 and RN 0.76)
71
+ if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
72
+ target_link_libraries(
73
+ reactnativeappupdate
74
+ ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
75
+ )
76
+ else()
77
+ target_link_libraries(
78
+ reactnativeappupdate
79
+ ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
80
+ )
81
+ endif()
@@ -0,0 +1,27 @@
1
+ ///
2
+ /// reactnativeappupdate+autolinking.gradle
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ /// This is a Gradle file that adds all files generated by Nitrogen
9
+ /// to the current Gradle project.
10
+ ///
11
+ /// To use it, add this to your build.gradle:
12
+ /// ```gradle
13
+ /// apply from: '../nitrogen/generated/android/reactnativeappupdate+autolinking.gradle'
14
+ /// ```
15
+
16
+ logger.warn("[NitroModules] 🔥 reactnativeappupdate is boosted by nitro!")
17
+
18
+ android {
19
+ sourceSets {
20
+ main {
21
+ java.srcDirs += [
22
+ // Nitrogen files
23
+ "${project.projectDir}/../nitrogen/generated/android/kotlin"
24
+ ]
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// reactnativeappupdateOnLoad.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #ifndef BUILDING_REACTNATIVEAPPUPDATE_WITH_GENERATED_CMAKE_PROJECT
9
+ #error reactnativeappupdateOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
10
+ #endif
11
+
12
+ #include "reactnativeappupdateOnLoad.hpp"
13
+
14
+ #include <jni.h>
15
+ #include <fbjni/fbjni.h>
16
+ #include <NitroModules/HybridObjectRegistry.hpp>
17
+
18
+ #include "JHybridReactNativeAppUpdateSpec.hpp"
19
+ #include "JFunc_void_DownloadEvent.hpp"
20
+ #include <NitroModules/DefaultConstructableObject.hpp>
21
+
22
+ namespace margelo::nitro::reactnativeappupdate {
23
+
24
+ int initialize(JavaVM* vm) {
25
+ using namespace margelo::nitro;
26
+ using namespace margelo::nitro::reactnativeappupdate;
27
+ using namespace facebook;
28
+
29
+ return facebook::jni::initialize(vm, [] {
30
+ // Register native JNI methods
31
+ margelo::nitro::reactnativeappupdate::JHybridReactNativeAppUpdateSpec::registerNatives();
32
+ margelo::nitro::reactnativeappupdate::JFunc_void_DownloadEvent_cxx::registerNatives();
33
+
34
+ // Register Nitro Hybrid Objects
35
+ HybridObjectRegistry::registerHybridObjectConstructor(
36
+ "ReactNativeAppUpdate",
37
+ []() -> std::shared_ptr<HybridObject> {
38
+ static DefaultConstructableObject<JHybridReactNativeAppUpdateSpec::javaobject> object("com/margelo/nitro/reactnativeappupdate/ReactNativeAppUpdate");
39
+ auto instance = object.create();
40
+ return instance->cthis()->shared();
41
+ }
42
+ );
43
+ });
44
+ }
45
+
46
+ } // namespace margelo::nitro::reactnativeappupdate
@@ -0,0 +1,25 @@
1
+ ///
2
+ /// reactnativeappupdateOnLoad.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include <jni.h>
9
+ #include <NitroModules/NitroDefines.hpp>
10
+
11
+ namespace margelo::nitro::reactnativeappupdate {
12
+
13
+ /**
14
+ * Initializes the native (C++) part of reactnativeappupdate, and autolinks all Hybrid Objects.
15
+ * Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`).
16
+ * Example:
17
+ * ```cpp (cpp-adapter.cpp)
18
+ * JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
19
+ * return margelo::nitro::reactnativeappupdate::initialize(vm);
20
+ * }
21
+ * ```
22
+ */
23
+ int initialize(JavaVM* vm);
24
+
25
+ } // namespace margelo::nitro::reactnativeappupdate
@@ -0,0 +1,60 @@
1
+ #
2
+ # ReactNativeAppUpdate+autolinking.rb
3
+ # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ # https://github.com/mrousavy/nitro
5
+ # Copyright © 2026 Marc Rousavy @ Margelo
6
+ #
7
+
8
+ # This is a Ruby script that adds all files generated by Nitrogen
9
+ # to the given podspec.
10
+ #
11
+ # To use it, add this to your .podspec:
12
+ # ```ruby
13
+ # Pod::Spec.new do |spec|
14
+ # # ...
15
+ #
16
+ # # Add all files generated by Nitrogen
17
+ # load 'nitrogen/generated/ios/ReactNativeAppUpdate+autolinking.rb'
18
+ # add_nitrogen_files(spec)
19
+ # end
20
+ # ```
21
+
22
+ def add_nitrogen_files(spec)
23
+ Pod::UI.puts "[NitroModules] 🔥 ReactNativeAppUpdate is boosted by nitro!"
24
+
25
+ spec.dependency "NitroModules"
26
+
27
+ current_source_files = Array(spec.attributes_hash['source_files'])
28
+ spec.source_files = current_source_files + [
29
+ # Generated cross-platform specs
30
+ "nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
31
+ # Generated bridges for the cross-platform specs
32
+ "nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
33
+ ]
34
+
35
+ current_public_header_files = Array(spec.attributes_hash['public_header_files'])
36
+ spec.public_header_files = current_public_header_files + [
37
+ # Generated specs
38
+ "nitrogen/generated/shared/**/*.{h,hpp}",
39
+ # Swift to C++ bridging helpers
40
+ "nitrogen/generated/ios/ReactNativeAppUpdate-Swift-Cxx-Bridge.hpp"
41
+ ]
42
+
43
+ current_private_header_files = Array(spec.attributes_hash['private_header_files'])
44
+ spec.private_header_files = current_private_header_files + [
45
+ # iOS specific specs
46
+ "nitrogen/generated/ios/c++/**/*.{h,hpp}",
47
+ # Views are framework-specific and should be private
48
+ "nitrogen/generated/shared/**/views/**/*"
49
+ ]
50
+
51
+ current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
52
+ spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
53
+ # Use C++ 20
54
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
55
+ # Enables C++ <-> Swift interop (by default it's only C)
56
+ "SWIFT_OBJC_INTEROP_MODE" => "objcxx",
57
+ # Enables stricter modular headers
58
+ "DEFINES_MODULE" => "YES",
59
+ })
60
+ end
@@ -0,0 +1,57 @@
1
+ ///
2
+ /// ReactNativeAppUpdate-Swift-Cxx-Bridge.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "ReactNativeAppUpdate-Swift-Cxx-Bridge.hpp"
9
+
10
+ // Include C++ implementation defined types
11
+ #include "HybridReactNativeAppUpdateSpecSwift.hpp"
12
+ #include "ReactNativeAppUpdate-Swift-Cxx-Umbrella.hpp"
13
+ #include <NitroModules/NitroDefines.hpp>
14
+
15
+ namespace margelo::nitro::reactnativeappupdate::bridge::swift {
16
+
17
+ // pragma MARK: std::function<void()>
18
+ Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
19
+ auto swiftClosure = ReactNativeAppUpdate::Func_void::fromUnsafe(swiftClosureWrapper);
20
+ return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
21
+ swiftClosure.call();
22
+ };
23
+ }
24
+
25
+ // pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
26
+ Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
27
+ auto swiftClosure = ReactNativeAppUpdate::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
28
+ return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
29
+ swiftClosure.call(error);
30
+ };
31
+ }
32
+
33
+ // pragma MARK: std::function<void(const DownloadEvent& /* event */)>
34
+ Func_void_DownloadEvent create_Func_void_DownloadEvent(void* NON_NULL swiftClosureWrapper) noexcept {
35
+ auto swiftClosure = ReactNativeAppUpdate::Func_void_DownloadEvent::fromUnsafe(swiftClosureWrapper);
36
+ return [swiftClosure = std::move(swiftClosure)](const DownloadEvent& event) mutable -> void {
37
+ swiftClosure.call(event);
38
+ };
39
+ }
40
+
41
+ // pragma MARK: std::shared_ptr<HybridReactNativeAppUpdateSpec>
42
+ std::shared_ptr<HybridReactNativeAppUpdateSpec> create_std__shared_ptr_HybridReactNativeAppUpdateSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
43
+ ReactNativeAppUpdate::HybridReactNativeAppUpdateSpec_cxx swiftPart = ReactNativeAppUpdate::HybridReactNativeAppUpdateSpec_cxx::fromUnsafe(swiftUnsafePointer);
44
+ return std::make_shared<margelo::nitro::reactnativeappupdate::HybridReactNativeAppUpdateSpecSwift>(swiftPart);
45
+ }
46
+ void* NON_NULL get_std__shared_ptr_HybridReactNativeAppUpdateSpec_(std__shared_ptr_HybridReactNativeAppUpdateSpec_ cppType) {
47
+ std::shared_ptr<margelo::nitro::reactnativeappupdate::HybridReactNativeAppUpdateSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::reactnativeappupdate::HybridReactNativeAppUpdateSpecSwift>(cppType);
48
+ #ifdef NITRO_DEBUG
49
+ if (swiftWrapper == nullptr) [[unlikely]] {
50
+ throw std::runtime_error("Class \"HybridReactNativeAppUpdateSpec\" is not implemented in Swift!");
51
+ }
52
+ #endif
53
+ ReactNativeAppUpdate::HybridReactNativeAppUpdateSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
54
+ return swiftPart.toUnsafe();
55
+ }
56
+
57
+ } // namespace margelo::nitro::reactnativeappupdate::bridge::swift