react-native-acoustic-connect-beta 18.0.26 → 18.0.28

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/AcousticConnectRN.podspec +7 -4
  2. package/README.md +36 -7
  3. package/android/CMakeLists.txt +1 -1
  4. package/android/build.gradle +1 -1
  5. package/android/src/main/assets/ConnectBasicConfig.properties +1 -1
  6. package/android/src/main/java/com/acousticconnectrn/AcousticConnectRNPackage.java +1 -1
  7. package/android/src/main/java/com/acousticconnectrn/HybridAcousticConnectRN.kt +221 -13
  8. package/ios/Bridge.h +1 -1
  9. package/ios/HybridAcousticConnectRN.swift +179 -2
  10. package/lib/commonjs/TLTRN.js +23 -3
  11. package/lib/commonjs/TLTRN.js.map +1 -1
  12. package/lib/commonjs/components/Connect.js +1 -1
  13. package/lib/commonjs/index.js +13 -2
  14. package/lib/commonjs/index.js.map +1 -1
  15. package/lib/commonjs/utils/withAcousticAutoDialog.js +1 -1
  16. package/lib/module/TLTRN.js +23 -3
  17. package/lib/module/TLTRN.js.map +1 -1
  18. package/lib/module/components/Connect.js +1 -1
  19. package/lib/module/index.js +14 -2
  20. package/lib/module/index.js.map +1 -1
  21. package/lib/module/utils/withAcousticAutoDialog.js +1 -1
  22. package/lib/typescript/src/TLTRN.d.ts.map +1 -1
  23. package/lib/typescript/src/index.d.ts +2 -2
  24. package/lib/typescript/src/index.d.ts.map +1 -1
  25. package/lib/typescript/src/specs/react-native-acoustic-connect.nitro.d.ts +109 -0
  26. package/lib/typescript/src/specs/react-native-acoustic-connect.nitro.d.ts.map +1 -1
  27. package/lib/typescript/src/utils/withAcousticAutoDialog.d.ts +1 -1
  28. package/nitrogen/generated/android/AcousticConnectRN+autolinking.cmake +1 -0
  29. package/nitrogen/generated/android/c++/JHybridAcousticConnectRNSpec.cpp +137 -1
  30. package/nitrogen/generated/android/c++/JHybridAcousticConnectRNSpec.hpp +7 -0
  31. package/nitrogen/generated/android/c++/JPushErrorInfo.hpp +66 -0
  32. package/nitrogen/generated/android/c++/JPushPermissionResult.hpp +66 -0
  33. package/nitrogen/generated/android/c++/JVariant_NullType_Boolean.cpp +26 -0
  34. package/nitrogen/generated/android/c++/JVariant_NullType_Boolean.hpp +69 -0
  35. package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/HybridAcousticConnectRNSpec.kt +30 -0
  36. package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/PushErrorInfo.kt +61 -0
  37. package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/PushPermissionResult.kt +56 -0
  38. package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/Variant_NullType_Boolean.kt +62 -0
  39. package/nitrogen/generated/ios/AcousticConnectRN-Swift-Cxx-Bridge.cpp +32 -0
  40. package/nitrogen/generated/ios/AcousticConnectRN-Swift-Cxx-Bridge.hpp +249 -0
  41. package/nitrogen/generated/ios/AcousticConnectRN-Swift-Cxx-Umbrella.hpp +8 -0
  42. package/nitrogen/generated/ios/c++/HybridAcousticConnectRNSpecSwift.hpp +67 -1
  43. package/nitrogen/generated/ios/swift/Func_void_PushPermissionResult.swift +46 -0
  44. package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
  45. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  46. package/nitrogen/generated/ios/swift/Func_void_std__variant_nitro__NullType__bool_.swift +58 -0
  47. package/nitrogen/generated/ios/swift/HybridAcousticConnectRNSpec.swift +7 -0
  48. package/nitrogen/generated/ios/swift/HybridAcousticConnectRNSpec_cxx.swift +205 -0
  49. package/nitrogen/generated/ios/swift/PushErrorInfo.swift +65 -0
  50. package/nitrogen/generated/ios/swift/PushPermissionResult.swift +66 -0
  51. package/nitrogen/generated/ios/swift/Variant_NullType_Bool.swift +30 -0
  52. package/nitrogen/generated/shared/c++/HybridAcousticConnectRNSpec.cpp +7 -0
  53. package/nitrogen/generated/shared/c++/HybridAcousticConnectRNSpec.hpp +15 -1
  54. package/nitrogen/generated/shared/c++/PushErrorInfo.hpp +92 -0
  55. package/nitrogen/generated/shared/c++/PushPermissionResult.hpp +90 -0
  56. package/package.json +5 -5
  57. package/src/TLTRN.ts +31 -11
  58. package/src/components/Connect.tsx +1 -1
  59. package/src/index.ts +19 -2
  60. package/src/specs/react-native-acoustic-connect.nitro.ts +129 -1
  61. package/src/utils/withAcousticAutoDialog.tsx +1 -1
@@ -7,7 +7,10 @@
7
7
 
8
8
  #include "JHybridAcousticConnectRNSpec.hpp"
9
9
 
10
-
10
+ // Forward declaration of `PushPermissionResult` to properly resolve imports.
11
+ namespace margelo::nitro::acousticconnectrn { struct PushPermissionResult; }
12
+ // Forward declaration of `PushErrorInfo` to properly resolve imports.
13
+ namespace margelo::nitro::acousticconnectrn { struct PushErrorInfo; }
11
14
 
12
15
  #include <NitroModules/Null.hpp>
13
16
  #include <string>
@@ -15,8 +18,17 @@
15
18
  #include <optional>
16
19
  #include "JVariant_NullType_String.hpp"
17
20
  #include <NitroModules/JNull.hpp>
21
+ #include <NitroModules/Promise.hpp>
22
+ #include <NitroModules/JPromise.hpp>
23
+ #include "PushPermissionResult.hpp"
24
+ #include "JPushPermissionResult.hpp"
25
+ #include "JVariant_NullType_Boolean.hpp"
18
26
  #include "JVariant_Boolean_String_Double.hpp"
19
27
  #include <unordered_map>
28
+ #include <NitroModules/ArrayBuffer.hpp>
29
+ #include <NitroModules/JArrayBuffer.hpp>
30
+ #include "PushErrorInfo.hpp"
31
+ #include "JPushErrorInfo.hpp"
20
32
 
21
33
  namespace margelo::nitro::acousticconnectrn {
22
34
 
@@ -189,5 +201,129 @@ namespace margelo::nitro::acousticconnectrn {
189
201
  }());
190
202
  return static_cast<bool>(__result);
191
203
  }
204
+ std::shared_ptr<Promise<bool>> JHybridAcousticConnectRNSpec::pushDidRegisterWithToken(const std::shared_ptr<ArrayBuffer>& deviceToken) {
205
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<JArrayBuffer::javaobject> /* deviceToken */)>("pushDidRegisterWithToken");
206
+ auto __result = method(_javaPart, JArrayBuffer::wrap(deviceToken));
207
+ return [&]() {
208
+ auto __promise = Promise<bool>::create();
209
+ __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
210
+ auto __result = jni::static_ref_cast<jni::JBoolean>(__boxedResult);
211
+ __promise->resolve(static_cast<bool>(__result->value()));
212
+ });
213
+ __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
214
+ jni::JniException __jniError(__throwable);
215
+ __promise->reject(std::make_exception_ptr(__jniError));
216
+ });
217
+ return __promise;
218
+ }();
219
+ }
220
+ std::shared_ptr<Promise<bool>> JHybridAcousticConnectRNSpec::pushDidFailToRegister(const PushErrorInfo& error) {
221
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<JPushErrorInfo> /* error */)>("pushDidFailToRegister");
222
+ auto __result = method(_javaPart, JPushErrorInfo::fromCpp(error));
223
+ return [&]() {
224
+ auto __promise = Promise<bool>::create();
225
+ __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
226
+ auto __result = jni::static_ref_cast<jni::JBoolean>(__boxedResult);
227
+ __promise->resolve(static_cast<bool>(__result->value()));
228
+ });
229
+ __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
230
+ jni::JniException __jniError(__throwable);
231
+ __promise->reject(std::make_exception_ptr(__jniError));
232
+ });
233
+ return __promise;
234
+ }();
235
+ }
236
+ std::shared_ptr<Promise<bool>> JHybridAcousticConnectRNSpec::pushDidReceiveNotification(const std::unordered_map<std::string, std::variant<bool, std::string, double>>& userInfo) {
237
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JMap<jni::JString, JVariant_Boolean_String_Double>> /* userInfo */)>("pushDidReceiveNotification");
238
+ auto __result = method(_javaPart, [&]() -> jni::local_ref<jni::JMap<jni::JString, JVariant_Boolean_String_Double>> {
239
+ auto __map = jni::JHashMap<jni::JString, JVariant_Boolean_String_Double>::create(userInfo.size());
240
+ for (const auto& __entry : userInfo) {
241
+ __map->put(jni::make_jstring(__entry.first), JVariant_Boolean_String_Double::fromCpp(__entry.second));
242
+ }
243
+ return __map;
244
+ }());
245
+ return [&]() {
246
+ auto __promise = Promise<bool>::create();
247
+ __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
248
+ auto __result = jni::static_ref_cast<jni::JBoolean>(__boxedResult);
249
+ __promise->resolve(static_cast<bool>(__result->value()));
250
+ });
251
+ __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
252
+ jni::JniException __jniError(__throwable);
253
+ __promise->reject(std::make_exception_ptr(__jniError));
254
+ });
255
+ return __promise;
256
+ }();
257
+ }
258
+ std::shared_ptr<Promise<bool>> JHybridAcousticConnectRNSpec::pushDidReceiveResponse(const std::string& actionIdentifier, const std::unordered_map<std::string, std::variant<bool, std::string, double>>& userInfo) {
259
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* actionIdentifier */, jni::alias_ref<jni::JMap<jni::JString, JVariant_Boolean_String_Double>> /* userInfo */)>("pushDidReceiveResponse");
260
+ auto __result = method(_javaPart, jni::make_jstring(actionIdentifier), [&]() -> jni::local_ref<jni::JMap<jni::JString, JVariant_Boolean_String_Double>> {
261
+ auto __map = jni::JHashMap<jni::JString, JVariant_Boolean_String_Double>::create(userInfo.size());
262
+ for (const auto& __entry : userInfo) {
263
+ __map->put(jni::make_jstring(__entry.first), JVariant_Boolean_String_Double::fromCpp(__entry.second));
264
+ }
265
+ return __map;
266
+ }());
267
+ return [&]() {
268
+ auto __promise = Promise<bool>::create();
269
+ __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
270
+ auto __result = jni::static_ref_cast<jni::JBoolean>(__boxedResult);
271
+ __promise->resolve(static_cast<bool>(__result->value()));
272
+ });
273
+ __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
274
+ jni::JniException __jniError(__throwable);
275
+ __promise->reject(std::make_exception_ptr(__jniError));
276
+ });
277
+ return __promise;
278
+ }();
279
+ }
280
+ std::shared_ptr<Promise<bool>> JHybridAcousticConnectRNSpec::pushDidReceiveAuthorization(const std::optional<std::variant<nitro::NullType, bool>>& granted, const std::optional<PushErrorInfo>& error) {
281
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<JVariant_NullType_Boolean> /* granted */, jni::alias_ref<JPushErrorInfo> /* error */)>("pushDidReceiveAuthorization");
282
+ auto __result = method(_javaPart, granted.has_value() ? JVariant_NullType_Boolean::fromCpp(granted.value()) : nullptr, error.has_value() ? JPushErrorInfo::fromCpp(error.value()) : nullptr);
283
+ return [&]() {
284
+ auto __promise = Promise<bool>::create();
285
+ __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
286
+ auto __result = jni::static_ref_cast<jni::JBoolean>(__boxedResult);
287
+ __promise->resolve(static_cast<bool>(__result->value()));
288
+ });
289
+ __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
290
+ jni::JniException __jniError(__throwable);
291
+ __promise->reject(std::make_exception_ptr(__jniError));
292
+ });
293
+ return __promise;
294
+ }();
295
+ }
296
+ std::shared_ptr<Promise<PushPermissionResult>> JHybridAcousticConnectRNSpec::pushRequestPermission() {
297
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("pushRequestPermission");
298
+ auto __result = method(_javaPart);
299
+ return [&]() {
300
+ auto __promise = Promise<PushPermissionResult>::create();
301
+ __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
302
+ auto __result = jni::static_ref_cast<JPushPermissionResult>(__boxedResult);
303
+ __promise->resolve(__result->toCpp());
304
+ });
305
+ __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
306
+ jni::JniException __jniError(__throwable);
307
+ __promise->reject(std::make_exception_ptr(__jniError));
308
+ });
309
+ return __promise;
310
+ }();
311
+ }
312
+ std::shared_ptr<Promise<std::variant<nitro::NullType, bool>>> JHybridAcousticConnectRNSpec::pushGetPermissionState() {
313
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("pushGetPermissionState");
314
+ auto __result = method(_javaPart);
315
+ return [&]() {
316
+ auto __promise = Promise<std::variant<nitro::NullType, bool>>::create();
317
+ __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
318
+ auto __result = jni::static_ref_cast<JVariant_NullType_Boolean>(__boxedResult);
319
+ __promise->resolve(__result->toCpp());
320
+ });
321
+ __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
322
+ jni::JniException __jniError(__throwable);
323
+ __promise->reject(std::make_exception_ptr(__jniError));
324
+ });
325
+ return __promise;
326
+ }();
327
+ }
192
328
 
193
329
  } // namespace margelo::nitro::acousticconnectrn
@@ -78,6 +78,13 @@ namespace margelo::nitro::acousticconnectrn {
78
78
  bool logDialogDismissEvent(const std::string& dialogId, const std::string& dismissReason) override;
79
79
  bool logDialogButtonClickEvent(const std::string& dialogId, const std::string& buttonText, double buttonIndex) override;
80
80
  bool logDialogCustomEvent(const std::string& dialogId, const std::string& eventName, const std::unordered_map<std::string, std::variant<bool, std::string, double>>& values) override;
81
+ std::shared_ptr<Promise<bool>> pushDidRegisterWithToken(const std::shared_ptr<ArrayBuffer>& deviceToken) override;
82
+ std::shared_ptr<Promise<bool>> pushDidFailToRegister(const PushErrorInfo& error) override;
83
+ std::shared_ptr<Promise<bool>> pushDidReceiveNotification(const std::unordered_map<std::string, std::variant<bool, std::string, double>>& userInfo) override;
84
+ std::shared_ptr<Promise<bool>> pushDidReceiveResponse(const std::string& actionIdentifier, const std::unordered_map<std::string, std::variant<bool, std::string, double>>& userInfo) override;
85
+ std::shared_ptr<Promise<bool>> pushDidReceiveAuthorization(const std::optional<std::variant<nitro::NullType, bool>>& granted, const std::optional<PushErrorInfo>& error) override;
86
+ std::shared_ptr<Promise<PushPermissionResult>> pushRequestPermission() override;
87
+ std::shared_ptr<Promise<std::variant<nitro::NullType, bool>>> pushGetPermissionState() override;
81
88
 
82
89
  private:
83
90
  jni::global_ref<JHybridAcousticConnectRNSpec::JavaPart> _javaPart;
@@ -0,0 +1,66 @@
1
+ ///
2
+ /// JPushErrorInfo.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <fbjni/fbjni.h>
11
+ #include "PushErrorInfo.hpp"
12
+
13
+ #include <optional>
14
+ #include <string>
15
+
16
+ namespace margelo::nitro::acousticconnectrn {
17
+
18
+ using namespace facebook;
19
+
20
+ /**
21
+ * The C++ JNI bridge between the C++ struct "PushErrorInfo" and the the Kotlin data class "PushErrorInfo".
22
+ */
23
+ struct JPushErrorInfo final: public jni::JavaClass<JPushErrorInfo> {
24
+ public:
25
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/acousticconnectrn/PushErrorInfo;";
26
+
27
+ public:
28
+ /**
29
+ * Convert this Java/Kotlin-based struct to the C++ struct PushErrorInfo by copying all values to C++.
30
+ */
31
+ [[maybe_unused]]
32
+ [[nodiscard]]
33
+ PushErrorInfo toCpp() const {
34
+ static const auto clazz = javaClassStatic();
35
+ static const auto fieldCode = clazz->getField<jni::JDouble>("code");
36
+ jni::local_ref<jni::JDouble> code = this->getFieldValue(fieldCode);
37
+ static const auto fieldDomain = clazz->getField<jni::JString>("domain");
38
+ jni::local_ref<jni::JString> domain = this->getFieldValue(fieldDomain);
39
+ static const auto fieldMessage = clazz->getField<jni::JString>("message");
40
+ jni::local_ref<jni::JString> message = this->getFieldValue(fieldMessage);
41
+ return PushErrorInfo(
42
+ code != nullptr ? std::make_optional(code->value()) : std::nullopt,
43
+ domain != nullptr ? std::make_optional(domain->toStdString()) : std::nullopt,
44
+ message->toStdString()
45
+ );
46
+ }
47
+
48
+ public:
49
+ /**
50
+ * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
51
+ */
52
+ [[maybe_unused]]
53
+ static jni::local_ref<JPushErrorInfo::javaobject> fromCpp(const PushErrorInfo& value) {
54
+ using JSignature = JPushErrorInfo(jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>);
55
+ static const auto clazz = javaClassStatic();
56
+ static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
57
+ return create(
58
+ clazz,
59
+ value.code.has_value() ? jni::JDouble::valueOf(value.code.value()) : nullptr,
60
+ value.domain.has_value() ? jni::make_jstring(value.domain.value()) : nullptr,
61
+ jni::make_jstring(value.message)
62
+ );
63
+ }
64
+ };
65
+
66
+ } // namespace margelo::nitro::acousticconnectrn
@@ -0,0 +1,66 @@
1
+ ///
2
+ /// JPushPermissionResult.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <fbjni/fbjni.h>
11
+ #include "PushPermissionResult.hpp"
12
+
13
+ #include "JVariant_NullType_String.hpp"
14
+ #include <NitroModules/JNull.hpp>
15
+ #include <NitroModules/Null.hpp>
16
+ #include <optional>
17
+ #include <string>
18
+ #include <variant>
19
+
20
+ namespace margelo::nitro::acousticconnectrn {
21
+
22
+ using namespace facebook;
23
+
24
+ /**
25
+ * The C++ JNI bridge between the C++ struct "PushPermissionResult" and the the Kotlin data class "PushPermissionResult".
26
+ */
27
+ struct JPushPermissionResult final: public jni::JavaClass<JPushPermissionResult> {
28
+ public:
29
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/acousticconnectrn/PushPermissionResult;";
30
+
31
+ public:
32
+ /**
33
+ * Convert this Java/Kotlin-based struct to the C++ struct PushPermissionResult by copying all values to C++.
34
+ */
35
+ [[maybe_unused]]
36
+ [[nodiscard]]
37
+ PushPermissionResult toCpp() const {
38
+ static const auto clazz = javaClassStatic();
39
+ static const auto fieldGranted = clazz->getField<jboolean>("granted");
40
+ jboolean granted = this->getFieldValue(fieldGranted);
41
+ static const auto fieldError = clazz->getField<JVariant_NullType_String>("error");
42
+ jni::local_ref<JVariant_NullType_String> error = this->getFieldValue(fieldError);
43
+ return PushPermissionResult(
44
+ static_cast<bool>(granted),
45
+ error != nullptr ? std::make_optional(error->toCpp()) : std::nullopt
46
+ );
47
+ }
48
+
49
+ public:
50
+ /**
51
+ * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
52
+ */
53
+ [[maybe_unused]]
54
+ static jni::local_ref<JPushPermissionResult::javaobject> fromCpp(const PushPermissionResult& value) {
55
+ using JSignature = JPushPermissionResult(jboolean, jni::alias_ref<JVariant_NullType_String>);
56
+ static const auto clazz = javaClassStatic();
57
+ static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
58
+ return create(
59
+ clazz,
60
+ value.granted,
61
+ value.error.has_value() ? JVariant_NullType_String::fromCpp(value.error.value()) : nullptr
62
+ );
63
+ }
64
+ };
65
+
66
+ } // namespace margelo::nitro::acousticconnectrn
@@ -0,0 +1,26 @@
1
+ ///
2
+ /// JVariant_NullType_Boolean.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "JVariant_NullType_Boolean.hpp"
9
+
10
+ namespace margelo::nitro::acousticconnectrn {
11
+ /**
12
+ * Converts JVariant_NullType_Boolean to std::variant<nitro::NullType, bool>
13
+ */
14
+ std::variant<nitro::NullType, bool> JVariant_NullType_Boolean::toCpp() const {
15
+ if (isInstanceOf(JVariant_NullType_Boolean_impl::First::javaClassStatic())) {
16
+ // It's a `nitro::NullType`
17
+ auto jniValue = static_cast<const JVariant_NullType_Boolean_impl::First*>(this)->getValue();
18
+ return nitro::null;
19
+ } else if (isInstanceOf(JVariant_NullType_Boolean_impl::Second::javaClassStatic())) {
20
+ // It's a `bool`
21
+ auto jniValue = static_cast<const JVariant_NullType_Boolean_impl::Second*>(this)->getValue();
22
+ return static_cast<bool>(jniValue);
23
+ }
24
+ throw std::invalid_argument("Variant is unknown Kotlin instance!");
25
+ }
26
+ } // namespace margelo::nitro::acousticconnectrn
@@ -0,0 +1,69 @@
1
+ ///
2
+ /// JVariant_NullType_Boolean.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <fbjni/fbjni.h>
11
+ #include <variant>
12
+
13
+ #include <NitroModules/Null.hpp>
14
+ #include <variant>
15
+ #include <NitroModules/JNull.hpp>
16
+
17
+ namespace margelo::nitro::acousticconnectrn {
18
+
19
+ using namespace facebook;
20
+
21
+ /**
22
+ * The C++ JNI bridge between the C++ std::variant and the Java class "Variant_NullType_Boolean".
23
+ */
24
+ class JVariant_NullType_Boolean: public jni::JavaClass<JVariant_NullType_Boolean> {
25
+ public:
26
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/acousticconnectrn/Variant_NullType_Boolean;";
27
+
28
+ static jni::local_ref<JVariant_NullType_Boolean> create_0(jni::alias_ref<JNull> value) {
29
+ static const auto method = javaClassStatic()->getStaticMethod<JVariant_NullType_Boolean(jni::alias_ref<JNull>)>("create");
30
+ return method(javaClassStatic(), value);
31
+ }
32
+ static jni::local_ref<JVariant_NullType_Boolean> create_1(jboolean value) {
33
+ static const auto method = javaClassStatic()->getStaticMethod<JVariant_NullType_Boolean(jboolean)>("create");
34
+ return method(javaClassStatic(), value);
35
+ }
36
+
37
+ static jni::local_ref<JVariant_NullType_Boolean> fromCpp(const std::variant<nitro::NullType, bool>& variant) {
38
+ switch (variant.index()) {
39
+ case 0: return create_0(JNull::null());
40
+ case 1: return create_1(std::get<1>(variant));
41
+ default: throw std::invalid_argument("Variant holds unknown index! (" + std::to_string(variant.index()) + ")");
42
+ }
43
+ }
44
+
45
+ [[nodiscard]] std::variant<nitro::NullType, bool> toCpp() const;
46
+ };
47
+
48
+ namespace JVariant_NullType_Boolean_impl {
49
+ class First final: public jni::JavaClass<First, JVariant_NullType_Boolean> {
50
+ public:
51
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/acousticconnectrn/Variant_NullType_Boolean$First;";
52
+
53
+ [[nodiscard]] jni::local_ref<JNull> getValue() const {
54
+ static const auto field = javaClassStatic()->getField<JNull>("value");
55
+ return getFieldValue(field);
56
+ }
57
+ };
58
+
59
+ class Second final: public jni::JavaClass<Second, JVariant_NullType_Boolean> {
60
+ public:
61
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/acousticconnectrn/Variant_NullType_Boolean$Second;";
62
+
63
+ [[nodiscard]] jboolean getValue() const {
64
+ static const auto field = javaClassStatic()->getField<jboolean>("value");
65
+ return getFieldValue(field);
66
+ }
67
+ };
68
+ } // namespace JVariant_NullType_Boolean_impl
69
+ } // namespace margelo::nitro::acousticconnectrn
@@ -11,6 +11,8 @@ import androidx.annotation.Keep
11
11
  import com.facebook.jni.HybridData
12
12
  import com.facebook.proguard.annotations.DoNotStrip
13
13
  import com.margelo.nitro.core.NullType
14
+ import com.margelo.nitro.core.Promise
15
+ import com.margelo.nitro.core.ArrayBuffer
14
16
  import com.margelo.nitro.core.HybridObject
15
17
 
16
18
  /**
@@ -124,6 +126,34 @@ abstract class HybridAcousticConnectRNSpec: HybridObject() {
124
126
  @DoNotStrip
125
127
  @Keep
126
128
  abstract fun logDialogCustomEvent(dialogId: String, eventName: String, values: Map<String, Variant_Boolean_String_Double>): Boolean
129
+
130
+ @DoNotStrip
131
+ @Keep
132
+ abstract fun pushDidRegisterWithToken(deviceToken: ArrayBuffer): Promise<Boolean>
133
+
134
+ @DoNotStrip
135
+ @Keep
136
+ abstract fun pushDidFailToRegister(error: PushErrorInfo): Promise<Boolean>
137
+
138
+ @DoNotStrip
139
+ @Keep
140
+ abstract fun pushDidReceiveNotification(userInfo: Map<String, Variant_Boolean_String_Double>): Promise<Boolean>
141
+
142
+ @DoNotStrip
143
+ @Keep
144
+ abstract fun pushDidReceiveResponse(actionIdentifier: String, userInfo: Map<String, Variant_Boolean_String_Double>): Promise<Boolean>
145
+
146
+ @DoNotStrip
147
+ @Keep
148
+ abstract fun pushDidReceiveAuthorization(granted: Variant_NullType_Boolean?, error: PushErrorInfo?): Promise<Boolean>
149
+
150
+ @DoNotStrip
151
+ @Keep
152
+ abstract fun pushRequestPermission(): Promise<PushPermissionResult>
153
+
154
+ @DoNotStrip
155
+ @Keep
156
+ abstract fun pushGetPermissionState(): Promise<Variant_NullType_Boolean>
127
157
 
128
158
  // Default implementation of `HybridObject.toString()`
129
159
  override fun toString(): String {
@@ -0,0 +1,61 @@
1
+ ///
2
+ /// PushErrorInfo.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.acousticconnectrn
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "PushErrorInfo".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class PushErrorInfo(
21
+ @DoNotStrip
22
+ @Keep
23
+ val code: Double?,
24
+ @DoNotStrip
25
+ @Keep
26
+ val domain: String?,
27
+ @DoNotStrip
28
+ @Keep
29
+ val message: String
30
+ ) {
31
+ /* primary constructor */
32
+
33
+ override fun equals(other: Any?): Boolean {
34
+ if (this === other) return true
35
+ if (other !is PushErrorInfo) return false
36
+ return Objects.deepEquals(this.code, other.code)
37
+ && Objects.deepEquals(this.domain, other.domain)
38
+ && Objects.deepEquals(this.message, other.message)
39
+ }
40
+
41
+ override fun hashCode(): Int {
42
+ return arrayOf<Any?>(
43
+ code,
44
+ domain,
45
+ message
46
+ ).contentDeepHashCode()
47
+ }
48
+
49
+ companion object {
50
+ /**
51
+ * Constructor called from C++
52
+ */
53
+ @DoNotStrip
54
+ @Keep
55
+ @Suppress("unused")
56
+ @JvmStatic
57
+ private fun fromCpp(code: Double?, domain: String?, message: String): PushErrorInfo {
58
+ return PushErrorInfo(code, domain, message)
59
+ }
60
+ }
61
+ }
@@ -0,0 +1,56 @@
1
+ ///
2
+ /// PushPermissionResult.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.acousticconnectrn
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
13
+ import com.margelo.nitro.core.NullType
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "PushPermissionResult".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class PushPermissionResult(
21
+ @DoNotStrip
22
+ @Keep
23
+ val granted: Boolean,
24
+ @DoNotStrip
25
+ @Keep
26
+ val error: Variant_NullType_String?
27
+ ) {
28
+ /* primary constructor */
29
+
30
+ override fun equals(other: Any?): Boolean {
31
+ if (this === other) return true
32
+ if (other !is PushPermissionResult) return false
33
+ return Objects.deepEquals(this.granted, other.granted)
34
+ && Objects.deepEquals(this.error, other.error)
35
+ }
36
+
37
+ override fun hashCode(): Int {
38
+ return arrayOf<Any?>(
39
+ granted,
40
+ error
41
+ ).contentDeepHashCode()
42
+ }
43
+
44
+ companion object {
45
+ /**
46
+ * Constructor called from C++
47
+ */
48
+ @DoNotStrip
49
+ @Keep
50
+ @Suppress("unused")
51
+ @JvmStatic
52
+ private fun fromCpp(granted: Boolean, error: Variant_NullType_String?): PushPermissionResult {
53
+ return PushPermissionResult(granted, error)
54
+ }
55
+ }
56
+ }
@@ -0,0 +1,62 @@
1
+ ///
2
+ /// Variant_NullType_Boolean.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.acousticconnectrn
9
+
10
+ import com.facebook.proguard.annotations.DoNotStrip
11
+ import com.margelo.nitro.core.NullType
12
+
13
+ /**
14
+ * Represents the TypeScript variant "NullType | Boolean".
15
+ */
16
+ @Suppress("ClassName")
17
+ @DoNotStrip
18
+ sealed class Variant_NullType_Boolean {
19
+ @DoNotStrip
20
+ data class First(@DoNotStrip val value: NullType): Variant_NullType_Boolean()
21
+ @DoNotStrip
22
+ data class Second(@DoNotStrip val value: Boolean): Variant_NullType_Boolean()
23
+
24
+ inline fun <reified T> asType(): T? {
25
+ return when (this) {
26
+ is First -> (value) as? T
27
+ is Second -> (value) as? T
28
+ }
29
+ }
30
+ inline fun <reified T> isType(): Boolean {
31
+ return asType<T>() != null
32
+ }
33
+ inline fun <R> match(first: (NullType) -> R, second: (Boolean) -> R): R {
34
+ return when (this) {
35
+ is First -> first(value)
36
+ is Second -> second(value)
37
+ }
38
+ }
39
+
40
+ val isFirst: Boolean
41
+ get() = this is First
42
+ val isSecond: Boolean
43
+ get() = this is Second
44
+
45
+ fun asFirstOrNull(): NullType? {
46
+ val value = (this as? First)?.value ?: return null
47
+ return value
48
+ }
49
+ fun asSecondOrNull(): Boolean? {
50
+ val value = (this as? Second)?.value ?: return null
51
+ return value
52
+ }
53
+
54
+ companion object {
55
+ @JvmStatic
56
+ @DoNotStrip
57
+ fun create(value: NullType): Variant_NullType_Boolean = First(value)
58
+ @JvmStatic
59
+ @DoNotStrip
60
+ fun create(value: Boolean): Variant_NullType_Boolean = Second(value)
61
+ }
62
+ }
@@ -14,6 +14,38 @@
14
14
 
15
15
  namespace margelo::nitro::acousticconnectrn::bridge::swift {
16
16
 
17
+ // pragma MARK: std::function<void(bool /* result */)>
18
+ Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
19
+ auto swiftClosure = AcousticConnectRN::Func_void_bool::fromUnsafe(swiftClosureWrapper);
20
+ return [swiftClosure = std::move(swiftClosure)](bool result) mutable -> void {
21
+ swiftClosure.call(result);
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 = AcousticConnectRN::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 PushPermissionResult& /* result */)>
34
+ Func_void_PushPermissionResult create_Func_void_PushPermissionResult(void* NON_NULL swiftClosureWrapper) noexcept {
35
+ auto swiftClosure = AcousticConnectRN::Func_void_PushPermissionResult::fromUnsafe(swiftClosureWrapper);
36
+ return [swiftClosure = std::move(swiftClosure)](const PushPermissionResult& result) mutable -> void {
37
+ swiftClosure.call(result);
38
+ };
39
+ }
40
+
41
+ // pragma MARK: std::function<void(const std::variant<nitro::NullType, bool>& /* result */)>
42
+ Func_void_std__variant_nitro__NullType__bool_ create_Func_void_std__variant_nitro__NullType__bool_(void* NON_NULL swiftClosureWrapper) noexcept {
43
+ auto swiftClosure = AcousticConnectRN::Func_void_std__variant_nitro__NullType__bool_::fromUnsafe(swiftClosureWrapper);
44
+ return [swiftClosure = std::move(swiftClosure)](const std::variant<nitro::NullType, bool>& result) mutable -> void {
45
+ swiftClosure.call(result);
46
+ };
47
+ }
48
+
17
49
  // pragma MARK: std::shared_ptr<HybridAcousticConnectRNSpec>
18
50
  std::shared_ptr<HybridAcousticConnectRNSpec> create_std__shared_ptr_HybridAcousticConnectRNSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
19
51
  AcousticConnectRN::HybridAcousticConnectRNSpec_cxx swiftPart = AcousticConnectRN::HybridAcousticConnectRNSpec_cxx::fromUnsafe(swiftUnsafePointer);