@ua/react-native-airship 26.0.0 → 26.2.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/android/build.gradle +4 -8
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/urbanairship/reactnative/ReactMessageView.kt +4 -9
- package/android/src/main/java/com/urbanairship/reactnative/ReactMessageViewManager.kt +4 -4
- package/ios/AirshipPluginLoader.swift +6 -0
- package/ios/AirshipReactNative.swift +45 -33
- package/ios/MessageWebViewWrapper.swift +2 -4
- package/lib/module/RNAirshipMessageViewNativeComponent.ts +4 -4
- package/lib/typescript/src/RNAirshipMessageViewNativeComponent.d.ts +4 -4
- package/lib/typescript/src/RNAirshipMessageViewNativeComponent.d.ts.map +1 -1
- package/package.json +1 -1
- package/react-native-airship.podspec +2 -1
- package/src/RNAirshipMessageViewNativeComponent.ts +4 -4
package/android/build.gradle
CHANGED
|
@@ -60,14 +60,10 @@ android {
|
|
|
60
60
|
targetCompatibility JavaVersion.VERSION_17
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"generated/jni"
|
|
68
|
-
]
|
|
69
|
-
}
|
|
70
|
-
}
|
|
63
|
+
// Note: android/generated/ directory contains pre-generated codegen files
|
|
64
|
+
// for backwards compatibility with older React Native versions (< 0.72).
|
|
65
|
+
// For RN 0.72+ with new architecture, codegen generates these automatically
|
|
66
|
+
// in build/generated/source/codegen/, so we don't include them here.
|
|
71
67
|
}
|
|
72
68
|
|
|
73
69
|
repositories {
|
|
@@ -181,21 +181,16 @@ class ReactMessageView(context: Context) : FrameLayout(context), LifecycleEventL
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
companion object {
|
|
184
|
-
const val
|
|
185
|
-
const val
|
|
186
|
-
const val
|
|
187
|
-
const val
|
|
184
|
+
const val EVENT_LOAD_STARTED = "topAirshipMessageViewLoadStarted"
|
|
185
|
+
const val EVENT_LOAD_FINISHED = "topAirshipMessageViewLoadFinished"
|
|
186
|
+
const val EVENT_LOAD_ERROR = "topAirshipMessageViewLoadError"
|
|
187
|
+
const val EVENT_CLOSE = "topAirshipMessageViewClose"
|
|
188
188
|
|
|
189
189
|
const val EVENT_LOAD_STARTED_HANDLER_NAME = "onLoadStarted"
|
|
190
190
|
const val EVENT_LOAD_FINISHED_HANDLER_NAME = "onLoadFinished"
|
|
191
191
|
const val EVENT_LOAD_ERROR_HANDLER_NAME = "onLoadError"
|
|
192
192
|
const val EVENT_CLOSE_HANDLER_NAME = "onClose"
|
|
193
193
|
|
|
194
|
-
const val EVENT_LOAD_STARTED = "loadStarted"
|
|
195
|
-
const val EVENT_LOAD_FINISHED = "loadFinished"
|
|
196
|
-
const val EVENT_LOAD_ERROR = "loadError"
|
|
197
|
-
const val EVENT_CLOSE = "close"
|
|
198
|
-
|
|
199
194
|
private const val MESSAGE_ID_KEY = "messageId"
|
|
200
195
|
private const val RETRYABLE_KEY = "retryable"
|
|
201
196
|
private const val ERROR_KEY = "error"
|
|
@@ -59,10 +59,10 @@ class ReactMessageViewManager : SimpleViewManager<ReactMessageView>(),
|
|
|
59
59
|
|
|
60
60
|
override fun getExportedCustomBubblingEventTypeConstants(): Map<String, Any> {
|
|
61
61
|
val events = listOf(
|
|
62
|
-
ReactMessageView.
|
|
63
|
-
ReactMessageView.
|
|
64
|
-
ReactMessageView.
|
|
65
|
-
ReactMessageView.
|
|
62
|
+
ReactMessageView.EVENT_CLOSE to ReactMessageView.EVENT_CLOSE_HANDLER_NAME,
|
|
63
|
+
ReactMessageView.EVENT_LOAD_ERROR to ReactMessageView.EVENT_LOAD_ERROR_HANDLER_NAME,
|
|
64
|
+
ReactMessageView.EVENT_LOAD_FINISHED to ReactMessageView.EVENT_LOAD_FINISHED_HANDLER_NAME,
|
|
65
|
+
ReactMessageView.EVENT_LOAD_STARTED to ReactMessageView.EVENT_LOAD_STARTED_HANDLER_NAME
|
|
66
66
|
)
|
|
67
67
|
|
|
68
68
|
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
/* Copyright Airship and Contributors */
|
|
2
2
|
|
|
3
3
|
import AirshipFrameworkProxy
|
|
4
|
+
import AirshipKit
|
|
4
5
|
|
|
5
6
|
@objc(AirshipPluginLoader)
|
|
7
|
+
@MainActor
|
|
6
8
|
public class AirshipPluginLoader: NSObject, AirshipPluginLoaderProtocol {
|
|
7
9
|
@objc
|
|
8
10
|
public static var disabled: Bool = false
|
|
11
|
+
|
|
9
12
|
public static func onLoad() {
|
|
10
13
|
if (!disabled) {
|
|
14
|
+
AirshipLogger.trace("AirshipPluginLoader onLoad.")
|
|
11
15
|
AirshipReactNative.shared.onLoad()
|
|
16
|
+
} else {
|
|
17
|
+
AirshipLogger.trace("AirshipPluginLoader onLoad skipped (disabled).")
|
|
12
18
|
}
|
|
13
19
|
}
|
|
14
20
|
}
|
|
@@ -6,8 +6,8 @@ import AirshipFrameworkProxy
|
|
|
6
6
|
import React
|
|
7
7
|
|
|
8
8
|
@objc
|
|
9
|
-
public class AirshipReactNative: NSObject {
|
|
10
|
-
|
|
9
|
+
public final class AirshipReactNative: NSObject, Sendable {
|
|
10
|
+
|
|
11
11
|
@objc
|
|
12
12
|
public static let pendingEventsEventName = "com.airship.pending_events"
|
|
13
13
|
|
|
@@ -18,19 +18,16 @@ public class AirshipReactNative: NSObject {
|
|
|
18
18
|
public static let pendingEmbeddedUpdated = "com.airship.iax.pending_embedded_updated"
|
|
19
19
|
|
|
20
20
|
private let serialQueue = AirshipAsyncSerialQueue()
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
private let _pendingPresentationRequests = AirshipAtomicValue<[String: PresentationOptionsOverridesRequest]>([:])
|
|
22
|
+
private let _overridePresentationOptionsEnabled = AirshipAtomicValue<Bool>(false)
|
|
23
|
+
|
|
24
24
|
@objc
|
|
25
|
-
public var overridePresentationOptionsEnabled: Bool
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
self.pendingPresentationRequests.removeAll()
|
|
33
|
-
}
|
|
25
|
+
public var overridePresentationOptionsEnabled: Bool {
|
|
26
|
+
get { _overridePresentationOptionsEnabled.value }
|
|
27
|
+
set {
|
|
28
|
+
_overridePresentationOptionsEnabled.value = newValue
|
|
29
|
+
if (!newValue) {
|
|
30
|
+
self.clearPendingPresentationRequests()
|
|
34
31
|
}
|
|
35
32
|
}
|
|
36
33
|
}
|
|
@@ -39,7 +36,7 @@ public class AirshipReactNative: NSObject {
|
|
|
39
36
|
AirshipProxy.shared
|
|
40
37
|
}
|
|
41
38
|
|
|
42
|
-
public static let version: String = "26.
|
|
39
|
+
public static let version: String = "26.2.0"
|
|
43
40
|
|
|
44
41
|
private let eventNotifier = EventNotifier()
|
|
45
42
|
|
|
@@ -48,17 +45,22 @@ public class AirshipReactNative: NSObject {
|
|
|
48
45
|
|
|
49
46
|
@objc
|
|
50
47
|
public func setNotifier(_ notifier: ((String, [String: Any]) -> Void)?) {
|
|
48
|
+
AirshipLogger.trace("AirshipReactNative setNotifier called. Enabled: \(notifier != nil)")
|
|
49
|
+
let wrappedNotifier = AirshipUnsafeSendableWrapper(notifier)
|
|
51
50
|
self.serialQueue.enqueue { @MainActor in
|
|
52
|
-
|
|
51
|
+
if wrappedNotifier.value != nil {
|
|
52
|
+
AirshipLogger.trace("AirshipReactNative notifier registered.")
|
|
53
53
|
await self.eventNotifier.setNotifier {
|
|
54
|
-
|
|
54
|
+
wrappedNotifier.value?(AirshipReactNative.pendingEventsEventName, [:])
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
if AirshipProxyEventEmitter.shared.hasAnyEvents() {
|
|
58
|
+
AirshipLogger.trace("AirshipReactNative has pending events; notifying.")
|
|
58
59
|
await self.eventNotifier.notifyPendingEvents()
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
AirshipProxy.shared.push.presentationOptionOverrides = { request in
|
|
63
|
+
AirshipLogger.trace("AirshipReactNative presentation override request received.")
|
|
62
64
|
guard self.overridePresentationOptionsEnabled else {
|
|
63
65
|
request.result(options: nil)
|
|
64
66
|
return
|
|
@@ -76,10 +78,13 @@ public class AirshipReactNative: NSObject {
|
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
let requestID = UUID().uuidString
|
|
79
|
-
self.
|
|
80
|
-
|
|
81
|
+
self._pendingPresentationRequests.update {
|
|
82
|
+
var requests = $0
|
|
83
|
+
requests[requestID] = request
|
|
84
|
+
return requests
|
|
81
85
|
}
|
|
82
|
-
|
|
86
|
+
|
|
87
|
+
wrappedNotifier.value?(
|
|
83
88
|
AirshipReactNative.overridePresentationOptionsEventName,
|
|
84
89
|
[
|
|
85
90
|
"pushPayload": requestPayload,
|
|
@@ -88,30 +93,36 @@ public class AirshipReactNative: NSObject {
|
|
|
88
93
|
)
|
|
89
94
|
}
|
|
90
95
|
} else {
|
|
96
|
+
AirshipLogger.trace("AirshipReactNative notifier cleared.")
|
|
91
97
|
await self.eventNotifier.setNotifier(nil)
|
|
92
98
|
AirshipProxy.shared.push.presentationOptionOverrides = nil
|
|
93
|
-
|
|
94
|
-
self.lock.sync {
|
|
95
|
-
self.pendingPresentationRequests.values.forEach { request in
|
|
96
|
-
request.result(options: nil)
|
|
97
|
-
}
|
|
98
|
-
self.pendingPresentationRequests.removeAll()
|
|
99
|
-
}
|
|
99
|
+
self.clearPendingPresentationRequests()
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
@objc
|
|
105
105
|
public func presentationOptionOverridesResult(requestID: String, presentationOptions: [String]?) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
_pendingPresentationRequests.update {
|
|
107
|
+
var requests = $0
|
|
108
|
+
requests[requestID]?.result(optionNames: presentationOptions)
|
|
109
|
+
requests[requestID] = nil
|
|
110
|
+
return requests
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private func clearPendingPresentationRequests() {
|
|
115
|
+
_pendingPresentationRequests.update { requests in
|
|
116
|
+
requests.values.forEach { request in
|
|
117
|
+
request.result(options: nil)
|
|
118
|
+
}
|
|
119
|
+
return [:]
|
|
109
120
|
}
|
|
110
121
|
}
|
|
111
|
-
|
|
112
122
|
|
|
113
123
|
@MainActor
|
|
114
124
|
func onLoad() {
|
|
125
|
+
AirshipLogger.trace("AirshipReactNative onLoad.")
|
|
115
126
|
AirshipProxy.shared.delegate = self
|
|
116
127
|
try? AirshipProxy.shared.attemptTakeOff()
|
|
117
128
|
|
|
@@ -125,6 +136,7 @@ public class AirshipReactNative: NSObject {
|
|
|
125
136
|
|
|
126
137
|
@objc
|
|
127
138
|
public func onListenerAdded(eventName: String) {
|
|
139
|
+
AirshipLogger.trace("AirshipReactNative listener added: \(eventName)")
|
|
128
140
|
guard let type = try? AirshipProxyEventType.fromReactName(eventName) else {
|
|
129
141
|
return
|
|
130
142
|
}
|
|
@@ -767,8 +779,8 @@ extension AirshipReactNative: AirshipProxyDelegate {
|
|
|
767
779
|
|
|
768
780
|
|
|
769
781
|
private actor EventNotifier {
|
|
770
|
-
private var notifier: (() -> Void)?
|
|
771
|
-
func setNotifier(_ notifier: (() -> Void)?) {
|
|
782
|
+
private var notifier: (@Sendable () -> Void)?
|
|
783
|
+
func setNotifier(_ notifier: (@Sendable () -> Void)?) {
|
|
772
784
|
self.notifier = notifier
|
|
773
785
|
}
|
|
774
786
|
|
|
@@ -16,6 +16,7 @@ public protocol MessageWebViewWrapperDelegate {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
@objc(RNAirshipMessageWebViewWrapper)
|
|
19
|
+
@MainActor
|
|
19
20
|
public class MessageWebViewWrapper: NSObject {
|
|
20
21
|
private let innerWrapper: _MessageWebViewWrapper
|
|
21
22
|
|
|
@@ -36,7 +37,6 @@ public class MessageWebViewWrapper: NSObject {
|
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
@MainActor
|
|
40
40
|
@objc
|
|
41
41
|
public func loadMessage(messageID: String?) {
|
|
42
42
|
self.innerWrapper.loadMessage(messageID: messageID)
|
|
@@ -49,7 +49,7 @@ public class MessageWebViewWrapper: NSObject {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
class _MessageWebViewWrapper: NSObject, AirshipWKNavigationDelegate, NativeBridgeDelegate {
|
|
52
|
+
class _MessageWebViewWrapper: NSObject, AirshipWKNavigationDelegate, @preconcurrency NativeBridgeDelegate {
|
|
53
53
|
|
|
54
54
|
public weak var delegate: MessageWebViewWrapperDelegate? = nil
|
|
55
55
|
|
|
@@ -93,8 +93,6 @@ class _MessageWebViewWrapper: NSObject, AirshipWKNavigationDelegate, NativeBridg
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
|
|
98
96
|
@MainActor
|
|
99
97
|
private func startLoad(messageID: String) async {
|
|
100
98
|
var message: MessageCenterMessage? = nil
|
|
@@ -27,14 +27,14 @@ interface NativeProps extends ViewProps {
|
|
|
27
27
|
messageId: string;
|
|
28
28
|
onLoadStarted: BubblingEventHandler<
|
|
29
29
|
MessageLoadStartedEvent,
|
|
30
|
-
'
|
|
30
|
+
'topAirshipMessageViewLoadStarted'
|
|
31
31
|
>;
|
|
32
32
|
onLoadFinished: BubblingEventHandler<
|
|
33
33
|
MessageLoadFinishedEvent,
|
|
34
|
-
'
|
|
34
|
+
'topAirshipMessageViewLoadFinished'
|
|
35
35
|
>;
|
|
36
|
-
onLoadError: BubblingEventHandler<MessageLoadErrorEvent, '
|
|
37
|
-
onClose: BubblingEventHandler<MessageClosedEvent, '
|
|
36
|
+
onLoadError: BubblingEventHandler<MessageLoadErrorEvent, 'topAirshipMessageViewLoadError'>;
|
|
37
|
+
onClose: BubblingEventHandler<MessageClosedEvent, 'topAirshipMessageViewClose'>;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export default codegenNativeComponent<NativeProps>('RNAirshipMessageView') as HostComponent<NativeProps>;
|
|
@@ -16,10 +16,10 @@ type MessageClosedEvent = Readonly<{
|
|
|
16
16
|
}>;
|
|
17
17
|
interface NativeProps extends ViewProps {
|
|
18
18
|
messageId: string;
|
|
19
|
-
onLoadStarted: BubblingEventHandler<MessageLoadStartedEvent, '
|
|
20
|
-
onLoadFinished: BubblingEventHandler<MessageLoadFinishedEvent, '
|
|
21
|
-
onLoadError: BubblingEventHandler<MessageLoadErrorEvent, '
|
|
22
|
-
onClose: BubblingEventHandler<MessageClosedEvent, '
|
|
19
|
+
onLoadStarted: BubblingEventHandler<MessageLoadStartedEvent, 'topAirshipMessageViewLoadStarted'>;
|
|
20
|
+
onLoadFinished: BubblingEventHandler<MessageLoadFinishedEvent, 'topAirshipMessageViewLoadFinished'>;
|
|
21
|
+
onLoadError: BubblingEventHandler<MessageLoadErrorEvent, 'topAirshipMessageViewLoadError'>;
|
|
22
|
+
onClose: BubblingEventHandler<MessageClosedEvent, 'topAirshipMessageViewClose'>;
|
|
23
23
|
}
|
|
24
24
|
declare const _default: HostComponent<NativeProps>;
|
|
25
25
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RNAirshipMessageViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/RNAirshipMessageViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,EAA0B,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,KAAK,EACV,oBAAoB,EAErB,MAAM,2CAA2C,CAAC;AAEnD,KAAK,uBAAuB,GAAG,QAAQ,CAAC;IACtC,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,CAAC;AAEH,KAAK,wBAAwB,GAAG,QAAQ,CAAC;IACvC,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,CAAC;AAEH,KAAK,qBAAqB,GAAG,QAAQ,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAEH,KAAK,kBAAkB,GAAG,QAAQ,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,CAAC;AAEH,UAAU,WAAY,SAAQ,SAAS;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,oBAAoB,CACjC,uBAAuB,EACvB,
|
|
1
|
+
{"version":3,"file":"RNAirshipMessageViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/RNAirshipMessageViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,EAA0B,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,KAAK,EACV,oBAAoB,EAErB,MAAM,2CAA2C,CAAC;AAEnD,KAAK,uBAAuB,GAAG,QAAQ,CAAC;IACtC,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,CAAC;AAEH,KAAK,wBAAwB,GAAG,QAAQ,CAAC;IACvC,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,CAAC;AAEH,KAAK,qBAAqB,GAAG,QAAQ,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAEH,KAAK,kBAAkB,GAAG,QAAQ,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,CAAC;AAEH,UAAU,WAAY,SAAQ,SAAS;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,oBAAoB,CACjC,uBAAuB,EACvB,kCAAkC,CACnC,CAAC;IACF,cAAc,EAAE,oBAAoB,CAClC,wBAAwB,EACxB,mCAAmC,CACpC,CAAC;IACF,WAAW,EAAE,oBAAoB,CAAC,qBAAqB,EAAE,gCAAgC,CAAC,CAAC;IAC3F,OAAO,EAAE,oBAAoB,CAAC,kBAAkB,EAAE,4BAA4B,CAAC,CAAC;CACjF;wBAE6E,aAAa,CAAC,WAAW,CAAC;AAAxG,wBAAyG"}
|
package/package.json
CHANGED
|
@@ -16,8 +16,9 @@ Pod::Spec.new do |s|
|
|
|
16
16
|
s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
|
|
17
17
|
s.exclude_files = "ios/generated/**/*"
|
|
18
18
|
s.private_header_files = "ios/**/*.h"
|
|
19
|
+
s.swift_version = "6.0"
|
|
19
20
|
|
|
20
21
|
install_modules_dependencies(s)
|
|
21
22
|
|
|
22
|
-
s.dependency "AirshipFrameworkProxy", "15.0
|
|
23
|
+
s.dependency "AirshipFrameworkProxy", "15.4.0"
|
|
23
24
|
end
|
|
@@ -27,14 +27,14 @@ interface NativeProps extends ViewProps {
|
|
|
27
27
|
messageId: string;
|
|
28
28
|
onLoadStarted: BubblingEventHandler<
|
|
29
29
|
MessageLoadStartedEvent,
|
|
30
|
-
'
|
|
30
|
+
'topAirshipMessageViewLoadStarted'
|
|
31
31
|
>;
|
|
32
32
|
onLoadFinished: BubblingEventHandler<
|
|
33
33
|
MessageLoadFinishedEvent,
|
|
34
|
-
'
|
|
34
|
+
'topAirshipMessageViewLoadFinished'
|
|
35
35
|
>;
|
|
36
|
-
onLoadError: BubblingEventHandler<MessageLoadErrorEvent, '
|
|
37
|
-
onClose: BubblingEventHandler<MessageClosedEvent, '
|
|
36
|
+
onLoadError: BubblingEventHandler<MessageLoadErrorEvent, 'topAirshipMessageViewLoadError'>;
|
|
37
|
+
onClose: BubblingEventHandler<MessageClosedEvent, 'topAirshipMessageViewClose'>;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export default codegenNativeComponent<NativeProps>('RNAirshipMessageView') as HostComponent<NativeProps>;
|