@onekeyfe/react-native-device-utils 3.0.81-alpha.8 → 3.0.82

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 (61) hide show
  1. package/nitrogen/generated/android/c++/JAndroidChannel.hpp +6 -7
  2. package/nitrogen/generated/android/c++/JDualScreenInfoRect.hpp +2 -2
  3. package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +3 -3
  4. package/nitrogen/generated/android/c++/JGooglePlayServicesStatus.hpp +2 -2
  5. package/nitrogen/generated/android/c++/JHybridReactNativeDeviceUtilsSpec.cpp +47 -45
  6. package/nitrogen/generated/android/c++/JHybridReactNativeDeviceUtilsSpec.hpp +20 -22
  7. package/nitrogen/generated/android/c++/JInstallerPackageName.hpp +8 -9
  8. package/nitrogen/generated/android/c++/JLaunchOptions.hpp +2 -2
  9. package/nitrogen/generated/android/c++/JUserInterfaceStyle.hpp +5 -6
  10. package/nitrogen/generated/android/c++/JWebViewPackageInfo.hpp +2 -2
  11. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/AndroidChannel.kt +3 -1
  12. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/DualScreenInfoRect.kt +2 -2
  13. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/Func_void_bool.kt +1 -1
  14. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/GooglePlayServicesStatus.kt +2 -2
  15. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/HybridReactNativeDeviceUtilsSpec.kt +16 -19
  16. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/InstallerPackageName.kt +3 -1
  17. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/LaunchOptions.kt +2 -2
  18. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/UserInterfaceStyle.kt +3 -1
  19. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/WebViewPackageInfo.kt +2 -2
  20. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/reactnativedeviceutilsOnLoad.kt +1 -1
  21. package/nitrogen/generated/android/reactnativedeviceutils+autolinking.cmake +1 -1
  22. package/nitrogen/generated/android/reactnativedeviceutils+autolinking.gradle +1 -1
  23. package/nitrogen/generated/android/reactnativedeviceutilsOnLoad.cpp +28 -18
  24. package/nitrogen/generated/android/reactnativedeviceutilsOnLoad.hpp +14 -5
  25. package/nitrogen/generated/ios/ReactNativeDeviceUtils+autolinking.rb +2 -2
  26. package/nitrogen/generated/ios/ReactNativeDeviceUtils-Swift-Cxx-Bridge.cpp +1 -1
  27. package/nitrogen/generated/ios/ReactNativeDeviceUtils-Swift-Cxx-Bridge.hpp +2 -2
  28. package/nitrogen/generated/ios/ReactNativeDeviceUtils-Swift-Cxx-Umbrella.hpp +1 -1
  29. package/nitrogen/generated/ios/ReactNativeDeviceUtilsAutolinking.mm +1 -1
  30. package/nitrogen/generated/ios/ReactNativeDeviceUtilsAutolinking.swift +9 -8
  31. package/nitrogen/generated/ios/c++/HybridReactNativeDeviceUtilsSpecSwift.cpp +1 -1
  32. package/nitrogen/generated/ios/c++/HybridReactNativeDeviceUtilsSpecSwift.hpp +7 -1
  33. package/nitrogen/generated/ios/swift/AndroidChannel.swift +1 -1
  34. package/nitrogen/generated/ios/swift/DualScreenInfoRect.swift +9 -34
  35. package/nitrogen/generated/ios/swift/Func_void.swift +1 -2
  36. package/nitrogen/generated/ios/swift/Func_void_DualScreenInfoRect.swift +1 -2
  37. package/nitrogen/generated/ios/swift/Func_void_GooglePlayServicesStatus.swift +1 -2
  38. package/nitrogen/generated/ios/swift/Func_void_LaunchOptions.swift +1 -2
  39. package/nitrogen/generated/ios/swift/Func_void_WebViewPackageInfo.swift +1 -2
  40. package/nitrogen/generated/ios/swift/Func_void_bool.swift +1 -2
  41. package/nitrogen/generated/ios/swift/Func_void_double.swift +1 -2
  42. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +1 -2
  43. package/nitrogen/generated/ios/swift/Func_void_std__string.swift +1 -2
  44. package/nitrogen/generated/ios/swift/Func_void_std__vector_DualScreenInfoRect_.swift +1 -2
  45. package/nitrogen/generated/ios/swift/GooglePlayServicesStatus.swift +5 -18
  46. package/nitrogen/generated/ios/swift/HybridReactNativeDeviceUtilsSpec.swift +3 -4
  47. package/nitrogen/generated/ios/swift/HybridReactNativeDeviceUtilsSpec_cxx.swift +9 -2
  48. package/nitrogen/generated/ios/swift/InstallerPackageName.swift +1 -1
  49. package/nitrogen/generated/ios/swift/LaunchOptions.swift +12 -31
  50. package/nitrogen/generated/ios/swift/UserInterfaceStyle.swift +1 -1
  51. package/nitrogen/generated/ios/swift/WebViewPackageInfo.swift +7 -26
  52. package/nitrogen/generated/shared/c++/AndroidChannel.hpp +1 -1
  53. package/nitrogen/generated/shared/c++/DualScreenInfoRect.hpp +22 -14
  54. package/nitrogen/generated/shared/c++/GooglePlayServicesStatus.hpp +16 -8
  55. package/nitrogen/generated/shared/c++/HybridReactNativeDeviceUtilsSpec.cpp +1 -1
  56. package/nitrogen/generated/shared/c++/HybridReactNativeDeviceUtilsSpec.hpp +1 -1
  57. package/nitrogen/generated/shared/c++/InstallerPackageName.hpp +1 -1
  58. package/nitrogen/generated/shared/c++/LaunchOptions.hpp +16 -8
  59. package/nitrogen/generated/shared/c++/UserInterfaceStyle.hpp +1 -1
  60. package/nitrogen/generated/shared/c++/WebViewPackageInfo.hpp +19 -11
  61. package/package.json +5 -6
@@ -2,7 +2,7 @@
2
2
  /// JAndroidChannel.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -19,7 +19,7 @@ namespace margelo::nitro::reactnativedeviceutils {
19
19
  */
20
20
  struct JAndroidChannel final: public jni::JavaClass<JAndroidChannel> {
21
21
  public:
22
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/AndroidChannel;";
22
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/AndroidChannel;";
23
23
 
24
24
  public:
25
25
  /**
@@ -41,19 +41,18 @@ namespace margelo::nitro::reactnativedeviceutils {
41
41
  [[maybe_unused]]
42
42
  static jni::alias_ref<JAndroidChannel> fromCpp(AndroidChannel value) {
43
43
  static const auto clazz = javaClassStatic();
44
- static const auto fieldDIRECT = clazz->getStaticField<JAndroidChannel>("DIRECT");
45
- static const auto fieldGOOGLE = clazz->getStaticField<JAndroidChannel>("GOOGLE");
46
- static const auto fieldHUAWEI = clazz->getStaticField<JAndroidChannel>("HUAWEI");
47
- static const auto fieldUNKNOWN = clazz->getStaticField<JAndroidChannel>("UNKNOWN");
48
-
49
44
  switch (value) {
50
45
  case AndroidChannel::DIRECT:
46
+ static const auto fieldDIRECT = clazz->getStaticField<JAndroidChannel>("DIRECT");
51
47
  return clazz->getStaticFieldValue(fieldDIRECT);
52
48
  case AndroidChannel::GOOGLE:
49
+ static const auto fieldGOOGLE = clazz->getStaticField<JAndroidChannel>("GOOGLE");
53
50
  return clazz->getStaticFieldValue(fieldGOOGLE);
54
51
  case AndroidChannel::HUAWEI:
52
+ static const auto fieldHUAWEI = clazz->getStaticField<JAndroidChannel>("HUAWEI");
55
53
  return clazz->getStaticFieldValue(fieldHUAWEI);
56
54
  case AndroidChannel::UNKNOWN:
55
+ static const auto fieldUNKNOWN = clazz->getStaticField<JAndroidChannel>("UNKNOWN");
57
56
  return clazz->getStaticFieldValue(fieldUNKNOWN);
58
57
  default:
59
58
  std::string stringValue = std::to_string(static_cast<int>(value));
@@ -2,7 +2,7 @@
2
2
  /// JDualScreenInfoRect.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -21,7 +21,7 @@ namespace margelo::nitro::reactnativedeviceutils {
21
21
  */
22
22
  struct JDualScreenInfoRect final: public jni::JavaClass<JDualScreenInfoRect> {
23
23
  public:
24
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/DualScreenInfoRect;";
24
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/DualScreenInfoRect;";
25
25
 
26
26
  public:
27
27
  /**
@@ -2,7 +2,7 @@
2
2
  /// JFunc_void_bool.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -23,7 +23,7 @@ namespace margelo::nitro::reactnativedeviceutils {
23
23
  */
24
24
  struct JFunc_void_bool: public jni::JavaClass<JFunc_void_bool> {
25
25
  public:
26
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/Func_void_bool;";
26
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/Func_void_bool;";
27
27
 
28
28
  public:
29
29
  /**
@@ -59,7 +59,7 @@ namespace margelo::nitro::reactnativedeviceutils {
59
59
  }
60
60
 
61
61
  public:
62
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/Func_void_bool_cxx;";
62
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/Func_void_bool_cxx;";
63
63
  static void registerNatives() {
64
64
  registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_bool_cxx::invoke_cxx)});
65
65
  }
@@ -2,7 +2,7 @@
2
2
  /// JGooglePlayServicesStatus.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -21,7 +21,7 @@ namespace margelo::nitro::reactnativedeviceutils {
21
21
  */
22
22
  struct JGooglePlayServicesStatus final: public jni::JavaClass<JGooglePlayServicesStatus> {
23
23
  public:
24
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/GooglePlayServicesStatus;";
24
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/GooglePlayServicesStatus;";
25
25
 
26
26
  public:
27
27
  /**
@@ -2,7 +2,7 @@
2
2
  /// JHybridReactNativeDeviceUtilsSpec.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "JHybridReactNativeDeviceUtilsSpec.hpp"
@@ -31,6 +31,7 @@ namespace margelo::nitro::reactnativedeviceutils { enum class UserInterfaceStyle
31
31
  #include "JLaunchOptions.hpp"
32
32
  #include <string>
33
33
  #include <optional>
34
+ #include <NitroModules/JUnit.hpp>
34
35
  #include "WebViewPackageInfo.hpp"
35
36
  #include "JWebViewPackageInfo.hpp"
36
37
  #include "GooglePlayServicesStatus.hpp"
@@ -47,30 +48,31 @@ namespace margelo::nitro::reactnativedeviceutils { enum class UserInterfaceStyle
47
48
 
48
49
  namespace margelo::nitro::reactnativedeviceutils {
49
50
 
50
- jni::local_ref<JHybridReactNativeDeviceUtilsSpec::jhybriddata> JHybridReactNativeDeviceUtilsSpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
51
- return makeCxxInstance(jThis);
52
- }
53
-
54
- void JHybridReactNativeDeviceUtilsSpec::registerNatives() {
55
- registerHybrid({
56
- makeNativeMethod("initHybrid", JHybridReactNativeDeviceUtilsSpec::initHybrid),
57
- });
51
+ std::shared_ptr<JHybridReactNativeDeviceUtilsSpec> JHybridReactNativeDeviceUtilsSpec::JavaPart::getJHybridReactNativeDeviceUtilsSpec() {
52
+ auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
53
+ auto castHybridObject = std::dynamic_pointer_cast<JHybridReactNativeDeviceUtilsSpec>(hybridObject);
54
+ if (castHybridObject == nullptr) [[unlikely]] {
55
+ throw std::runtime_error("Failed to downcast JHybridObject to JHybridReactNativeDeviceUtilsSpec!");
56
+ }
57
+ return castHybridObject;
58
58
  }
59
59
 
60
- size_t JHybridReactNativeDeviceUtilsSpec::getExternalMemorySize() noexcept {
61
- static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
62
- return method(_javaPart);
60
+ jni::local_ref<JHybridReactNativeDeviceUtilsSpec::CxxPart::jhybriddata> JHybridReactNativeDeviceUtilsSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
61
+ return makeCxxInstance(jThis);
63
62
  }
64
63
 
65
- void JHybridReactNativeDeviceUtilsSpec::dispose() noexcept {
66
- static const auto method = javaClassStatic()->getMethod<void()>("dispose");
67
- method(_javaPart);
64
+ std::shared_ptr<JHybridObject> JHybridReactNativeDeviceUtilsSpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
65
+ auto castJavaPart = jni::dynamic_ref_cast<JHybridReactNativeDeviceUtilsSpec::JavaPart>(javaPart);
66
+ if (castJavaPart == nullptr) [[unlikely]] {
67
+ throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridReactNativeDeviceUtilsSpec::JavaPart!");
68
+ }
69
+ return std::make_shared<JHybridReactNativeDeviceUtilsSpec>(castJavaPart);
68
70
  }
69
71
 
70
- std::string JHybridReactNativeDeviceUtilsSpec::toString() {
71
- static const auto method = javaClassStatic()->getMethod<jni::JString()>("toString");
72
- auto javaString = method(_javaPart);
73
- return javaString->toStdString();
72
+ void JHybridReactNativeDeviceUtilsSpec::CxxPart::registerNatives() {
73
+ registerHybrid({
74
+ makeNativeMethod("initHybrid", JHybridReactNativeDeviceUtilsSpec::CxxPart::initHybrid),
75
+ });
74
76
  }
75
77
 
76
78
  // Properties
@@ -78,21 +80,21 @@ namespace margelo::nitro::reactnativedeviceutils {
78
80
 
79
81
  // Methods
80
82
  void JHybridReactNativeDeviceUtilsSpec::initEventListeners() {
81
- static const auto method = javaClassStatic()->getMethod<void()>("initEventListeners");
83
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void()>("initEventListeners");
82
84
  method(_javaPart);
83
85
  }
84
86
  bool JHybridReactNativeDeviceUtilsSpec::isDualScreenDevice() {
85
- static const auto method = javaClassStatic()->getMethod<jboolean()>("isDualScreenDevice");
87
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean()>("isDualScreenDevice");
86
88
  auto __result = method(_javaPart);
87
89
  return static_cast<bool>(__result);
88
90
  }
89
91
  bool JHybridReactNativeDeviceUtilsSpec::isSpanning() {
90
- static const auto method = javaClassStatic()->getMethod<jboolean()>("isSpanning");
92
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean()>("isSpanning");
91
93
  auto __result = method(_javaPart);
92
94
  return static_cast<bool>(__result);
93
95
  }
94
96
  std::shared_ptr<Promise<std::vector<DualScreenInfoRect>>> JHybridReactNativeDeviceUtilsSpec::getWindowRects() {
95
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getWindowRects");
97
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getWindowRects");
96
98
  auto __result = method(_javaPart);
97
99
  return [&]() {
98
100
  auto __promise = Promise<std::vector<DualScreenInfoRect>>::create();
@@ -117,7 +119,7 @@ namespace margelo::nitro::reactnativedeviceutils {
117
119
  }();
118
120
  }
119
121
  std::shared_ptr<Promise<DualScreenInfoRect>> JHybridReactNativeDeviceUtilsSpec::getHingeBounds() {
120
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getHingeBounds");
122
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getHingeBounds");
121
123
  auto __result = method(_javaPart);
122
124
  return [&]() {
123
125
  auto __promise = Promise<DualScreenInfoRect>::create();
@@ -133,24 +135,24 @@ namespace margelo::nitro::reactnativedeviceutils {
133
135
  }();
134
136
  }
135
137
  void JHybridReactNativeDeviceUtilsSpec::changeBackgroundColor(double r, double g, double b, double a) {
136
- static const auto method = javaClassStatic()->getMethod<void(double /* r */, double /* g */, double /* b */, double /* a */)>("changeBackgroundColor");
138
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* r */, double /* g */, double /* b */, double /* a */)>("changeBackgroundColor");
137
139
  method(_javaPart, r, g, b, a);
138
140
  }
139
141
  double JHybridReactNativeDeviceUtilsSpec::addSpanningChangedListener(const std::function<void(bool /* isSpanning */)>& callback) {
140
- static const auto method = javaClassStatic()->getMethod<double(jni::alias_ref<JFunc_void_bool::javaobject> /* callback */)>("addSpanningChangedListener_cxx");
142
+ static const auto method = _javaPart->javaClassStatic()->getMethod<double(jni::alias_ref<JFunc_void_bool::javaobject> /* callback */)>("addSpanningChangedListener_cxx");
141
143
  auto __result = method(_javaPart, JFunc_void_bool_cxx::fromCpp(callback));
142
144
  return __result;
143
145
  }
144
146
  void JHybridReactNativeDeviceUtilsSpec::removeSpanningChangedListener(double id) {
145
- static const auto method = javaClassStatic()->getMethod<void(double /* id */)>("removeSpanningChangedListener");
147
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* id */)>("removeSpanningChangedListener");
146
148
  method(_javaPart, id);
147
149
  }
148
150
  void JHybridReactNativeDeviceUtilsSpec::setUserInterfaceStyle(UserInterfaceStyle style) {
149
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JUserInterfaceStyle> /* style */)>("setUserInterfaceStyle");
151
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JUserInterfaceStyle> /* style */)>("setUserInterfaceStyle");
150
152
  method(_javaPart, JUserInterfaceStyle::fromCpp(style));
151
153
  }
152
154
  std::shared_ptr<Promise<LaunchOptions>> JHybridReactNativeDeviceUtilsSpec::getLaunchOptions() {
153
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getLaunchOptions");
155
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getLaunchOptions");
154
156
  auto __result = method(_javaPart);
155
157
  return [&]() {
156
158
  auto __promise = Promise<LaunchOptions>::create();
@@ -166,7 +168,7 @@ namespace margelo::nitro::reactnativedeviceutils {
166
168
  }();
167
169
  }
168
170
  std::shared_ptr<Promise<bool>> JHybridReactNativeDeviceUtilsSpec::clearLaunchOptions() {
169
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("clearLaunchOptions");
171
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("clearLaunchOptions");
170
172
  auto __result = method(_javaPart);
171
173
  return [&]() {
172
174
  auto __promise = Promise<bool>::create();
@@ -182,7 +184,7 @@ namespace margelo::nitro::reactnativedeviceutils {
182
184
  }();
183
185
  }
184
186
  std::shared_ptr<Promise<std::string>> JHybridReactNativeDeviceUtilsSpec::getDeviceToken() {
185
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getDeviceToken");
187
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getDeviceToken");
186
188
  auto __result = method(_javaPart);
187
189
  return [&]() {
188
190
  auto __promise = Promise<std::string>::create();
@@ -198,7 +200,7 @@ namespace margelo::nitro::reactnativedeviceutils {
198
200
  }();
199
201
  }
200
202
  std::shared_ptr<Promise<void>> JHybridReactNativeDeviceUtilsSpec::saveDeviceToken(const std::string& token) {
201
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* token */)>("saveDeviceToken");
203
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* token */)>("saveDeviceToken");
202
204
  auto __result = method(_javaPart, jni::make_jstring(token));
203
205
  return [&]() {
204
206
  auto __promise = Promise<void>::create();
@@ -213,7 +215,7 @@ namespace margelo::nitro::reactnativedeviceutils {
213
215
  }();
214
216
  }
215
217
  std::shared_ptr<Promise<bool>> JHybridReactNativeDeviceUtilsSpec::registerDeviceToken() {
216
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("registerDeviceToken");
218
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("registerDeviceToken");
217
219
  auto __result = method(_javaPart);
218
220
  return [&]() {
219
221
  auto __promise = Promise<bool>::create();
@@ -229,7 +231,7 @@ namespace margelo::nitro::reactnativedeviceutils {
229
231
  }();
230
232
  }
231
233
  std::shared_ptr<Promise<double>> JHybridReactNativeDeviceUtilsSpec::getStartupTime() {
232
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getStartupTime");
234
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getStartupTime");
233
235
  auto __result = method(_javaPart);
234
236
  return [&]() {
235
237
  auto __promise = Promise<double>::create();
@@ -245,7 +247,7 @@ namespace margelo::nitro::reactnativedeviceutils {
245
247
  }();
246
248
  }
247
249
  std::shared_ptr<Promise<std::string>> JHybridReactNativeDeviceUtilsSpec::getAndClearColdStartLocalNotification() {
248
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getAndClearColdStartLocalNotification");
250
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getAndClearColdStartLocalNotification");
249
251
  auto __result = method(_javaPart);
250
252
  return [&]() {
251
253
  auto __promise = Promise<std::string>::create();
@@ -261,11 +263,11 @@ namespace margelo::nitro::reactnativedeviceutils {
261
263
  }();
262
264
  }
263
265
  void JHybridReactNativeDeviceUtilsSpec::exitApp() {
264
- static const auto method = javaClassStatic()->getMethod<void()>("exitApp");
266
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void()>("exitApp");
265
267
  method(_javaPart);
266
268
  }
267
269
  std::shared_ptr<Promise<WebViewPackageInfo>> JHybridReactNativeDeviceUtilsSpec::getCurrentWebViewPackageInfo() {
268
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getCurrentWebViewPackageInfo");
270
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getCurrentWebViewPackageInfo");
269
271
  auto __result = method(_javaPart);
270
272
  return [&]() {
271
273
  auto __promise = Promise<WebViewPackageInfo>::create();
@@ -281,7 +283,7 @@ namespace margelo::nitro::reactnativedeviceutils {
281
283
  }();
282
284
  }
283
285
  std::shared_ptr<Promise<GooglePlayServicesStatus>> JHybridReactNativeDeviceUtilsSpec::isGooglePlayServicesAvailable() {
284
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("isGooglePlayServicesAvailable");
286
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("isGooglePlayServicesAvailable");
285
287
  auto __result = method(_javaPart);
286
288
  return [&]() {
287
289
  auto __promise = Promise<GooglePlayServicesStatus>::create();
@@ -297,11 +299,11 @@ namespace margelo::nitro::reactnativedeviceutils {
297
299
  }();
298
300
  }
299
301
  void JHybridReactNativeDeviceUtilsSpec::markBootSuccess() {
300
- static const auto method = javaClassStatic()->getMethod<void()>("markBootSuccess");
302
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void()>("markBootSuccess");
301
303
  method(_javaPart);
302
304
  }
303
305
  std::shared_ptr<Promise<double>> JHybridReactNativeDeviceUtilsSpec::getConsecutiveBootFailCount() {
304
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getConsecutiveBootFailCount");
306
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getConsecutiveBootFailCount");
305
307
  auto __result = method(_javaPart);
306
308
  return [&]() {
307
309
  auto __promise = Promise<double>::create();
@@ -317,15 +319,15 @@ namespace margelo::nitro::reactnativedeviceutils {
317
319
  }();
318
320
  }
319
321
  void JHybridReactNativeDeviceUtilsSpec::incrementConsecutiveBootFailCount() {
320
- static const auto method = javaClassStatic()->getMethod<void()>("incrementConsecutiveBootFailCount");
322
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void()>("incrementConsecutiveBootFailCount");
321
323
  method(_javaPart);
322
324
  }
323
325
  void JHybridReactNativeDeviceUtilsSpec::setConsecutiveBootFailCount(double count) {
324
- static const auto method = javaClassStatic()->getMethod<void(double /* count */)>("setConsecutiveBootFailCount");
326
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* count */)>("setConsecutiveBootFailCount");
325
327
  method(_javaPart, count);
326
328
  }
327
329
  std::shared_ptr<Promise<std::string>> JHybridReactNativeDeviceUtilsSpec::getAndClearRecoveryAction() {
328
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getAndClearRecoveryAction");
330
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getAndClearRecoveryAction");
329
331
  auto __result = method(_javaPart);
330
332
  return [&]() {
331
333
  auto __promise = Promise<std::string>::create();
@@ -341,12 +343,12 @@ namespace margelo::nitro::reactnativedeviceutils {
341
343
  }();
342
344
  }
343
345
  AndroidChannel JHybridReactNativeDeviceUtilsSpec::getAndroidChannel() {
344
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JAndroidChannel>()>("getAndroidChannel");
346
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JAndroidChannel>()>("getAndroidChannel");
345
347
  auto __result = method(_javaPart);
346
348
  return __result->toCpp();
347
349
  }
348
350
  InstallerPackageName JHybridReactNativeDeviceUtilsSpec::getInstallerPackageName() {
349
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JInstallerPackageName>()>("getInstallerPackageName");
351
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JInstallerPackageName>()>("getInstallerPackageName");
350
352
  auto __result = method(_javaPart);
351
353
  return __result->toCpp();
352
354
  }
@@ -2,7 +2,7 @@
2
2
  /// HybridReactNativeDeviceUtilsSpec.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -18,33 +18,33 @@ namespace margelo::nitro::reactnativedeviceutils {
18
18
 
19
19
  using namespace facebook;
20
20
 
21
- class JHybridReactNativeDeviceUtilsSpec: public jni::HybridClass<JHybridReactNativeDeviceUtilsSpec, JHybridObject>,
22
- public virtual HybridReactNativeDeviceUtilsSpec {
21
+ class JHybridReactNativeDeviceUtilsSpec: public virtual HybridReactNativeDeviceUtilsSpec, public virtual JHybridObject {
23
22
  public:
24
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/HybridReactNativeDeviceUtilsSpec;";
25
- static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
26
- static void registerNatives();
27
-
28
- protected:
29
- // C++ constructor (called from Java via `initHybrid()`)
30
- explicit JHybridReactNativeDeviceUtilsSpec(jni::alias_ref<jhybridobject> jThis) :
31
- HybridObject(HybridReactNativeDeviceUtilsSpec::TAG),
32
- HybridBase(jThis),
33
- _javaPart(jni::make_global(jThis)) {}
23
+ struct JavaPart: public jni::JavaClass<JavaPart, JHybridObject::JavaPart> {
24
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/HybridReactNativeDeviceUtilsSpec;";
25
+ std::shared_ptr<JHybridReactNativeDeviceUtilsSpec> getJHybridReactNativeDeviceUtilsSpec();
26
+ };
27
+ struct CxxPart: public jni::HybridClass<CxxPart, JHybridObject::CxxPart> {
28
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/HybridReactNativeDeviceUtilsSpec$CxxPart;";
29
+ static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
30
+ static void registerNatives();
31
+ using HybridBase::HybridBase;
32
+ protected:
33
+ std::shared_ptr<JHybridObject> createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) override;
34
+ };
34
35
 
35
36
  public:
37
+ explicit JHybridReactNativeDeviceUtilsSpec(const jni::local_ref<JHybridReactNativeDeviceUtilsSpec::JavaPart>& javaPart):
38
+ HybridObject(HybridReactNativeDeviceUtilsSpec::TAG),
39
+ JHybridObject(javaPart),
40
+ _javaPart(jni::make_global(javaPart)) {}
36
41
  ~JHybridReactNativeDeviceUtilsSpec() override {
37
42
  // Hermes GC can destroy JS objects on a non-JNI Thread.
38
43
  jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
39
44
  }
40
45
 
41
46
  public:
42
- size_t getExternalMemorySize() noexcept override;
43
- void dispose() noexcept override;
44
- std::string toString() override;
45
-
46
- public:
47
- inline const jni::global_ref<JHybridReactNativeDeviceUtilsSpec::javaobject>& getJavaPart() const noexcept {
47
+ inline const jni::global_ref<JHybridReactNativeDeviceUtilsSpec::JavaPart>& getJavaPart() const noexcept {
48
48
  return _javaPart;
49
49
  }
50
50
 
@@ -82,9 +82,7 @@ namespace margelo::nitro::reactnativedeviceutils {
82
82
  InstallerPackageName getInstallerPackageName() override;
83
83
 
84
84
  private:
85
- friend HybridBase;
86
- using HybridBase::HybridBase;
87
- jni::global_ref<JHybridReactNativeDeviceUtilsSpec::javaobject> _javaPart;
85
+ jni::global_ref<JHybridReactNativeDeviceUtilsSpec::JavaPart> _javaPart;
88
86
  };
89
87
 
90
88
  } // namespace margelo::nitro::reactnativedeviceutils
@@ -2,7 +2,7 @@
2
2
  /// JInstallerPackageName.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -19,7 +19,7 @@ namespace margelo::nitro::reactnativedeviceutils {
19
19
  */
20
20
  struct JInstallerPackageName final: public jni::JavaClass<JInstallerPackageName> {
21
21
  public:
22
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/InstallerPackageName;";
22
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/InstallerPackageName;";
23
23
 
24
24
  public:
25
25
  /**
@@ -41,25 +41,24 @@ namespace margelo::nitro::reactnativedeviceutils {
41
41
  [[maybe_unused]]
42
42
  static jni::alias_ref<JInstallerPackageName> fromCpp(InstallerPackageName value) {
43
43
  static const auto clazz = javaClassStatic();
44
- static const auto fieldUNKNOWN = clazz->getStaticField<JInstallerPackageName>("UNKNOWN");
45
- static const auto fieldAPPSTORE = clazz->getStaticField<JInstallerPackageName>("APPSTORE");
46
- static const auto fieldTESTFLIGHT = clazz->getStaticField<JInstallerPackageName>("TESTFLIGHT");
47
- static const auto fieldOTHER = clazz->getStaticField<JInstallerPackageName>("OTHER");
48
- static const auto fieldPLAYSTORE = clazz->getStaticField<JInstallerPackageName>("PLAYSTORE");
49
- static const auto fieldHUAWEIAPPGALLERY = clazz->getStaticField<JInstallerPackageName>("HUAWEIAPPGALLERY");
50
-
51
44
  switch (value) {
52
45
  case InstallerPackageName::UNKNOWN:
46
+ static const auto fieldUNKNOWN = clazz->getStaticField<JInstallerPackageName>("UNKNOWN");
53
47
  return clazz->getStaticFieldValue(fieldUNKNOWN);
54
48
  case InstallerPackageName::APPSTORE:
49
+ static const auto fieldAPPSTORE = clazz->getStaticField<JInstallerPackageName>("APPSTORE");
55
50
  return clazz->getStaticFieldValue(fieldAPPSTORE);
56
51
  case InstallerPackageName::TESTFLIGHT:
52
+ static const auto fieldTESTFLIGHT = clazz->getStaticField<JInstallerPackageName>("TESTFLIGHT");
57
53
  return clazz->getStaticFieldValue(fieldTESTFLIGHT);
58
54
  case InstallerPackageName::OTHER:
55
+ static const auto fieldOTHER = clazz->getStaticField<JInstallerPackageName>("OTHER");
59
56
  return clazz->getStaticFieldValue(fieldOTHER);
60
57
  case InstallerPackageName::PLAYSTORE:
58
+ static const auto fieldPLAYSTORE = clazz->getStaticField<JInstallerPackageName>("PLAYSTORE");
61
59
  return clazz->getStaticFieldValue(fieldPLAYSTORE);
62
60
  case InstallerPackageName::HUAWEIAPPGALLERY:
61
+ static const auto fieldHUAWEIAPPGALLERY = clazz->getStaticField<JInstallerPackageName>("HUAWEIAPPGALLERY");
63
62
  return clazz->getStaticFieldValue(fieldHUAWEIAPPGALLERY);
64
63
  default:
65
64
  std::string stringValue = std::to_string(static_cast<int>(value));
@@ -2,7 +2,7 @@
2
2
  /// JLaunchOptions.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -22,7 +22,7 @@ namespace margelo::nitro::reactnativedeviceutils {
22
22
  */
23
23
  struct JLaunchOptions final: public jni::JavaClass<JLaunchOptions> {
24
24
  public:
25
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/LaunchOptions;";
25
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/LaunchOptions;";
26
26
 
27
27
  public:
28
28
  /**
@@ -2,7 +2,7 @@
2
2
  /// JUserInterfaceStyle.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -19,7 +19,7 @@ namespace margelo::nitro::reactnativedeviceutils {
19
19
  */
20
20
  struct JUserInterfaceStyle final: public jni::JavaClass<JUserInterfaceStyle> {
21
21
  public:
22
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/UserInterfaceStyle;";
22
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/UserInterfaceStyle;";
23
23
 
24
24
  public:
25
25
  /**
@@ -41,16 +41,15 @@ namespace margelo::nitro::reactnativedeviceutils {
41
41
  [[maybe_unused]]
42
42
  static jni::alias_ref<JUserInterfaceStyle> fromCpp(UserInterfaceStyle value) {
43
43
  static const auto clazz = javaClassStatic();
44
- static const auto fieldLIGHT = clazz->getStaticField<JUserInterfaceStyle>("LIGHT");
45
- static const auto fieldDARK = clazz->getStaticField<JUserInterfaceStyle>("DARK");
46
- static const auto fieldUNSPECIFIED = clazz->getStaticField<JUserInterfaceStyle>("UNSPECIFIED");
47
-
48
44
  switch (value) {
49
45
  case UserInterfaceStyle::LIGHT:
46
+ static const auto fieldLIGHT = clazz->getStaticField<JUserInterfaceStyle>("LIGHT");
50
47
  return clazz->getStaticFieldValue(fieldLIGHT);
51
48
  case UserInterfaceStyle::DARK:
49
+ static const auto fieldDARK = clazz->getStaticField<JUserInterfaceStyle>("DARK");
52
50
  return clazz->getStaticFieldValue(fieldDARK);
53
51
  case UserInterfaceStyle::UNSPECIFIED:
52
+ static const auto fieldUNSPECIFIED = clazz->getStaticField<JUserInterfaceStyle>("UNSPECIFIED");
54
53
  return clazz->getStaticFieldValue(fieldUNSPECIFIED);
55
54
  default:
56
55
  std::string stringValue = std::to_string(static_cast<int>(value));
@@ -2,7 +2,7 @@
2
2
  /// JWebViewPackageInfo.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -21,7 +21,7 @@ namespace margelo::nitro::reactnativedeviceutils {
21
21
  */
22
22
  struct JWebViewPackageInfo final: public jni::JavaClass<JWebViewPackageInfo> {
23
23
  public:
24
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/WebViewPackageInfo;";
24
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/WebViewPackageInfo;";
25
25
 
26
26
  public:
27
27
  /**
@@ -2,7 +2,7 @@
2
2
  /// AndroidChannel.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.reactnativedeviceutils
@@ -20,4 +20,6 @@ enum class AndroidChannel(@DoNotStrip @Keep val value: Int) {
20
20
  GOOGLE(1),
21
21
  HUAWEI(2),
22
22
  UNKNOWN(3);
23
+
24
+ companion object
23
25
  }
@@ -2,7 +2,7 @@
2
2
  /// DualScreenInfoRect.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.reactnativedeviceutils
@@ -32,7 +32,7 @@ data class DualScreenInfoRect(
32
32
  ) {
33
33
  /* primary constructor */
34
34
 
35
- private companion object {
35
+ companion object {
36
36
  /**
37
37
  * Constructor called from C++
38
38
  */
@@ -2,7 +2,7 @@
2
2
  /// Func_void_bool.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.reactnativedeviceutils
@@ -2,7 +2,7 @@
2
2
  /// GooglePlayServicesStatus.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.reactnativedeviceutils
@@ -26,7 +26,7 @@ data class GooglePlayServicesStatus(
26
26
  ) {
27
27
  /* primary constructor */
28
28
 
29
- private companion object {
29
+ companion object {
30
30
  /**
31
31
  * Constructor called from C++
32
32
  */