react-native-acoustic-connect-beta 18.0.26 → 18.0.27
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.
- package/AcousticConnectRN.podspec +4 -1
- package/android/src/main/assets/ConnectBasicConfig.properties +1 -1
- package/android/src/main/java/com/acousticconnectrn/HybridAcousticConnectRN.kt +54 -0
- package/ios/HybridAcousticConnectRN.swift +177 -0
- package/lib/typescript/src/specs/react-native-acoustic-connect.nitro.d.ts +109 -0
- package/lib/typescript/src/specs/react-native-acoustic-connect.nitro.d.ts.map +1 -1
- package/nitrogen/generated/android/AcousticConnectRN+autolinking.cmake +1 -0
- package/nitrogen/generated/android/c++/JHybridAcousticConnectRNSpec.cpp +137 -1
- package/nitrogen/generated/android/c++/JHybridAcousticConnectRNSpec.hpp +7 -0
- package/nitrogen/generated/android/c++/JPushErrorInfo.hpp +66 -0
- package/nitrogen/generated/android/c++/JPushPermissionResult.hpp +66 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_Boolean.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_Boolean.hpp +69 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/HybridAcousticConnectRNSpec.kt +30 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/PushErrorInfo.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/PushPermissionResult.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/Variant_NullType_Boolean.kt +62 -0
- package/nitrogen/generated/ios/AcousticConnectRN-Swift-Cxx-Bridge.cpp +32 -0
- package/nitrogen/generated/ios/AcousticConnectRN-Swift-Cxx-Bridge.hpp +249 -0
- package/nitrogen/generated/ios/AcousticConnectRN-Swift-Cxx-Umbrella.hpp +8 -0
- package/nitrogen/generated/ios/c++/HybridAcousticConnectRNSpecSwift.hpp +67 -1
- package/nitrogen/generated/ios/swift/Func_void_PushPermissionResult.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__variant_nitro__NullType__bool_.swift +58 -0
- package/nitrogen/generated/ios/swift/HybridAcousticConnectRNSpec.swift +7 -0
- package/nitrogen/generated/ios/swift/HybridAcousticConnectRNSpec_cxx.swift +205 -0
- package/nitrogen/generated/ios/swift/PushErrorInfo.swift +65 -0
- package/nitrogen/generated/ios/swift/PushPermissionResult.swift +66 -0
- package/nitrogen/generated/ios/swift/Variant_NullType_Bool.swift +30 -0
- package/nitrogen/generated/shared/c++/HybridAcousticConnectRNSpec.cpp +7 -0
- package/nitrogen/generated/shared/c++/HybridAcousticConnectRNSpec.hpp +15 -1
- package/nitrogen/generated/shared/c++/PushErrorInfo.hpp +92 -0
- package/nitrogen/generated/shared/c++/PushPermissionResult.hpp +90 -0
- package/package.json +1 -1
- package/src/specs/react-native-acoustic-connect.nitro.ts +128 -0
|
@@ -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 {
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/PushErrorInfo.kt
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents the JavaScript object/struct "PushErrorInfo".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class PushErrorInfo(
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
val code: Double?,
|
|
23
|
+
@DoNotStrip
|
|
24
|
+
@Keep
|
|
25
|
+
val domain: String?,
|
|
26
|
+
@DoNotStrip
|
|
27
|
+
@Keep
|
|
28
|
+
val message: String
|
|
29
|
+
) {
|
|
30
|
+
/* primary constructor */
|
|
31
|
+
|
|
32
|
+
companion object {
|
|
33
|
+
/**
|
|
34
|
+
* Constructor called from C++
|
|
35
|
+
*/
|
|
36
|
+
@DoNotStrip
|
|
37
|
+
@Keep
|
|
38
|
+
@Suppress("unused")
|
|
39
|
+
@JvmStatic
|
|
40
|
+
private fun fromCpp(code: Double?, domain: String?, message: String): PushErrorInfo {
|
|
41
|
+
return PushErrorInfo(code, domain, message)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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 com.margelo.nitro.core.NullType
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents the JavaScript object/struct "PushPermissionResult".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class PushPermissionResult(
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
val granted: Boolean,
|
|
23
|
+
@DoNotStrip
|
|
24
|
+
@Keep
|
|
25
|
+
val error: Variant_NullType_String?
|
|
26
|
+
) {
|
|
27
|
+
/* primary constructor */
|
|
28
|
+
|
|
29
|
+
companion object {
|
|
30
|
+
/**
|
|
31
|
+
* Constructor called from C++
|
|
32
|
+
*/
|
|
33
|
+
@DoNotStrip
|
|
34
|
+
@Keep
|
|
35
|
+
@Suppress("unused")
|
|
36
|
+
@JvmStatic
|
|
37
|
+
private fun fromCpp(granted: Boolean, error: Variant_NullType_String?): PushPermissionResult {
|
|
38
|
+
return PushPermissionResult(granted, error)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -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);
|