react-native-push-signal 0.1.4 → 0.1.7
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 +1 -1
- package/PushSignal.podspec +2 -12
- package/README.md +3 -11
- package/README.ru.md +3 -11
- package/android/build.gradle +1 -62
- package/android/consumer-rules.pro +3 -3
- package/android/src/main/AndroidManifest.xml +2 -2
- package/android/src/main/java/com/pushsignal/PushModels.kt +15 -0
- package/android/src/main/java/com/{margelo/nitro/pushsignal → pushsignal}/PushSignalCenter.kt +24 -71
- package/android/src/main/java/com/{margelo/nitro/pushsignal → pushsignal}/PushSignalInitProvider.kt +1 -1
- package/android/src/main/java/com/{margelo/nitro/pushsignal → pushsignal}/PushSignalMessagingService.kt +1 -1
- package/android/src/main/java/com/pushsignal/PushSignalModule.kt +88 -0
- package/android/src/main/java/com/pushsignal/PushSignalPackage.kt +30 -0
- package/ios/PushSignal.h +4 -0
- package/ios/PushSignal.mm +57 -0
- package/ios/PushSignalCenter.h +26 -0
- package/ios/PushSignalCenter.m +608 -0
- package/ios/PushSignalLaunchStore.m +6 -9
- package/lib/module/NativePushSignal.js +5 -0
- package/lib/module/NativePushSignal.js.map +1 -0
- package/lib/module/pushSignal.native.js +36 -12
- package/lib/module/pushSignal.native.js.map +1 -1
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/src/NativePushSignal.d.ts +22 -0
- package/lib/typescript/src/NativePushSignal.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/pushSignal.d.ts +1 -1
- package/lib/typescript/src/pushSignal.d.ts.map +1 -1
- package/lib/typescript/src/pushSignal.native.d.ts +1 -1
- package/lib/typescript/src/pushSignal.native.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +22 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +14 -19
- package/src/NativePushSignal.ts +25 -0
- package/src/index.tsx +1 -1
- package/src/pushSignal.native.tsx +60 -22
- package/src/pushSignal.tsx +1 -1
- package/src/types.ts +25 -0
- package/android/CMakeLists.txt +0 -24
- package/android/src/main/cpp/cpp-adapter.cpp +0 -11
- package/android/src/main/java/com/margelo/nitro/pushsignal/PushSignal.kt +0 -38
- package/android/src/main/java/com/margelo/nitro/pushsignal/PushSignalPackage.kt +0 -22
- package/ios/PushSignal.swift +0 -29
- package/ios/PushSignalCenter.swift +0 -588
- package/lib/module/PushSignal.nitro.js +0 -4
- package/lib/module/PushSignal.nitro.js.map +0 -1
- package/lib/typescript/src/PushSignal.nitro.d.ts +0 -32
- package/lib/typescript/src/PushSignal.nitro.d.ts.map +0 -1
- package/nitro.json +0 -23
- package/nitrogen/generated/android/c++/JAndroidFirebaseConfig.hpp +0 -70
- package/nitrogen/generated/android/c++/JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage.hpp +0 -128
- package/nitrogen/generated/android/c++/JFunc_void_PushMessage.hpp +0 -80
- package/nitrogen/generated/android/c++/JHybridPushSignalSpec.cpp +0 -115
- package/nitrogen/generated/android/c++/JHybridPushSignalSpec.hpp +0 -66
- package/nitrogen/generated/android/c++/JPushCredentials.hpp +0 -70
- package/nitrogen/generated/android/c++/JPushEnvironment.hpp +0 -58
- package/nitrogen/generated/android/c++/JPushMessage.hpp +0 -84
- package/nitrogen/generated/android/c++/JPushPlatform.hpp +0 -58
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/AndroidFirebaseConfig.kt +0 -66
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage.kt +0 -78
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/Func_void_PushMessage.kt +0 -78
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/HybridPushSignalSpec.kt +0 -79
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/PushCredentials.kt +0 -61
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/PushEnvironment.kt +0 -23
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/PushMessage.kt +0 -66
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/PushPlatform.kt +0 -23
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pushsignal/pushsignalOnLoad.kt +0 -35
- package/nitrogen/generated/android/pushsignal+autolinking.cmake +0 -81
- package/nitrogen/generated/android/pushsignal+autolinking.gradle +0 -27
- package/nitrogen/generated/android/pushsignalOnLoad.cpp +0 -58
- package/nitrogen/generated/android/pushsignalOnLoad.hpp +0 -34
- package/nitrogen/generated/ios/PushSignal+autolinking.rb +0 -62
- package/nitrogen/generated/ios/PushSignal-Swift-Cxx-Bridge.cpp +0 -90
- package/nitrogen/generated/ios/PushSignal-Swift-Cxx-Bridge.hpp +0 -345
- package/nitrogen/generated/ios/PushSignal-Swift-Cxx-Umbrella.hpp +0 -63
- package/nitrogen/generated/ios/PushSignalAutolinking.mm +0 -33
- package/nitrogen/generated/ios/PushSignalAutolinking.swift +0 -26
- package/nitrogen/generated/ios/c++/HybridPushSignalSpecSwift.cpp +0 -11
- package/nitrogen/generated/ios/c++/HybridPushSignalSpecSwift.hpp +0 -120
- package/nitrogen/generated/ios/swift/AndroidFirebaseConfig.swift +0 -96
- package/nitrogen/generated/ios/swift/Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage.swift +0 -61
- package/nitrogen/generated/ios/swift/Func_void.swift +0 -46
- package/nitrogen/generated/ios/swift/Func_void_PushCredentials.swift +0 -46
- package/nitrogen/generated/ios/swift/Func_void_PushMessage.swift +0 -46
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +0 -46
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +0 -46
- package/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_Promise_bool__.swift +0 -66
- package/nitrogen/generated/ios/swift/HybridPushSignalSpec.swift +0 -58
- package/nitrogen/generated/ios/swift/HybridPushSignalSpec_cxx.swift +0 -217
- package/nitrogen/generated/ios/swift/PushCredentials.swift +0 -45
- package/nitrogen/generated/ios/swift/PushEnvironment.swift +0 -40
- package/nitrogen/generated/ios/swift/PushMessage.swift +0 -97
- package/nitrogen/generated/ios/swift/PushPlatform.swift +0 -40
- package/nitrogen/generated/shared/c++/AndroidFirebaseConfig.hpp +0 -96
- package/nitrogen/generated/shared/c++/HybridPushSignalSpec.cpp +0 -24
- package/nitrogen/generated/shared/c++/HybridPushSignalSpec.hpp +0 -74
- package/nitrogen/generated/shared/c++/PushCredentials.hpp +0 -97
- package/nitrogen/generated/shared/c++/PushEnvironment.hpp +0 -76
- package/nitrogen/generated/shared/c++/PushMessage.hpp +0 -97
- package/nitrogen/generated/shared/c++/PushPlatform.hpp +0 -76
- package/src/PushSignal.nitro.ts +0 -39
|
@@ -1,58 +0,0 @@
|
|
|
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 -> Promise<Void>
|
|
17
|
-
func getCredentials() throws -> Promise<PushCredentials>
|
|
18
|
-
func setOnMessage(callback: @escaping (_ message: PushMessage) -> Promise<Promise<Bool>>) throws -> Void
|
|
19
|
-
func setOnNotificationPress(callback: @escaping (_ message: PushMessage) -> Void) throws -> Void
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public extension HybridPushSignalSpec_protocol {
|
|
23
|
-
/// Default implementation of ``HybridObject.toString``
|
|
24
|
-
func toString() -> String {
|
|
25
|
-
return "[HybridObject PushSignal]"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/// See ``HybridPushSignalSpec``
|
|
30
|
-
open class HybridPushSignalSpec_base {
|
|
31
|
-
private weak var cxxWrapper: HybridPushSignalSpec_cxx? = nil
|
|
32
|
-
public init() { }
|
|
33
|
-
public func getCxxWrapper() -> HybridPushSignalSpec_cxx {
|
|
34
|
-
#if DEBUG
|
|
35
|
-
guard self is any HybridPushSignalSpec else {
|
|
36
|
-
fatalError("`self` is not a `HybridPushSignalSpec`! Did you accidentally inherit from `HybridPushSignalSpec_base` instead of `HybridPushSignalSpec`?")
|
|
37
|
-
}
|
|
38
|
-
#endif
|
|
39
|
-
if let cxxWrapper = self.cxxWrapper {
|
|
40
|
-
return cxxWrapper
|
|
41
|
-
} else {
|
|
42
|
-
let cxxWrapper = HybridPushSignalSpec_cxx(self as! any HybridPushSignalSpec)
|
|
43
|
-
self.cxxWrapper = cxxWrapper
|
|
44
|
-
return cxxWrapper
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* A Swift base-protocol representing the PushSignal HybridObject.
|
|
51
|
-
* Implement this protocol to create Swift-based instances of PushSignal.
|
|
52
|
-
* ```swift
|
|
53
|
-
* class HybridPushSignal : HybridPushSignalSpec {
|
|
54
|
-
* // ...
|
|
55
|
-
* }
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
public typealias HybridPushSignalSpec = HybridPushSignalSpec_protocol & HybridPushSignalSpec_base
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridPushSignalSpec_cxx.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
|
-
* A class implementation that bridges HybridPushSignalSpec over to C++.
|
|
12
|
-
* In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
|
|
13
|
-
*
|
|
14
|
-
* Also, some Swift types need to be bridged with special handling:
|
|
15
|
-
* - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
|
|
16
|
-
* - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
|
|
17
|
-
* - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
|
|
18
|
-
*/
|
|
19
|
-
open class HybridPushSignalSpec_cxx {
|
|
20
|
-
/**
|
|
21
|
-
* The Swift <> C++ bridge's namespace (`margelo::nitro::pushsignal::bridge::swift`)
|
|
22
|
-
* from `PushSignal-Swift-Cxx-Bridge.hpp`.
|
|
23
|
-
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
|
24
|
-
*/
|
|
25
|
-
public typealias bridge = margelo.nitro.pushsignal.bridge.swift
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Holds an instance of the `HybridPushSignalSpec` Swift protocol.
|
|
29
|
-
*/
|
|
30
|
-
private var __implementation: any HybridPushSignalSpec
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
|
34
|
-
*/
|
|
35
|
-
private var __cxxPart: bridge.std__weak_ptr_HybridPushSignalSpec_
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Create a new `HybridPushSignalSpec_cxx` that wraps the given `HybridPushSignalSpec`.
|
|
39
|
-
* All properties and methods bridge to C++ types.
|
|
40
|
-
*/
|
|
41
|
-
public init(_ implementation: any HybridPushSignalSpec) {
|
|
42
|
-
self.__implementation = implementation
|
|
43
|
-
self.__cxxPart = .init()
|
|
44
|
-
/* no base class */
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Get the actual `HybridPushSignalSpec` instance this class wraps.
|
|
49
|
-
*/
|
|
50
|
-
@inline(__always)
|
|
51
|
-
public func getHybridPushSignalSpec() -> any HybridPushSignalSpec {
|
|
52
|
-
return __implementation
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Casts this instance to a retained unsafe raw pointer.
|
|
57
|
-
* This acquires one additional strong reference on the object!
|
|
58
|
-
*/
|
|
59
|
-
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
60
|
-
return Unmanaged.passRetained(self).toOpaque()
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Casts an unsafe pointer to a `HybridPushSignalSpec_cxx`.
|
|
65
|
-
* The pointer has to be a retained opaque `Unmanaged<HybridPushSignalSpec_cxx>`.
|
|
66
|
-
* This removes one strong reference from the object!
|
|
67
|
-
*/
|
|
68
|
-
public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridPushSignalSpec_cxx {
|
|
69
|
-
return Unmanaged<HybridPushSignalSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Gets (or creates) the C++ part of this Hybrid Object.
|
|
74
|
-
* The C++ part is a `std::shared_ptr<HybridPushSignalSpec>`.
|
|
75
|
-
*/
|
|
76
|
-
public func getCxxPart() -> bridge.std__shared_ptr_HybridPushSignalSpec_ {
|
|
77
|
-
let cachedCxxPart = self.__cxxPart.lock()
|
|
78
|
-
if Bool(fromCxx: cachedCxxPart) {
|
|
79
|
-
return cachedCxxPart
|
|
80
|
-
} else {
|
|
81
|
-
let newCxxPart = bridge.create_std__shared_ptr_HybridPushSignalSpec_(self.toUnsafe())
|
|
82
|
-
__cxxPart = bridge.weakify_std__shared_ptr_HybridPushSignalSpec_(newCxxPart)
|
|
83
|
-
return newCxxPart
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Get the memory size of the Swift class (plus size of any other allocations)
|
|
91
|
-
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
|
92
|
-
*/
|
|
93
|
-
@inline(__always)
|
|
94
|
-
public var memorySize: Int {
|
|
95
|
-
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Compares this object with the given [other] object for reference equality.
|
|
100
|
-
*/
|
|
101
|
-
@inline(__always)
|
|
102
|
-
public func equals(other: HybridPushSignalSpec_cxx) -> Bool {
|
|
103
|
-
return self.__implementation === other.__implementation
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Call dispose() on the Swift class.
|
|
108
|
-
* This _may_ be called manually from JS.
|
|
109
|
-
*/
|
|
110
|
-
@inline(__always)
|
|
111
|
-
public func dispose() {
|
|
112
|
-
self.__implementation.dispose()
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Call toString() on the Swift class.
|
|
117
|
-
*/
|
|
118
|
-
@inline(__always)
|
|
119
|
-
public func toString() -> String {
|
|
120
|
-
return self.__implementation.toString()
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Properties
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
// Methods
|
|
127
|
-
@inline(__always)
|
|
128
|
-
public final func initialize(config: AndroidFirebaseConfig) -> bridge.Result_std__shared_ptr_Promise_void___ {
|
|
129
|
-
do {
|
|
130
|
-
let __result = try self.__implementation.initialize(config: config)
|
|
131
|
-
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
|
|
132
|
-
let __promise = bridge.create_std__shared_ptr_Promise_void__()
|
|
133
|
-
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
|
|
134
|
-
__result
|
|
135
|
-
.then({ __result in __promiseHolder.resolve() })
|
|
136
|
-
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
137
|
-
return __promise
|
|
138
|
-
}()
|
|
139
|
-
return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
|
|
140
|
-
} catch (let __error) {
|
|
141
|
-
let __exceptionPtr = __error.toCpp()
|
|
142
|
-
return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
@inline(__always)
|
|
147
|
-
public final func getCredentials() -> bridge.Result_std__shared_ptr_Promise_PushCredentials___ {
|
|
148
|
-
do {
|
|
149
|
-
let __result = try self.__implementation.getCredentials()
|
|
150
|
-
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_PushCredentials__ in
|
|
151
|
-
let __promise = bridge.create_std__shared_ptr_Promise_PushCredentials__()
|
|
152
|
-
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_PushCredentials__(__promise)
|
|
153
|
-
__result
|
|
154
|
-
.then({ __result in __promiseHolder.resolve(__result) })
|
|
155
|
-
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
156
|
-
return __promise
|
|
157
|
-
}()
|
|
158
|
-
return bridge.create_Result_std__shared_ptr_Promise_PushCredentials___(__resultCpp)
|
|
159
|
-
} catch (let __error) {
|
|
160
|
-
let __exceptionPtr = __error.toCpp()
|
|
161
|
-
return bridge.create_Result_std__shared_ptr_Promise_PushCredentials___(__exceptionPtr)
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
@inline(__always)
|
|
166
|
-
public final func setOnMessage(callback: bridge.Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage) -> bridge.Result_void_ {
|
|
167
|
-
do {
|
|
168
|
-
try self.__implementation.setOnMessage(callback: { () -> (PushMessage) -> Promise<Promise<Bool>> in
|
|
169
|
-
let __wrappedFunction = bridge.wrap_Func_std__shared_ptr_Promise_std__shared_ptr_Promise_bool_____PushMessage(callback)
|
|
170
|
-
return { (__message: PushMessage) -> Promise<Promise<Bool>> in
|
|
171
|
-
let __result = __wrappedFunction.call(__message)
|
|
172
|
-
return { () -> Promise<Promise<Bool>> in
|
|
173
|
-
let __promise = Promise<Promise<Bool>>()
|
|
174
|
-
let __resolver = { (__result: Promise<Bool>) in
|
|
175
|
-
__promise.resolve(withResult: __result)
|
|
176
|
-
}
|
|
177
|
-
let __rejecter = { (__error: Error) in
|
|
178
|
-
__promise.reject(withError: __error)
|
|
179
|
-
}
|
|
180
|
-
let __resolverCpp = { () -> bridge.Func_void_std__shared_ptr_Promise_bool__ in
|
|
181
|
-
let __closureWrapper = Func_void_std__shared_ptr_Promise_bool__(__resolver)
|
|
182
|
-
return bridge.create_Func_void_std__shared_ptr_Promise_bool__(__closureWrapper.toUnsafe())
|
|
183
|
-
}()
|
|
184
|
-
let __rejecterCpp = { () -> bridge.Func_void_std__exception_ptr in
|
|
185
|
-
let __closureWrapper = Func_void_std__exception_ptr(__rejecter)
|
|
186
|
-
return bridge.create_Func_void_std__exception_ptr(__closureWrapper.toUnsafe())
|
|
187
|
-
}()
|
|
188
|
-
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__shared_ptr_Promise_bool____(__result)
|
|
189
|
-
__promiseHolder.addOnResolvedListener(__resolverCpp)
|
|
190
|
-
__promiseHolder.addOnRejectedListener(__rejecterCpp)
|
|
191
|
-
return __promise
|
|
192
|
-
}()
|
|
193
|
-
}
|
|
194
|
-
}())
|
|
195
|
-
return bridge.create_Result_void_()
|
|
196
|
-
} catch (let __error) {
|
|
197
|
-
let __exceptionPtr = __error.toCpp()
|
|
198
|
-
return bridge.create_Result_void_(__exceptionPtr)
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
@inline(__always)
|
|
203
|
-
public final func setOnNotificationPress(callback: bridge.Func_void_PushMessage) -> bridge.Result_void_ {
|
|
204
|
-
do {
|
|
205
|
-
try self.__implementation.setOnNotificationPress(callback: { () -> (PushMessage) -> Void in
|
|
206
|
-
let __wrappedFunction = bridge.wrap_Func_void_PushMessage(callback)
|
|
207
|
-
return { (__message: PushMessage) -> Void in
|
|
208
|
-
__wrappedFunction.call(__message)
|
|
209
|
-
}
|
|
210
|
-
}())
|
|
211
|
-
return bridge.create_Result_void_()
|
|
212
|
-
} catch (let __error) {
|
|
213
|
-
let __exceptionPtr = __error.toCpp()
|
|
214
|
-
return bridge.create_Result_void_(__exceptionPtr)
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// 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
|
-
* Represents an instance of `PushCredentials`, backed by a C++ struct.
|
|
12
|
-
*/
|
|
13
|
-
public typealias PushCredentials = margelo.nitro.pushsignal.PushCredentials
|
|
14
|
-
|
|
15
|
-
public extension PushCredentials {
|
|
16
|
-
private typealias bridge = margelo.nitro.pushsignal.bridge.swift
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Create a new instance of `PushCredentials`.
|
|
20
|
-
*/
|
|
21
|
-
init(platform: PushPlatform, token: String, environment: PushEnvironment?) {
|
|
22
|
-
self.init(platform, std.string(token), { () -> bridge.std__optional_PushEnvironment_ in
|
|
23
|
-
if let __unwrappedValue = environment {
|
|
24
|
-
return bridge.create_std__optional_PushEnvironment_(__unwrappedValue)
|
|
25
|
-
} else {
|
|
26
|
-
return .init()
|
|
27
|
-
}
|
|
28
|
-
}())
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@inline(__always)
|
|
32
|
-
var platform: PushPlatform {
|
|
33
|
-
return self.__platform
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@inline(__always)
|
|
37
|
-
var token: String {
|
|
38
|
-
return String(self.__token)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
@inline(__always)
|
|
42
|
-
var environment: PushEnvironment? {
|
|
43
|
-
return self.__environment.value
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// PushEnvironment.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
|
-
/**
|
|
9
|
-
* Represents the JS union `PushEnvironment`, backed by a C++ enum.
|
|
10
|
-
*/
|
|
11
|
-
public typealias PushEnvironment = margelo.nitro.pushsignal.PushEnvironment
|
|
12
|
-
|
|
13
|
-
public extension PushEnvironment {
|
|
14
|
-
/**
|
|
15
|
-
* Get a PushEnvironment for the given String value, or
|
|
16
|
-
* return `nil` if the given value was invalid/unknown.
|
|
17
|
-
*/
|
|
18
|
-
init?(fromString string: String) {
|
|
19
|
-
switch string {
|
|
20
|
-
case "sandbox":
|
|
21
|
-
self = .sandbox
|
|
22
|
-
case "production":
|
|
23
|
-
self = .production
|
|
24
|
-
default:
|
|
25
|
-
return nil
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Get the String value this PushEnvironment represents.
|
|
31
|
-
*/
|
|
32
|
-
var stringValue: String {
|
|
33
|
-
switch self {
|
|
34
|
-
case .sandbox:
|
|
35
|
-
return "sandbox"
|
|
36
|
-
case .production:
|
|
37
|
-
return "production"
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// 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
|
-
* Represents an instance of `PushMessage`, backed by a C++ struct.
|
|
12
|
-
*/
|
|
13
|
-
public typealias PushMessage = margelo.nitro.pushsignal.PushMessage
|
|
14
|
-
|
|
15
|
-
public extension PushMessage {
|
|
16
|
-
private typealias bridge = margelo.nitro.pushsignal.bridge.swift
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Create a new instance of `PushMessage`.
|
|
20
|
-
*/
|
|
21
|
-
init(id: String?, title: String?, body: String?, data: Dictionary<String, String>) {
|
|
22
|
-
self.init({ () -> bridge.std__optional_std__string_ in
|
|
23
|
-
if let __unwrappedValue = id {
|
|
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 = title {
|
|
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 = body {
|
|
36
|
-
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
37
|
-
} else {
|
|
38
|
-
return .init()
|
|
39
|
-
}
|
|
40
|
-
}(), { () -> bridge.std__unordered_map_std__string__std__string_ in
|
|
41
|
-
var __map = bridge.create_std__unordered_map_std__string__std__string_(data.count)
|
|
42
|
-
for (__k, __v) in data {
|
|
43
|
-
bridge.emplace_std__unordered_map_std__string__std__string_(&__map, std.string(__k), std.string(__v))
|
|
44
|
-
}
|
|
45
|
-
return __map
|
|
46
|
-
}())
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@inline(__always)
|
|
50
|
-
var id: String? {
|
|
51
|
-
return { () -> String? in
|
|
52
|
-
if bridge.has_value_std__optional_std__string_(self.__id) {
|
|
53
|
-
let __unwrapped = bridge.get_std__optional_std__string_(self.__id)
|
|
54
|
-
return String(__unwrapped)
|
|
55
|
-
} else {
|
|
56
|
-
return nil
|
|
57
|
-
}
|
|
58
|
-
}()
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
@inline(__always)
|
|
62
|
-
var title: String? {
|
|
63
|
-
return { () -> String? in
|
|
64
|
-
if bridge.has_value_std__optional_std__string_(self.__title) {
|
|
65
|
-
let __unwrapped = bridge.get_std__optional_std__string_(self.__title)
|
|
66
|
-
return String(__unwrapped)
|
|
67
|
-
} else {
|
|
68
|
-
return nil
|
|
69
|
-
}
|
|
70
|
-
}()
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
@inline(__always)
|
|
74
|
-
var body: String? {
|
|
75
|
-
return { () -> String? in
|
|
76
|
-
if bridge.has_value_std__optional_std__string_(self.__body) {
|
|
77
|
-
let __unwrapped = bridge.get_std__optional_std__string_(self.__body)
|
|
78
|
-
return String(__unwrapped)
|
|
79
|
-
} else {
|
|
80
|
-
return nil
|
|
81
|
-
}
|
|
82
|
-
}()
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
@inline(__always)
|
|
86
|
-
var data: Dictionary<String, String> {
|
|
87
|
-
return { () -> Dictionary<String, String> in
|
|
88
|
-
var __dictionary = Dictionary<String, String>(minimumCapacity: self.__data.size())
|
|
89
|
-
let __keys = bridge.get_std__unordered_map_std__string__std__string__keys(self.__data)
|
|
90
|
-
for __key in __keys {
|
|
91
|
-
let __value = bridge.get_std__unordered_map_std__string__std__string__value(self.__data, __key)
|
|
92
|
-
__dictionary[String(__key)] = String(__value)
|
|
93
|
-
}
|
|
94
|
-
return __dictionary
|
|
95
|
-
}()
|
|
96
|
-
}
|
|
97
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// PushPlatform.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
|
-
/**
|
|
9
|
-
* Represents the JS union `PushPlatform`, backed by a C++ enum.
|
|
10
|
-
*/
|
|
11
|
-
public typealias PushPlatform = margelo.nitro.pushsignal.PushPlatform
|
|
12
|
-
|
|
13
|
-
public extension PushPlatform {
|
|
14
|
-
/**
|
|
15
|
-
* Get a PushPlatform for the given String value, or
|
|
16
|
-
* return `nil` if the given value was invalid/unknown.
|
|
17
|
-
*/
|
|
18
|
-
init?(fromString string: String) {
|
|
19
|
-
switch string {
|
|
20
|
-
case "ios":
|
|
21
|
-
self = .ios
|
|
22
|
-
case "android_os":
|
|
23
|
-
self = .androidOs
|
|
24
|
-
default:
|
|
25
|
-
return nil
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Get the String value this PushPlatform represents.
|
|
31
|
-
*/
|
|
32
|
-
var stringValue: String {
|
|
33
|
-
switch self {
|
|
34
|
-
case .ios:
|
|
35
|
-
return "ios"
|
|
36
|
-
case .androidOs:
|
|
37
|
-
return "android_os"
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// AndroidFirebaseConfig.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
|
-
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
-
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
-
#else
|
|
13
|
-
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
-
#endif
|
|
15
|
-
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
-
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
-
#else
|
|
18
|
-
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
-
#endif
|
|
20
|
-
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
-
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
-
#else
|
|
23
|
-
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
-
#endif
|
|
25
|
-
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
-
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
-
#else
|
|
28
|
-
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
-
#endif
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
#include <string>
|
|
34
|
-
#include <optional>
|
|
35
|
-
|
|
36
|
-
namespace margelo::nitro::pushsignal {
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* A struct which can be represented as a JavaScript object (AndroidFirebaseConfig).
|
|
40
|
-
*/
|
|
41
|
-
struct AndroidFirebaseConfig final {
|
|
42
|
-
public:
|
|
43
|
-
std::optional<std::string> project_id SWIFT_PRIVATE;
|
|
44
|
-
std::optional<std::string> mobilesdk_app_id SWIFT_PRIVATE;
|
|
45
|
-
std::optional<std::string> current_key SWIFT_PRIVATE;
|
|
46
|
-
std::optional<std::string> project_number SWIFT_PRIVATE;
|
|
47
|
-
|
|
48
|
-
public:
|
|
49
|
-
AndroidFirebaseConfig() = default;
|
|
50
|
-
explicit AndroidFirebaseConfig(std::optional<std::string> project_id, std::optional<std::string> mobilesdk_app_id, std::optional<std::string> current_key, std::optional<std::string> project_number): project_id(project_id), mobilesdk_app_id(mobilesdk_app_id), current_key(current_key), project_number(project_number) {}
|
|
51
|
-
|
|
52
|
-
public:
|
|
53
|
-
friend bool operator==(const AndroidFirebaseConfig& lhs, const AndroidFirebaseConfig& rhs) = default;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
} // namespace margelo::nitro::pushsignal
|
|
57
|
-
|
|
58
|
-
namespace margelo::nitro {
|
|
59
|
-
|
|
60
|
-
// C++ AndroidFirebaseConfig <> JS AndroidFirebaseConfig (object)
|
|
61
|
-
template <>
|
|
62
|
-
struct JSIConverter<margelo::nitro::pushsignal::AndroidFirebaseConfig> final {
|
|
63
|
-
static inline margelo::nitro::pushsignal::AndroidFirebaseConfig fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
64
|
-
jsi::Object obj = arg.asObject(runtime);
|
|
65
|
-
return margelo::nitro::pushsignal::AndroidFirebaseConfig(
|
|
66
|
-
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "project_id"))),
|
|
67
|
-
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mobilesdk_app_id"))),
|
|
68
|
-
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "current_key"))),
|
|
69
|
-
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "project_number")))
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::pushsignal::AndroidFirebaseConfig& arg) {
|
|
73
|
-
jsi::Object obj(runtime);
|
|
74
|
-
obj.setProperty(runtime, PropNameIDCache::get(runtime, "project_id"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.project_id));
|
|
75
|
-
obj.setProperty(runtime, PropNameIDCache::get(runtime, "mobilesdk_app_id"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.mobilesdk_app_id));
|
|
76
|
-
obj.setProperty(runtime, PropNameIDCache::get(runtime, "current_key"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.current_key));
|
|
77
|
-
obj.setProperty(runtime, PropNameIDCache::get(runtime, "project_number"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.project_number));
|
|
78
|
-
return obj;
|
|
79
|
-
}
|
|
80
|
-
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
81
|
-
if (!value.isObject()) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
jsi::Object obj = value.getObject(runtime);
|
|
85
|
-
if (!nitro::isPlainObject(runtime, obj)) {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "project_id")))) return false;
|
|
89
|
-
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mobilesdk_app_id")))) return false;
|
|
90
|
-
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "current_key")))) return false;
|
|
91
|
-
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "project_number")))) return false;
|
|
92
|
-
return true;
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
} // namespace margelo::nitro
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridPushSignalSpec.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 "HybridPushSignalSpec.hpp"
|
|
9
|
-
|
|
10
|
-
namespace margelo::nitro::pushsignal {
|
|
11
|
-
|
|
12
|
-
void HybridPushSignalSpec::loadHybridMethods() {
|
|
13
|
-
// load base methods/properties
|
|
14
|
-
HybridObject::loadHybridMethods();
|
|
15
|
-
// load custom methods/properties
|
|
16
|
-
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
-
prototype.registerHybridMethod("initialize", &HybridPushSignalSpec::initialize);
|
|
18
|
-
prototype.registerHybridMethod("getCredentials", &HybridPushSignalSpec::getCredentials);
|
|
19
|
-
prototype.registerHybridMethod("setOnMessage", &HybridPushSignalSpec::setOnMessage);
|
|
20
|
-
prototype.registerHybridMethod("setOnNotificationPress", &HybridPushSignalSpec::setOnNotificationPress);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
} // namespace margelo::nitro::pushsignal
|