react-native-push-signal 0.1.0
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/LICENSE +20 -0
- package/PushSignal.podspec +31 -0
- package/README.md +125 -0
- package/README.ru.md +125 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +115 -0
- package/android/src/main/AndroidManifest.xml +18 -0
- package/android/src/main/cpp/cpp-adapter.cpp +11 -0
- package/android/src/main/java/com/margelo/nitro/pushsignal/PushSignal.kt +44 -0
- package/android/src/main/java/com/margelo/nitro/pushsignal/PushSignalCenter.kt +353 -0
- package/android/src/main/java/com/margelo/nitro/pushsignal/PushSignalInitProvider.kt +34 -0
- package/android/src/main/java/com/margelo/nitro/pushsignal/PushSignalMessagingService.kt +15 -0
- package/android/src/main/java/com/margelo/nitro/pushsignal/PushSignalPackage.kt +22 -0
- package/ios/PushSignal.swift +38 -0
- package/ios/PushSignalCenter.swift +430 -0
- package/ios/PushSignalLaunchStore.h +21 -0
- package/ios/PushSignalLaunchStore.m +26 -0
- package/lib/module/PushSignal.nitro.js +4 -0
- package/lib/module/PushSignal.nitro.js.map +1 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/pushSignal.js +19 -0
- package/lib/module/pushSignal.js.map +1 -0
- package/lib/module/pushSignal.native.js +46 -0
- package/lib/module/pushSignal.native.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/PushSignal.nitro.d.ts +33 -0
- package/lib/typescript/src/PushSignal.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/pushSignal.d.ts +8 -0
- package/lib/typescript/src/pushSignal.d.ts.map +1 -0
- package/lib/typescript/src/pushSignal.native.d.ts +8 -0
- package/lib/typescript/src/pushSignal.native.d.ts.map +1 -0
- package/nitro.json +23 -0
- package/nitrogen/generated/android/c++/JAndroidFirebaseConfig.hpp +70 -0
- package/nitrogen/generated/android/c++/JFunc_void_PushMessage.hpp +80 -0
- package/nitrogen/generated/android/c++/JHybridPushSignalSpec.cpp +138 -0
- package/nitrogen/generated/android/c++/JHybridPushSignalSpec.hpp +68 -0
- package/nitrogen/generated/android/c++/JPermissionStatus.hpp +61 -0
- package/nitrogen/generated/android/c++/JPushCredentials.hpp +70 -0
- package/nitrogen/generated/android/c++/JPushEnvironment.hpp +58 -0
- package/nitrogen/generated/android/c++/JPushMessage.hpp +84 -0
- package/nitrogen/generated/android/c++/JPushPlatform.hpp +58 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/AndroidFirebaseConfig.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/Func_void_PushMessage.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/HybridPushSignalSpec.kt +87 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/PermissionStatus.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/PushCredentials.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/PushEnvironment.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/PushMessage.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/PushPlatform.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/pushsignalOnLoad.kt +35 -0
- package/nitrogen/generated/android/pushsignal+autolinking.cmake +81 -0
- package/nitrogen/generated/android/pushsignal+autolinking.gradle +27 -0
- package/nitrogen/generated/android/pushsignalOnLoad.cpp +56 -0
- package/nitrogen/generated/android/pushsignalOnLoad.hpp +34 -0
- package/nitrogen/generated/ios/PushSignal+autolinking.rb +62 -0
- package/nitrogen/generated/ios/PushSignal-Swift-Cxx-Bridge.cpp +65 -0
- package/nitrogen/generated/ios/PushSignal-Swift-Cxx-Bridge.hpp +257 -0
- package/nitrogen/generated/ios/PushSignal-Swift-Cxx-Umbrella.hpp +66 -0
- package/nitrogen/generated/ios/PushSignalAutolinking.mm +33 -0
- package/nitrogen/generated/ios/PushSignalAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridPushSignalSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridPushSignalSpecSwift.hpp +137 -0
- package/nitrogen/generated/ios/swift/AndroidFirebaseConfig.swift +96 -0
- package/nitrogen/generated/ios/swift/Func_void_PermissionStatus.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_PushCredentials.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_PushMessage.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridPushSignalSpec.swift +60 -0
- package/nitrogen/generated/ios/swift/HybridPushSignalSpec_cxx.swift +226 -0
- package/nitrogen/generated/ios/swift/PermissionStatus.swift +44 -0
- package/nitrogen/generated/ios/swift/PushCredentials.swift +45 -0
- package/nitrogen/generated/ios/swift/PushEnvironment.swift +40 -0
- package/nitrogen/generated/ios/swift/PushMessage.swift +97 -0
- package/nitrogen/generated/ios/swift/PushPlatform.swift +40 -0
- package/nitrogen/generated/shared/c++/AndroidFirebaseConfig.hpp +96 -0
- package/nitrogen/generated/shared/c++/HybridPushSignalSpec.cpp +26 -0
- package/nitrogen/generated/shared/c++/HybridPushSignalSpec.hpp +79 -0
- package/nitrogen/generated/shared/c++/PermissionStatus.hpp +80 -0
- package/nitrogen/generated/shared/c++/PushCredentials.hpp +97 -0
- package/nitrogen/generated/shared/c++/PushEnvironment.hpp +76 -0
- package/nitrogen/generated/shared/c++/PushMessage.hpp +97 -0
- package/nitrogen/generated/shared/c++/PushPlatform.hpp +76 -0
- package/package.json +187 -0
- package/src/PushSignal.nitro.ts +37 -0
- package/src/index.tsx +16 -0
- package/src/pushSignal.native.tsx +67 -0
- package/src/pushSignal.tsx +32 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridPushSignalSpecSwift.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 "HybridPushSignalSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridPushSignalSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace PushSignal { class HybridPushSignalSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
// Forward declaration of `AndroidFirebaseConfig` to properly resolve imports.
|
|
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
|
+
// Forward declaration of `PushCredentials` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::pushsignal { struct PushCredentials; }
|
|
21
|
+
// Forward declaration of `PushPlatform` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::pushsignal { enum class PushPlatform; }
|
|
23
|
+
// Forward declaration of `PushEnvironment` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::pushsignal { enum class PushEnvironment; }
|
|
25
|
+
// Forward declaration of `PushMessage` to properly resolve imports.
|
|
26
|
+
namespace margelo::nitro::pushsignal { struct PushMessage; }
|
|
27
|
+
|
|
28
|
+
#include "AndroidFirebaseConfig.hpp"
|
|
29
|
+
#include <string>
|
|
30
|
+
#include <optional>
|
|
31
|
+
#include "PermissionStatus.hpp"
|
|
32
|
+
#include <NitroModules/Promise.hpp>
|
|
33
|
+
#include "PushCredentials.hpp"
|
|
34
|
+
#include "PushPlatform.hpp"
|
|
35
|
+
#include "PushEnvironment.hpp"
|
|
36
|
+
#include "PushMessage.hpp"
|
|
37
|
+
#include <functional>
|
|
38
|
+
#include <unordered_map>
|
|
39
|
+
|
|
40
|
+
#include "PushSignal-Swift-Cxx-Umbrella.hpp"
|
|
41
|
+
|
|
42
|
+
namespace margelo::nitro::pushsignal {
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The C++ part of HybridPushSignalSpec_cxx.swift.
|
|
46
|
+
*
|
|
47
|
+
* HybridPushSignalSpecSwift (C++) accesses HybridPushSignalSpec_cxx (Swift), and might
|
|
48
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
49
|
+
*
|
|
50
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
51
|
+
* the future, HybridPushSignalSpec_cxx can directly inherit from the C++ class HybridPushSignalSpec
|
|
52
|
+
* to simplify the whole structure and memory management.
|
|
53
|
+
*/
|
|
54
|
+
class HybridPushSignalSpecSwift: public virtual HybridPushSignalSpec {
|
|
55
|
+
public:
|
|
56
|
+
// Constructor from a Swift instance
|
|
57
|
+
explicit HybridPushSignalSpecSwift(const PushSignal::HybridPushSignalSpec_cxx& swiftPart):
|
|
58
|
+
HybridObject(HybridPushSignalSpec::TAG),
|
|
59
|
+
_swiftPart(swiftPart) { }
|
|
60
|
+
|
|
61
|
+
public:
|
|
62
|
+
// Get the Swift part
|
|
63
|
+
inline PushSignal::HybridPushSignalSpec_cxx& getSwiftPart() noexcept {
|
|
64
|
+
return _swiftPart;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public:
|
|
68
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
69
|
+
return _swiftPart.getMemorySize();
|
|
70
|
+
}
|
|
71
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
72
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridPushSignalSpecSwift>(other)) {
|
|
73
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
74
|
+
}
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
void dispose() noexcept override {
|
|
78
|
+
_swiftPart.dispose();
|
|
79
|
+
}
|
|
80
|
+
std::string toString() override {
|
|
81
|
+
return _swiftPart.toString();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public:
|
|
85
|
+
// Properties
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
public:
|
|
89
|
+
// Methods
|
|
90
|
+
inline void initialize(const AndroidFirebaseConfig& config) override {
|
|
91
|
+
auto __result = _swiftPart.initialize(std::forward<decltype(config)>(config));
|
|
92
|
+
if (__result.hasError()) [[unlikely]] {
|
|
93
|
+
std::rethrow_exception(__result.error());
|
|
94
|
+
}
|
|
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
|
+
auto __value = std::move(__result.value());
|
|
110
|
+
return __value;
|
|
111
|
+
}
|
|
112
|
+
inline std::shared_ptr<Promise<PushCredentials>> getCredentials() override {
|
|
113
|
+
auto __result = _swiftPart.getCredentials();
|
|
114
|
+
if (__result.hasError()) [[unlikely]] {
|
|
115
|
+
std::rethrow_exception(__result.error());
|
|
116
|
+
}
|
|
117
|
+
auto __value = std::move(__result.value());
|
|
118
|
+
return __value;
|
|
119
|
+
}
|
|
120
|
+
inline void setOnMessage(const std::function<void(const PushMessage& /* message */)>& callback) override {
|
|
121
|
+
auto __result = _swiftPart.setOnMessage(callback);
|
|
122
|
+
if (__result.hasError()) [[unlikely]] {
|
|
123
|
+
std::rethrow_exception(__result.error());
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
inline void setOnNotificationPress(const std::function<void(const PushMessage& /* message */)>& callback) override {
|
|
127
|
+
auto __result = _swiftPart.setOnNotificationPress(callback);
|
|
128
|
+
if (__result.hasError()) [[unlikely]] {
|
|
129
|
+
std::rethrow_exception(__result.error());
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
private:
|
|
134
|
+
PushSignal::HybridPushSignalSpec_cxx _swiftPart;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
} // namespace margelo::nitro::pushsignal
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AndroidFirebaseConfig.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `AndroidFirebaseConfig`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias AndroidFirebaseConfig = margelo.nitro.pushsignal.AndroidFirebaseConfig
|
|
14
|
+
|
|
15
|
+
public extension AndroidFirebaseConfig {
|
|
16
|
+
private typealias bridge = margelo.nitro.pushsignal.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `AndroidFirebaseConfig`.
|
|
20
|
+
*/
|
|
21
|
+
init(projectId: String?, applicationId: String?, apiKey: String?, gcmSenderId: String?) {
|
|
22
|
+
self.init({ () -> bridge.std__optional_std__string_ in
|
|
23
|
+
if let __unwrappedValue = projectId {
|
|
24
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
25
|
+
} else {
|
|
26
|
+
return .init()
|
|
27
|
+
}
|
|
28
|
+
}(), { () -> bridge.std__optional_std__string_ in
|
|
29
|
+
if let __unwrappedValue = applicationId {
|
|
30
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
31
|
+
} else {
|
|
32
|
+
return .init()
|
|
33
|
+
}
|
|
34
|
+
}(), { () -> bridge.std__optional_std__string_ in
|
|
35
|
+
if let __unwrappedValue = apiKey {
|
|
36
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
37
|
+
} else {
|
|
38
|
+
return .init()
|
|
39
|
+
}
|
|
40
|
+
}(), { () -> bridge.std__optional_std__string_ in
|
|
41
|
+
if let __unwrappedValue = gcmSenderId {
|
|
42
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
43
|
+
} else {
|
|
44
|
+
return .init()
|
|
45
|
+
}
|
|
46
|
+
}())
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@inline(__always)
|
|
50
|
+
var projectId: String? {
|
|
51
|
+
return { () -> String? in
|
|
52
|
+
if bridge.has_value_std__optional_std__string_(self.__projectId) {
|
|
53
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__projectId)
|
|
54
|
+
return String(__unwrapped)
|
|
55
|
+
} else {
|
|
56
|
+
return nil
|
|
57
|
+
}
|
|
58
|
+
}()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@inline(__always)
|
|
62
|
+
var applicationId: String? {
|
|
63
|
+
return { () -> String? in
|
|
64
|
+
if bridge.has_value_std__optional_std__string_(self.__applicationId) {
|
|
65
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__applicationId)
|
|
66
|
+
return String(__unwrapped)
|
|
67
|
+
} else {
|
|
68
|
+
return nil
|
|
69
|
+
}
|
|
70
|
+
}()
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@inline(__always)
|
|
74
|
+
var apiKey: String? {
|
|
75
|
+
return { () -> String? in
|
|
76
|
+
if bridge.has_value_std__optional_std__string_(self.__apiKey) {
|
|
77
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__apiKey)
|
|
78
|
+
return String(__unwrapped)
|
|
79
|
+
} else {
|
|
80
|
+
return nil
|
|
81
|
+
}
|
|
82
|
+
}()
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@inline(__always)
|
|
86
|
+
var gcmSenderId: String? {
|
|
87
|
+
return { () -> String? in
|
|
88
|
+
if bridge.has_value_std__optional_std__string_(self.__gcmSenderId) {
|
|
89
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__gcmSenderId)
|
|
90
|
+
return String(__unwrapped)
|
|
91
|
+
} else {
|
|
92
|
+
return nil
|
|
93
|
+
}
|
|
94
|
+
}()
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_PermissionStatus.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ value: PermissionStatus) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_PermissionStatus {
|
|
15
|
+
public typealias bridge = margelo.nitro.pushsignal.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ value: PermissionStatus) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ value: PermissionStatus) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(value: Int32) -> Void {
|
|
25
|
+
self.closure(margelo.nitro.pushsignal.PermissionStatus(rawValue: value)!)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_PermissionStatus`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_PermissionStatus>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_PermissionStatus {
|
|
44
|
+
return Unmanaged<Func_void_PermissionStatus>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_PushCredentials.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ value: PushCredentials) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_PushCredentials {
|
|
15
|
+
public typealias bridge = margelo.nitro.pushsignal.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ value: PushCredentials) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ value: PushCredentials) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(value: PushCredentials) -> Void {
|
|
25
|
+
self.closure(value)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_PushCredentials`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_PushCredentials>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_PushCredentials {
|
|
44
|
+
return Unmanaged<Func_void_PushCredentials>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_PushMessage.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ message: PushMessage) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_PushMessage {
|
|
15
|
+
public typealias bridge = margelo.nitro.pushsignal.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ message: PushMessage) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ message: PushMessage) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(message: PushMessage) -> Void {
|
|
25
|
+
self.closure(message)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_PushMessage`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_PushMessage>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_PushMessage {
|
|
44
|
+
return Unmanaged<Func_void_PushMessage>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__exception_ptr.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ error: Error) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_std__exception_ptr {
|
|
15
|
+
public typealias bridge = margelo.nitro.pushsignal.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ error: Error) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ error: Error) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(error: std.exception_ptr) -> Void {
|
|
25
|
+
self.closure(RuntimeError.from(cppError: error))
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_std__exception_ptr`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__exception_ptr>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr {
|
|
44
|
+
return Unmanaged<Func_void_std__exception_ptr>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridPushSignalSpec.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/// See ``HybridPushSignalSpec``
|
|
11
|
+
public protocol HybridPushSignalSpec_protocol: HybridObject {
|
|
12
|
+
// Properties
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
// Methods
|
|
16
|
+
func initialize(config: AndroidFirebaseConfig) throws -> Void
|
|
17
|
+
func getPermissionStatus() throws -> Promise<PermissionStatus>
|
|
18
|
+
func requestPermission() throws -> Promise<PermissionStatus>
|
|
19
|
+
func getCredentials() throws -> Promise<PushCredentials>
|
|
20
|
+
func setOnMessage(callback: @escaping (_ message: PushMessage) -> Void) throws -> Void
|
|
21
|
+
func setOnNotificationPress(callback: @escaping (_ message: PushMessage) -> Void) throws -> Void
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public extension HybridPushSignalSpec_protocol {
|
|
25
|
+
/// Default implementation of ``HybridObject.toString``
|
|
26
|
+
func toString() -> String {
|
|
27
|
+
return "[HybridObject PushSignal]"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/// See ``HybridPushSignalSpec``
|
|
32
|
+
open class HybridPushSignalSpec_base {
|
|
33
|
+
private weak var cxxWrapper: HybridPushSignalSpec_cxx? = nil
|
|
34
|
+
public init() { }
|
|
35
|
+
public func getCxxWrapper() -> HybridPushSignalSpec_cxx {
|
|
36
|
+
#if DEBUG
|
|
37
|
+
guard self is any HybridPushSignalSpec else {
|
|
38
|
+
fatalError("`self` is not a `HybridPushSignalSpec`! Did you accidentally inherit from `HybridPushSignalSpec_base` instead of `HybridPushSignalSpec`?")
|
|
39
|
+
}
|
|
40
|
+
#endif
|
|
41
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
42
|
+
return cxxWrapper
|
|
43
|
+
} else {
|
|
44
|
+
let cxxWrapper = HybridPushSignalSpec_cxx(self as! any HybridPushSignalSpec)
|
|
45
|
+
self.cxxWrapper = cxxWrapper
|
|
46
|
+
return cxxWrapper
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* A Swift base-protocol representing the PushSignal HybridObject.
|
|
53
|
+
* Implement this protocol to create Swift-based instances of PushSignal.
|
|
54
|
+
* ```swift
|
|
55
|
+
* class HybridPushSignal : HybridPushSignalSpec {
|
|
56
|
+
* // ...
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
public typealias HybridPushSignalSpec = HybridPushSignalSpec_protocol & HybridPushSignalSpec_base
|