react-native-push-signal 0.1.0 → 0.1.2
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/README.md +36 -19
- package/README.ru.md +36 -19
- package/android/src/main/java/com/margelo/nitro/pushsignal/PushSignal.kt +10 -16
- package/android/src/main/java/com/margelo/nitro/pushsignal/PushSignalCenter.kt +156 -109
- package/ios/PushSignal.swift +3 -12
- package/ios/PushSignalCenter.swift +36 -41
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/pushSignal.js +1 -7
- package/lib/module/pushSignal.js.map +1 -1
- package/lib/module/pushSignal.native.js +10 -9
- package/lib/module/pushSignal.native.js.map +1 -1
- package/lib/typescript/src/PushSignal.nitro.d.ts +9 -10
- package/lib/typescript/src/PushSignal.nitro.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/pushSignal.d.ts +3 -5
- package/lib/typescript/src/pushSignal.d.ts.map +1 -1
- package/lib/typescript/src/pushSignal.native.d.ts +3 -5
- package/lib/typescript/src/pushSignal.native.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JAndroidFirebaseConfig.hpp +16 -16
- package/nitrogen/generated/android/c++/JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage.hpp +128 -0
- package/nitrogen/generated/android/c++/JHybridPushSignalSpec.cpp +12 -35
- package/nitrogen/generated/android/c++/JHybridPushSignalSpec.hpp +2 -4
- package/nitrogen/generated/android/c++/JPushPlatform.hpp +3 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/AndroidFirebaseConfig.kt +14 -14
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/HybridPushSignalSpec.kt +3 -11
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/PushPlatform.kt +1 -1
- package/nitrogen/generated/android/pushsignalOnLoad.cpp +2 -0
- package/nitrogen/generated/ios/PushSignal-Swift-Cxx-Bridge.cpp +30 -5
- package/nitrogen/generated/ios/PushSignal-Swift-Cxx-Bridge.hpp +140 -52
- package/nitrogen/generated/ios/PushSignal-Swift-Cxx-Umbrella.hpp +0 -3
- package/nitrogen/generated/ios/c++/HybridPushSignalSpecSwift.hpp +3 -20
- package/nitrogen/generated/ios/swift/AndroidFirebaseConfig.swift +17 -17
- package/nitrogen/generated/ios/swift/Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage.swift +61 -0
- package/nitrogen/generated/ios/swift/{Func_void_PermissionStatus.swift → Func_void.swift} +11 -11
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_Promise_bool__.swift +66 -0
- package/nitrogen/generated/ios/swift/HybridPushSignalSpec.swift +2 -4
- package/nitrogen/generated/ios/swift/HybridPushSignalSpec_cxx.swift +34 -43
- package/nitrogen/generated/ios/swift/PushPlatform.swift +4 -4
- package/nitrogen/generated/shared/c++/AndroidFirebaseConfig.hpp +17 -17
- package/nitrogen/generated/shared/c++/HybridPushSignalSpec.cpp +0 -2
- package/nitrogen/generated/shared/c++/HybridPushSignalSpec.hpp +3 -8
- package/nitrogen/generated/shared/c++/PushPlatform.hpp +4 -4
- package/package.json +2 -2
- package/src/PushSignal.nitro.ts +12 -10
- package/src/index.tsx +1 -3
- package/src/pushSignal.native.tsx +17 -17
- package/src/pushSignal.tsx +5 -13
- package/nitrogen/generated/android/c++/JPermissionStatus.hpp +0 -61
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/PermissionStatus.kt +0 -24
- package/nitrogen/generated/ios/swift/PermissionStatus.swift +0 -44
- package/nitrogen/generated/shared/c++/PermissionStatus.hpp +0 -80
package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/AndroidFirebaseConfig.kt
CHANGED
|
@@ -20,34 +20,34 @@ import java.util.Objects
|
|
|
20
20
|
data class AndroidFirebaseConfig(
|
|
21
21
|
@DoNotStrip
|
|
22
22
|
@Keep
|
|
23
|
-
val
|
|
23
|
+
val project_id: String?,
|
|
24
24
|
@DoNotStrip
|
|
25
25
|
@Keep
|
|
26
|
-
val
|
|
26
|
+
val mobilesdk_app_id: String?,
|
|
27
27
|
@DoNotStrip
|
|
28
28
|
@Keep
|
|
29
|
-
val
|
|
29
|
+
val current_key: String?,
|
|
30
30
|
@DoNotStrip
|
|
31
31
|
@Keep
|
|
32
|
-
val
|
|
32
|
+
val project_number: String?
|
|
33
33
|
) {
|
|
34
34
|
/* primary constructor */
|
|
35
35
|
|
|
36
36
|
override fun equals(other: Any?): Boolean {
|
|
37
37
|
if (this === other) return true
|
|
38
38
|
if (other !is AndroidFirebaseConfig) return false
|
|
39
|
-
return Objects.deepEquals(this.
|
|
40
|
-
&& Objects.deepEquals(this.
|
|
41
|
-
&& Objects.deepEquals(this.
|
|
42
|
-
&& Objects.deepEquals(this.
|
|
39
|
+
return Objects.deepEquals(this.project_id, other.project_id)
|
|
40
|
+
&& Objects.deepEquals(this.mobilesdk_app_id, other.mobilesdk_app_id)
|
|
41
|
+
&& Objects.deepEquals(this.current_key, other.current_key)
|
|
42
|
+
&& Objects.deepEquals(this.project_number, other.project_number)
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
override fun hashCode(): Int {
|
|
46
46
|
return arrayOf<Any?>(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
project_id,
|
|
48
|
+
mobilesdk_app_id,
|
|
49
|
+
current_key,
|
|
50
|
+
project_number
|
|
51
51
|
).contentDeepHashCode()
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -59,8 +59,8 @@ data class AndroidFirebaseConfig(
|
|
|
59
59
|
@Keep
|
|
60
60
|
@Suppress("unused")
|
|
61
61
|
@JvmStatic
|
|
62
|
-
private fun fromCpp(
|
|
63
|
-
return AndroidFirebaseConfig(
|
|
62
|
+
private fun fromCpp(project_id: String?, mobilesdk_app_id: String?, current_key: String?, project_number: String?): AndroidFirebaseConfig {
|
|
63
|
+
return AndroidFirebaseConfig(project_id, mobilesdk_app_id, current_key, project_number)
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage.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.pushsignal
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.Promise
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript callback `(message: struct) => std::shared_ptr<Promise<std::shared_ptr<Promise<bool>>>>`.
|
|
17
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
18
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
23
|
+
fun interface Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage: (PushMessage) -> Promise<Promise<Boolean>> {
|
|
24
|
+
/**
|
|
25
|
+
* Call the given JS callback.
|
|
26
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
27
|
+
*/
|
|
28
|
+
@DoNotStrip
|
|
29
|
+
@Keep
|
|
30
|
+
override fun invoke(message: PushMessage): Promise<Promise<Boolean>>
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the JavaScript callback `(message: struct) => std::shared_ptr<Promise<std::shared_ptr<Promise<bool>>>>`.
|
|
35
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
36
|
+
* The callback might be coming from JS.
|
|
37
|
+
*/
|
|
38
|
+
@DoNotStrip
|
|
39
|
+
@Keep
|
|
40
|
+
@Suppress(
|
|
41
|
+
"KotlinJniMissingFunction", "unused",
|
|
42
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
43
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
44
|
+
)
|
|
45
|
+
class Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage_cxx: Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage {
|
|
46
|
+
@DoNotStrip
|
|
47
|
+
@Keep
|
|
48
|
+
private val mHybridData: HybridData
|
|
49
|
+
|
|
50
|
+
@DoNotStrip
|
|
51
|
+
@Keep
|
|
52
|
+
private constructor(hybridData: HybridData) {
|
|
53
|
+
mHybridData = hybridData
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
@Keep
|
|
58
|
+
override fun invoke(message: PushMessage): Promise<Promise<Boolean>>
|
|
59
|
+
= invoke_cxx(message)
|
|
60
|
+
|
|
61
|
+
private external fun invoke_cxx(message: PushMessage): Promise<Promise<Boolean>>
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Represents the JavaScript callback `(message: struct) => std::shared_ptr<Promise<std::shared_ptr<Promise<bool>>>>`.
|
|
66
|
+
* This is implemented in Java/Kotlin, via a `(PushMessage) -> Promise<Promise<Boolean>>`.
|
|
67
|
+
* The callback is always coming from native.
|
|
68
|
+
*/
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
72
|
+
class Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage_java(private val function: (PushMessage) -> Promise<Promise<Boolean>>): Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage {
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
override fun invoke(message: PushMessage): Promise<Promise<Boolean>> {
|
|
76
|
+
return this.function(message)
|
|
77
|
+
}
|
|
78
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/HybridPushSignalSpec.kt
CHANGED
|
@@ -32,25 +32,17 @@ abstract class HybridPushSignalSpec: HybridObject() {
|
|
|
32
32
|
// Methods
|
|
33
33
|
@DoNotStrip
|
|
34
34
|
@Keep
|
|
35
|
-
abstract fun initialize(config: AndroidFirebaseConfig): Unit
|
|
36
|
-
|
|
37
|
-
@DoNotStrip
|
|
38
|
-
@Keep
|
|
39
|
-
abstract fun getPermissionStatus(): Promise<PermissionStatus>
|
|
40
|
-
|
|
41
|
-
@DoNotStrip
|
|
42
|
-
@Keep
|
|
43
|
-
abstract fun requestPermission(): Promise<PermissionStatus>
|
|
35
|
+
abstract fun initialize(config: AndroidFirebaseConfig): Promise<Unit>
|
|
44
36
|
|
|
45
37
|
@DoNotStrip
|
|
46
38
|
@Keep
|
|
47
39
|
abstract fun getCredentials(): Promise<PushCredentials>
|
|
48
40
|
|
|
49
|
-
abstract fun setOnMessage(callback: (message: PushMessage) ->
|
|
41
|
+
abstract fun setOnMessage(callback: (message: PushMessage) -> Promise<Promise<Boolean>>): Unit
|
|
50
42
|
|
|
51
43
|
@DoNotStrip
|
|
52
44
|
@Keep
|
|
53
|
-
private fun setOnMessage_cxx(callback:
|
|
45
|
+
private fun setOnMessage_cxx(callback: Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage): Unit {
|
|
54
46
|
val __result = setOnMessage(callback)
|
|
55
47
|
return __result
|
|
56
48
|
}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
#include <NitroModules/HybridObjectRegistry.hpp>
|
|
17
17
|
|
|
18
18
|
#include "JHybridPushSignalSpec.hpp"
|
|
19
|
+
#include "JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage.hpp"
|
|
19
20
|
#include "JFunc_void_PushMessage.hpp"
|
|
20
21
|
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
21
22
|
|
|
@@ -42,6 +43,7 @@ void registerAllNatives() {
|
|
|
42
43
|
|
|
43
44
|
// Register native JNI methods
|
|
44
45
|
margelo::nitro::pushsignal::JHybridPushSignalSpec::CxxPart::registerNatives();
|
|
46
|
+
margelo::nitro::pushsignal::JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage_cxx::registerNatives();
|
|
45
47
|
margelo::nitro::pushsignal::JFunc_void_PushMessage_cxx::registerNatives();
|
|
46
48
|
|
|
47
49
|
// Register Nitro Hybrid Objects
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
|
|
15
15
|
namespace margelo::nitro::pushsignal::bridge::swift {
|
|
16
16
|
|
|
17
|
-
// pragma MARK: std::function<void(
|
|
18
|
-
|
|
19
|
-
auto swiftClosure = PushSignal::
|
|
20
|
-
return [swiftClosure = std::move(swiftClosure)](
|
|
21
|
-
swiftClosure.call(
|
|
17
|
+
// pragma MARK: std::function<void()>
|
|
18
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
19
|
+
auto swiftClosure = PushSignal::Func_void::fromUnsafe(swiftClosureWrapper);
|
|
20
|
+
return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
|
|
21
|
+
swiftClosure.call();
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -38,6 +38,31 @@ namespace margelo::nitro::pushsignal::bridge::swift {
|
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
// pragma MARK: std::function<void(bool /* result */)>
|
|
42
|
+
Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
43
|
+
auto swiftClosure = PushSignal::Func_void_bool::fromUnsafe(swiftClosureWrapper);
|
|
44
|
+
return [swiftClosure = std::move(swiftClosure)](bool result) mutable -> void {
|
|
45
|
+
swiftClosure.call(result);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// pragma MARK: std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<bool>>>>(const PushMessage& /* message */)>
|
|
50
|
+
Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage create_Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
51
|
+
auto swiftClosure = PushSignal::Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage::fromUnsafe(swiftClosureWrapper);
|
|
52
|
+
return [swiftClosure = std::move(swiftClosure)](const PushMessage& message) mutable -> std::shared_ptr<Promise<std::shared_ptr<Promise<bool>>>> {
|
|
53
|
+
auto __result = swiftClosure.call(message);
|
|
54
|
+
return __result;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// pragma MARK: std::function<void(const std::shared_ptr<Promise<bool>>& /* result */)>
|
|
59
|
+
Func_void_std__shared_ptr_Promise_bool__ create_Func_void_std__shared_ptr_Promise_bool__(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
60
|
+
auto swiftClosure = PushSignal::Func_void_std__shared_ptr_Promise_bool__::fromUnsafe(swiftClosureWrapper);
|
|
61
|
+
return [swiftClosure = std::move(swiftClosure)](const std::shared_ptr<Promise<bool>>& result) mutable -> void {
|
|
62
|
+
swiftClosure.call(result);
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
41
66
|
// pragma MARK: std::function<void(const PushMessage& /* message */)>
|
|
42
67
|
Func_void_PushMessage create_Func_void_PushMessage(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
43
68
|
auto swiftClosure = PushSignal::Func_void_PushMessage::fromUnsafe(swiftClosureWrapper);
|
|
@@ -10,8 +10,6 @@
|
|
|
10
10
|
// Forward declarations of C++ defined types
|
|
11
11
|
// Forward declaration of `HybridPushSignalSpec` to properly resolve imports.
|
|
12
12
|
namespace margelo::nitro::pushsignal { class HybridPushSignalSpec; }
|
|
13
|
-
// Forward declaration of `PermissionStatus` to properly resolve imports.
|
|
14
|
-
namespace margelo::nitro::pushsignal { enum class PermissionStatus; }
|
|
15
13
|
// Forward declaration of `PushCredentials` to properly resolve imports.
|
|
16
14
|
namespace margelo::nitro::pushsignal { struct PushCredentials; }
|
|
17
15
|
// Forward declaration of `PushEnvironment` to properly resolve imports.
|
|
@@ -27,7 +25,6 @@ namespace PushSignal { class HybridPushSignalSpec_cxx; }
|
|
|
27
25
|
|
|
28
26
|
// Include C++ defined types
|
|
29
27
|
#include "HybridPushSignalSpec.hpp"
|
|
30
|
-
#include "PermissionStatus.hpp"
|
|
31
28
|
#include "PushCredentials.hpp"
|
|
32
29
|
#include "PushEnvironment.hpp"
|
|
33
30
|
#include "PushMessage.hpp"
|
|
@@ -48,53 +45,38 @@ namespace PushSignal { class HybridPushSignalSpec_cxx; }
|
|
|
48
45
|
*/
|
|
49
46
|
namespace margelo::nitro::pushsignal::bridge::swift {
|
|
50
47
|
|
|
51
|
-
// pragma MARK: std::
|
|
48
|
+
// pragma MARK: std::shared_ptr<Promise<void>>
|
|
52
49
|
/**
|
|
53
|
-
* Specialized version of `std::
|
|
50
|
+
* Specialized version of `std::shared_ptr<Promise<void>>`.
|
|
54
51
|
*/
|
|
55
|
-
using
|
|
56
|
-
inline std::
|
|
57
|
-
return
|
|
58
|
-
}
|
|
59
|
-
inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
60
|
-
return optional.has_value();
|
|
52
|
+
using std__shared_ptr_Promise_void__ = std::shared_ptr<Promise<void>>;
|
|
53
|
+
inline std::shared_ptr<Promise<void>> create_std__shared_ptr_Promise_void__() noexcept {
|
|
54
|
+
return Promise<void>::create();
|
|
61
55
|
}
|
|
62
|
-
inline
|
|
63
|
-
return
|
|
56
|
+
inline PromiseHolder<void> wrap_std__shared_ptr_Promise_void__(std::shared_ptr<Promise<void>> promise) noexcept {
|
|
57
|
+
return PromiseHolder<void>(std::move(promise));
|
|
64
58
|
}
|
|
65
59
|
|
|
66
|
-
// pragma MARK: std::
|
|
60
|
+
// pragma MARK: std::function<void()>
|
|
67
61
|
/**
|
|
68
|
-
* Specialized version of `std::
|
|
62
|
+
* Specialized version of `std::function<void()>`.
|
|
69
63
|
*/
|
|
70
|
-
using
|
|
71
|
-
inline std::shared_ptr<Promise<PermissionStatus>> create_std__shared_ptr_Promise_PermissionStatus__() noexcept {
|
|
72
|
-
return Promise<PermissionStatus>::create();
|
|
73
|
-
}
|
|
74
|
-
inline PromiseHolder<PermissionStatus> wrap_std__shared_ptr_Promise_PermissionStatus__(std::shared_ptr<Promise<PermissionStatus>> promise) noexcept {
|
|
75
|
-
return PromiseHolder<PermissionStatus>(std::move(promise));
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// pragma MARK: std::function<void(PermissionStatus /* result */)>
|
|
79
|
-
/**
|
|
80
|
-
* Specialized version of `std::function<void(PermissionStatus)>`.
|
|
81
|
-
*/
|
|
82
|
-
using Func_void_PermissionStatus = std::function<void(PermissionStatus /* result */)>;
|
|
64
|
+
using Func_void = std::function<void()>;
|
|
83
65
|
/**
|
|
84
|
-
* Wrapper class for a `std::function<void(
|
|
66
|
+
* Wrapper class for a `std::function<void()>`, this can be used from Swift.
|
|
85
67
|
*/
|
|
86
|
-
class
|
|
68
|
+
class Func_void_Wrapper final {
|
|
87
69
|
public:
|
|
88
|
-
explicit
|
|
89
|
-
inline void call(
|
|
90
|
-
_function->operator()(
|
|
70
|
+
explicit Func_void_Wrapper(std::function<void()>&& func): _function(std::make_unique<std::function<void()>>(std::move(func))) {}
|
|
71
|
+
inline void call() const noexcept {
|
|
72
|
+
_function->operator()();
|
|
91
73
|
}
|
|
92
74
|
private:
|
|
93
|
-
std::unique_ptr<std::function<void(
|
|
75
|
+
std::unique_ptr<std::function<void()>> _function;
|
|
94
76
|
} SWIFT_NONCOPYABLE;
|
|
95
|
-
|
|
96
|
-
inline
|
|
97
|
-
return
|
|
77
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
78
|
+
inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept {
|
|
79
|
+
return Func_void_Wrapper(std::move(value));
|
|
98
80
|
}
|
|
99
81
|
|
|
100
82
|
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
@@ -119,6 +101,21 @@ namespace margelo::nitro::pushsignal::bridge::swift {
|
|
|
119
101
|
return Func_void_std__exception_ptr_Wrapper(std::move(value));
|
|
120
102
|
}
|
|
121
103
|
|
|
104
|
+
// pragma MARK: std::optional<std::string>
|
|
105
|
+
/**
|
|
106
|
+
* Specialized version of `std::optional<std::string>`.
|
|
107
|
+
*/
|
|
108
|
+
using std__optional_std__string_ = std::optional<std::string>;
|
|
109
|
+
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
|
|
110
|
+
return std::optional<std::string>(value);
|
|
111
|
+
}
|
|
112
|
+
inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
113
|
+
return optional.has_value();
|
|
114
|
+
}
|
|
115
|
+
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
116
|
+
return optional.value();
|
|
117
|
+
}
|
|
118
|
+
|
|
122
119
|
// pragma MARK: std::optional<PushEnvironment>
|
|
123
120
|
/**
|
|
124
121
|
* Specialized version of `std::optional<PushEnvironment>`.
|
|
@@ -168,6 +165,40 @@ namespace margelo::nitro::pushsignal::bridge::swift {
|
|
|
168
165
|
return Func_void_PushCredentials_Wrapper(std::move(value));
|
|
169
166
|
}
|
|
170
167
|
|
|
168
|
+
// pragma MARK: std::shared_ptr<Promise<bool>>
|
|
169
|
+
/**
|
|
170
|
+
* Specialized version of `std::shared_ptr<Promise<bool>>`.
|
|
171
|
+
*/
|
|
172
|
+
using std__shared_ptr_Promise_bool__ = std::shared_ptr<Promise<bool>>;
|
|
173
|
+
inline std::shared_ptr<Promise<bool>> create_std__shared_ptr_Promise_bool__() noexcept {
|
|
174
|
+
return Promise<bool>::create();
|
|
175
|
+
}
|
|
176
|
+
inline PromiseHolder<bool> wrap_std__shared_ptr_Promise_bool__(std::shared_ptr<Promise<bool>> promise) noexcept {
|
|
177
|
+
return PromiseHolder<bool>(std::move(promise));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// pragma MARK: std::function<void(bool /* result */)>
|
|
181
|
+
/**
|
|
182
|
+
* Specialized version of `std::function<void(bool)>`.
|
|
183
|
+
*/
|
|
184
|
+
using Func_void_bool = std::function<void(bool /* result */)>;
|
|
185
|
+
/**
|
|
186
|
+
* Wrapper class for a `std::function<void(bool / * result * /)>`, this can be used from Swift.
|
|
187
|
+
*/
|
|
188
|
+
class Func_void_bool_Wrapper final {
|
|
189
|
+
public:
|
|
190
|
+
explicit Func_void_bool_Wrapper(std::function<void(bool /* result */)>&& func): _function(std::make_unique<std::function<void(bool /* result */)>>(std::move(func))) {}
|
|
191
|
+
inline void call(bool result) const noexcept {
|
|
192
|
+
_function->operator()(result);
|
|
193
|
+
}
|
|
194
|
+
private:
|
|
195
|
+
std::unique_ptr<std::function<void(bool /* result */)>> _function;
|
|
196
|
+
} SWIFT_NONCOPYABLE;
|
|
197
|
+
Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
198
|
+
inline Func_void_bool_Wrapper wrap_Func_void_bool(Func_void_bool value) noexcept {
|
|
199
|
+
return Func_void_bool_Wrapper(std::move(value));
|
|
200
|
+
}
|
|
201
|
+
|
|
171
202
|
// pragma MARK: std::unordered_map<std::string, std::string>
|
|
172
203
|
/**
|
|
173
204
|
* Specialized version of `std::unordered_map<std::string, std::string>`.
|
|
@@ -193,6 +224,63 @@ namespace margelo::nitro::pushsignal::bridge::swift {
|
|
|
193
224
|
map.emplace(key, value);
|
|
194
225
|
}
|
|
195
226
|
|
|
227
|
+
// pragma MARK: std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<bool>>>>(const PushMessage& /* message */)>
|
|
228
|
+
/**
|
|
229
|
+
* Specialized version of `std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<bool>>>>(const PushMessage&)>`.
|
|
230
|
+
*/
|
|
231
|
+
using Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage = std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<bool>>>>(const PushMessage& /* message */)>;
|
|
232
|
+
/**
|
|
233
|
+
* Wrapper class for a `std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<bool>>>>(const PushMessage& / * message * /)>`, this can be used from Swift.
|
|
234
|
+
*/
|
|
235
|
+
class Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage_Wrapper final {
|
|
236
|
+
public:
|
|
237
|
+
explicit Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage_Wrapper(std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<bool>>>>(const PushMessage& /* message */)>&& func): _function(std::make_unique<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<bool>>>>(const PushMessage& /* message */)>>(std::move(func))) {}
|
|
238
|
+
inline std::shared_ptr<Promise<std::shared_ptr<Promise<bool>>>> call(PushMessage message) const noexcept {
|
|
239
|
+
auto __result = _function->operator()(message);
|
|
240
|
+
return __result;
|
|
241
|
+
}
|
|
242
|
+
private:
|
|
243
|
+
std::unique_ptr<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<bool>>>>(const PushMessage& /* message */)>> _function;
|
|
244
|
+
} SWIFT_NONCOPYABLE;
|
|
245
|
+
Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage create_Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
246
|
+
inline Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage_Wrapper wrap_Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage(Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage value) noexcept {
|
|
247
|
+
return Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage_Wrapper(std::move(value));
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// pragma MARK: std::shared_ptr<Promise<std::shared_ptr<Promise<bool>>>>
|
|
251
|
+
/**
|
|
252
|
+
* Specialized version of `std::shared_ptr<Promise<std::shared_ptr<Promise<bool>>>>`.
|
|
253
|
+
*/
|
|
254
|
+
using std__shared_ptr_Promise_std__shared_ptr_Promise_bool____ = std::shared_ptr<Promise<std::shared_ptr<Promise<bool>>>>;
|
|
255
|
+
inline std::shared_ptr<Promise<std::shared_ptr<Promise<bool>>>> create_std__shared_ptr_Promise_std__shared_ptr_Promise_bool____() noexcept {
|
|
256
|
+
return Promise<std::shared_ptr<Promise<bool>>>::create();
|
|
257
|
+
}
|
|
258
|
+
inline PromiseHolder<std::shared_ptr<Promise<bool>>> wrap_std__shared_ptr_Promise_std__shared_ptr_Promise_bool____(std::shared_ptr<Promise<std::shared_ptr<Promise<bool>>>> promise) noexcept {
|
|
259
|
+
return PromiseHolder<std::shared_ptr<Promise<bool>>>(std::move(promise));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// pragma MARK: std::function<void(const std::shared_ptr<Promise<bool>>& /* result */)>
|
|
263
|
+
/**
|
|
264
|
+
* Specialized version of `std::function<void(const std::shared_ptr<Promise<bool>>&)>`.
|
|
265
|
+
*/
|
|
266
|
+
using Func_void_std__shared_ptr_Promise_bool__ = std::function<void(const std::shared_ptr<Promise<bool>>& /* result */)>;
|
|
267
|
+
/**
|
|
268
|
+
* Wrapper class for a `std::function<void(const std::shared_ptr<Promise<bool>>& / * result * /)>`, this can be used from Swift.
|
|
269
|
+
*/
|
|
270
|
+
class Func_void_std__shared_ptr_Promise_bool___Wrapper final {
|
|
271
|
+
public:
|
|
272
|
+
explicit Func_void_std__shared_ptr_Promise_bool___Wrapper(std::function<void(const std::shared_ptr<Promise<bool>>& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::shared_ptr<Promise<bool>>& /* result */)>>(std::move(func))) {}
|
|
273
|
+
inline void call(std::shared_ptr<Promise<bool>> result) const noexcept {
|
|
274
|
+
_function->operator()(result);
|
|
275
|
+
}
|
|
276
|
+
private:
|
|
277
|
+
std::unique_ptr<std::function<void(const std::shared_ptr<Promise<bool>>& /* result */)>> _function;
|
|
278
|
+
} SWIFT_NONCOPYABLE;
|
|
279
|
+
Func_void_std__shared_ptr_Promise_bool__ create_Func_void_std__shared_ptr_Promise_bool__(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
280
|
+
inline Func_void_std__shared_ptr_Promise_bool___Wrapper wrap_Func_void_std__shared_ptr_Promise_bool__(Func_void_std__shared_ptr_Promise_bool__ value) noexcept {
|
|
281
|
+
return Func_void_std__shared_ptr_Promise_bool___Wrapper(std::move(value));
|
|
282
|
+
}
|
|
283
|
+
|
|
196
284
|
// pragma MARK: std::function<void(const PushMessage& /* message */)>
|
|
197
285
|
/**
|
|
198
286
|
* Specialized version of `std::function<void(const PushMessage&)>`.
|
|
@@ -227,22 +315,13 @@ namespace margelo::nitro::pushsignal::bridge::swift {
|
|
|
227
315
|
using std__weak_ptr_HybridPushSignalSpec_ = std::weak_ptr<HybridPushSignalSpec>;
|
|
228
316
|
inline std__weak_ptr_HybridPushSignalSpec_ weakify_std__shared_ptr_HybridPushSignalSpec_(const std::shared_ptr<HybridPushSignalSpec>& strong) noexcept { return strong; }
|
|
229
317
|
|
|
230
|
-
// pragma MARK: Result<void
|
|
231
|
-
using
|
|
232
|
-
inline
|
|
233
|
-
return Result<void
|
|
234
|
-
}
|
|
235
|
-
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
236
|
-
return Result<void>::withError(error);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// pragma MARK: Result<std::shared_ptr<Promise<PermissionStatus>>>
|
|
240
|
-
using Result_std__shared_ptr_Promise_PermissionStatus___ = Result<std::shared_ptr<Promise<PermissionStatus>>>;
|
|
241
|
-
inline Result_std__shared_ptr_Promise_PermissionStatus___ create_Result_std__shared_ptr_Promise_PermissionStatus___(const std::shared_ptr<Promise<PermissionStatus>>& value) noexcept {
|
|
242
|
-
return Result<std::shared_ptr<Promise<PermissionStatus>>>::withValue(value);
|
|
318
|
+
// pragma MARK: Result<std::shared_ptr<Promise<void>>>
|
|
319
|
+
using Result_std__shared_ptr_Promise_void___ = Result<std::shared_ptr<Promise<void>>>;
|
|
320
|
+
inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::shared_ptr<Promise<void>>& value) noexcept {
|
|
321
|
+
return Result<std::shared_ptr<Promise<void>>>::withValue(value);
|
|
243
322
|
}
|
|
244
|
-
inline
|
|
245
|
-
return Result<std::shared_ptr<Promise<
|
|
323
|
+
inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::exception_ptr& error) noexcept {
|
|
324
|
+
return Result<std::shared_ptr<Promise<void>>>::withError(error);
|
|
246
325
|
}
|
|
247
326
|
|
|
248
327
|
// pragma MARK: Result<std::shared_ptr<Promise<PushCredentials>>>
|
|
@@ -253,5 +332,14 @@ namespace margelo::nitro::pushsignal::bridge::swift {
|
|
|
253
332
|
inline Result_std__shared_ptr_Promise_PushCredentials___ create_Result_std__shared_ptr_Promise_PushCredentials___(const std::exception_ptr& error) noexcept {
|
|
254
333
|
return Result<std::shared_ptr<Promise<PushCredentials>>>::withError(error);
|
|
255
334
|
}
|
|
335
|
+
|
|
336
|
+
// pragma MARK: Result<void>
|
|
337
|
+
using Result_void_ = Result<void>;
|
|
338
|
+
inline Result_void_ create_Result_void_() noexcept {
|
|
339
|
+
return Result<void>::withValue();
|
|
340
|
+
}
|
|
341
|
+
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
342
|
+
return Result<void>::withError(error);
|
|
343
|
+
}
|
|
256
344
|
|
|
257
345
|
} // namespace margelo::nitro::pushsignal::bridge::swift
|
|
@@ -12,8 +12,6 @@
|
|
|
12
12
|
namespace margelo::nitro::pushsignal { struct AndroidFirebaseConfig; }
|
|
13
13
|
// Forward declaration of `HybridPushSignalSpec` to properly resolve imports.
|
|
14
14
|
namespace margelo::nitro::pushsignal { class HybridPushSignalSpec; }
|
|
15
|
-
// Forward declaration of `PermissionStatus` to properly resolve imports.
|
|
16
|
-
namespace margelo::nitro::pushsignal { enum class PermissionStatus; }
|
|
17
15
|
// Forward declaration of `PushCredentials` to properly resolve imports.
|
|
18
16
|
namespace margelo::nitro::pushsignal { struct PushCredentials; }
|
|
19
17
|
// Forward declaration of `PushEnvironment` to properly resolve imports.
|
|
@@ -26,7 +24,6 @@ namespace margelo::nitro::pushsignal { enum class PushPlatform; }
|
|
|
26
24
|
// Include C++ defined types
|
|
27
25
|
#include "AndroidFirebaseConfig.hpp"
|
|
28
26
|
#include "HybridPushSignalSpec.hpp"
|
|
29
|
-
#include "PermissionStatus.hpp"
|
|
30
27
|
#include "PushCredentials.hpp"
|
|
31
28
|
#include "PushEnvironment.hpp"
|
|
32
29
|
#include "PushMessage.hpp"
|
|
@@ -14,8 +14,6 @@ namespace PushSignal { class HybridPushSignalSpec_cxx; }
|
|
|
14
14
|
|
|
15
15
|
// Forward declaration of `AndroidFirebaseConfig` to properly resolve imports.
|
|
16
16
|
namespace margelo::nitro::pushsignal { struct AndroidFirebaseConfig; }
|
|
17
|
-
// Forward declaration of `PermissionStatus` to properly resolve imports.
|
|
18
|
-
namespace margelo::nitro::pushsignal { enum class PermissionStatus; }
|
|
19
17
|
// Forward declaration of `PushCredentials` to properly resolve imports.
|
|
20
18
|
namespace margelo::nitro::pushsignal { struct PushCredentials; }
|
|
21
19
|
// Forward declaration of `PushPlatform` to properly resolve imports.
|
|
@@ -25,11 +23,10 @@ namespace margelo::nitro::pushsignal { enum class PushEnvironment; }
|
|
|
25
23
|
// Forward declaration of `PushMessage` to properly resolve imports.
|
|
26
24
|
namespace margelo::nitro::pushsignal { struct PushMessage; }
|
|
27
25
|
|
|
26
|
+
#include <NitroModules/Promise.hpp>
|
|
28
27
|
#include "AndroidFirebaseConfig.hpp"
|
|
29
28
|
#include <string>
|
|
30
29
|
#include <optional>
|
|
31
|
-
#include "PermissionStatus.hpp"
|
|
32
|
-
#include <NitroModules/Promise.hpp>
|
|
33
30
|
#include "PushCredentials.hpp"
|
|
34
31
|
#include "PushPlatform.hpp"
|
|
35
32
|
#include "PushEnvironment.hpp"
|
|
@@ -87,25 +84,11 @@ namespace margelo::nitro::pushsignal {
|
|
|
87
84
|
|
|
88
85
|
public:
|
|
89
86
|
// Methods
|
|
90
|
-
inline void initialize(const AndroidFirebaseConfig& config) override {
|
|
87
|
+
inline std::shared_ptr<Promise<void>> initialize(const AndroidFirebaseConfig& config) override {
|
|
91
88
|
auto __result = _swiftPart.initialize(std::forward<decltype(config)>(config));
|
|
92
89
|
if (__result.hasError()) [[unlikely]] {
|
|
93
90
|
std::rethrow_exception(__result.error());
|
|
94
91
|
}
|
|
95
|
-
}
|
|
96
|
-
inline std::shared_ptr<Promise<PermissionStatus>> getPermissionStatus() override {
|
|
97
|
-
auto __result = _swiftPart.getPermissionStatus();
|
|
98
|
-
if (__result.hasError()) [[unlikely]] {
|
|
99
|
-
std::rethrow_exception(__result.error());
|
|
100
|
-
}
|
|
101
|
-
auto __value = std::move(__result.value());
|
|
102
|
-
return __value;
|
|
103
|
-
}
|
|
104
|
-
inline std::shared_ptr<Promise<PermissionStatus>> requestPermission() override {
|
|
105
|
-
auto __result = _swiftPart.requestPermission();
|
|
106
|
-
if (__result.hasError()) [[unlikely]] {
|
|
107
|
-
std::rethrow_exception(__result.error());
|
|
108
|
-
}
|
|
109
92
|
auto __value = std::move(__result.value());
|
|
110
93
|
return __value;
|
|
111
94
|
}
|
|
@@ -117,7 +100,7 @@ namespace margelo::nitro::pushsignal {
|
|
|
117
100
|
auto __value = std::move(__result.value());
|
|
118
101
|
return __value;
|
|
119
102
|
}
|
|
120
|
-
inline void setOnMessage(const std::function<
|
|
103
|
+
inline void setOnMessage(const std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<bool>>>>(const PushMessage& /* message */)>& callback) override {
|
|
121
104
|
auto __result = _swiftPart.setOnMessage(callback);
|
|
122
105
|
if (__result.hasError()) [[unlikely]] {
|
|
123
106
|
std::rethrow_exception(__result.error());
|