appsonair-react-native-apppush 0.0.1-alpha
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 +21 -0
- package/README.md +540 -0
- package/android/build.gradle +177 -0
- package/android/gradle.properties +15 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/appsonairreactnativeapppush/AppsonairReactNativeApppushModuleImpl.kt +767 -0
- package/android/src/main/java/com/appsonairreactnativeapppush/AppsonairReactNativeApppushPackage.kt +43 -0
- package/android/src/newarch/java/com/appsonairreactnativeapppush/AppsonairReactNativeApppushModule.kt +199 -0
- package/android/src/oldarch/java/com/appsonairreactnativeapppush/AppsonairReactNativeApppushModule.kt +249 -0
- package/appsonair-react-native-apppush.podspec +77 -0
- package/ios/AppsonairReactNativeApppush-Bridging-Header.h +12 -0
- package/ios/AppsonairReactNativeApppush.h +28 -0
- package/ios/AppsonairReactNativeApppush.mm +494 -0
- package/ios/AppsonairReactNativeApppushImpl.swift +594 -0
- package/lib/commonjs/NativeAppsonairApppush.js +48 -0
- package/lib/commonjs/NativeAppsonairApppush.js.map +1 -0
- package/lib/commonjs/index.js +686 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/NativeAppsonairApppush.js +47 -0
- package/lib/module/NativeAppsonairApppush.js.map +1 -0
- package/lib/module/index.js +612 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/NativeAppsonairApppush.d.ts +134 -0
- package/lib/typescript/commonjs/src/NativeAppsonairApppush.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +392 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types.d.ts +221 -0
- package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/NativeAppsonairApppush.d.ts +134 -0
- package/lib/typescript/module/src/NativeAppsonairApppush.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +392 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/types.d.ts +221 -0
- package/lib/typescript/module/src/types.d.ts.map +1 -0
- package/package.json +119 -0
- package/react-native.config.js +14 -0
- package/src/NativeAppsonairApppush.ts +188 -0
- package/src/index.tsx +745 -0
- package/src/types.ts +284 -0
package/android/src/main/java/com/appsonairreactnativeapppush/AppsonairReactNativeApppushPackage.kt
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
package com.appsonairreactnativeapppush
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.TurboReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
7
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Autolinked entry point.
|
|
11
|
+
*
|
|
12
|
+
* `TurboReactPackage` serves both architectures: on the New Architecture the
|
|
13
|
+
* module is looked up lazily by name through [getModule], and on the Old
|
|
14
|
+
* Architecture the same lookup backs the legacy module registry. That is why
|
|
15
|
+
* this file lives in src/main rather than being duplicated per source set --
|
|
16
|
+
* only the module class it instantiates differs, and the build picks that.
|
|
17
|
+
*/
|
|
18
|
+
class AppsonairReactNativeApppushPackage : TurboReactPackage() {
|
|
19
|
+
|
|
20
|
+
override fun getModule(
|
|
21
|
+
name: String,
|
|
22
|
+
reactContext: ReactApplicationContext
|
|
23
|
+
): NativeModule? =
|
|
24
|
+
if (name == AppsonairReactNativeApppushModuleImpl.NAME) {
|
|
25
|
+
AppsonairReactNativeApppushModule(reactContext)
|
|
26
|
+
} else {
|
|
27
|
+
null
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
override fun getReactModuleInfoProvider() = ReactModuleInfoProvider {
|
|
31
|
+
val isTurboModule = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
|
|
32
|
+
mapOf(
|
|
33
|
+
AppsonairReactNativeApppushModuleImpl.NAME to ReactModuleInfo(
|
|
34
|
+
AppsonairReactNativeApppushModuleImpl.NAME,
|
|
35
|
+
AppsonairReactNativeApppushModuleImpl.NAME,
|
|
36
|
+
false, // canOverrideExistingModule
|
|
37
|
+
false, // needsEagerInit
|
|
38
|
+
false, // isCxxModule
|
|
39
|
+
isTurboModule
|
|
40
|
+
)
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
package com.appsonairreactnativeapppush
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Promise
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
|
+
import com.facebook.react.bridge.ReadableArray
|
|
6
|
+
import com.facebook.react.bridge.ReadableMap
|
|
7
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* New Architecture module.
|
|
11
|
+
*
|
|
12
|
+
* Extends the Codegen-generated `NativeAppsonairApppushSpec`, so the method set here
|
|
13
|
+
* is checked against src/NativeAppsonairApppush.ts at compile time -- adding a method
|
|
14
|
+
* to the spec without implementing it will fail the build.
|
|
15
|
+
*
|
|
16
|
+
* Every method delegates to [AppsonairReactNativeApppushModuleImpl], which is shared
|
|
17
|
+
* verbatim with the Old Architecture module in src/oldarch. Nothing but the base
|
|
18
|
+
* class and the parameter types differ between the two.
|
|
19
|
+
*
|
|
20
|
+
* Note the `double` parameters: Codegen maps the TypeScript `number` type to
|
|
21
|
+
* `double`, never `int`, so the conversion to `Int` happens here rather than in
|
|
22
|
+
* the shared implementation.
|
|
23
|
+
*/
|
|
24
|
+
@ReactModule(name = AppsonairReactNativeApppushModuleImpl.NAME)
|
|
25
|
+
class AppsonairReactNativeApppushModule(reactContext: ReactApplicationContext) :
|
|
26
|
+
NativeAppsonairApppushSpec(reactContext) {
|
|
27
|
+
|
|
28
|
+
private val impl = AppsonairReactNativeApppushModuleImpl(reactContext)
|
|
29
|
+
|
|
30
|
+
override fun getName(): String = AppsonairReactNativeApppushModuleImpl.NAME
|
|
31
|
+
|
|
32
|
+
// MARK: Lifecycle
|
|
33
|
+
|
|
34
|
+
override fun initialize(config: ReadableMap?, promise: Promise) = impl.initialize(config, promise)
|
|
35
|
+
|
|
36
|
+
// MARK: Identity
|
|
37
|
+
|
|
38
|
+
override fun getDeviceId(promise: Promise) = impl.getDeviceId(promise)
|
|
39
|
+
|
|
40
|
+
override fun getSubscriptionId(promise: Promise) = impl.getSubscriptionId(promise)
|
|
41
|
+
|
|
42
|
+
override fun setSubscriptionId(id: String, promise: Promise) =
|
|
43
|
+
impl.setSubscriptionId(id, promise)
|
|
44
|
+
|
|
45
|
+
override fun getExternalId(promise: Promise) = impl.getExternalId(promise)
|
|
46
|
+
|
|
47
|
+
override fun login(externalId: String, promise: Promise) = impl.login(externalId, promise)
|
|
48
|
+
|
|
49
|
+
override fun logout(promise: Promise) = impl.logout(promise)
|
|
50
|
+
|
|
51
|
+
// MARK: Token
|
|
52
|
+
|
|
53
|
+
override fun getToken(promise: Promise) = impl.getToken(promise)
|
|
54
|
+
|
|
55
|
+
override fun refreshToken(promise: Promise) = impl.refreshToken(promise)
|
|
56
|
+
|
|
57
|
+
override fun getInstallationId(promise: Promise) = impl.getInstallationId(promise)
|
|
58
|
+
|
|
59
|
+
override fun getApnsEnvironment(promise: Promise) = impl.getApnsEnvironment(promise)
|
|
60
|
+
|
|
61
|
+
// MARK: Permissions
|
|
62
|
+
|
|
63
|
+
override fun requestPermission(fallbackToSettings: Boolean, promise: Promise) =
|
|
64
|
+
impl.requestPermission(fallbackToSettings, promise)
|
|
65
|
+
|
|
66
|
+
override fun getPermission(promise: Promise) = impl.getPermission(promise)
|
|
67
|
+
|
|
68
|
+
override fun getPermissionStatus(promise: Promise) = impl.getPermissionStatus(promise)
|
|
69
|
+
|
|
70
|
+
override fun canRequestPermission(promise: Promise) = impl.canRequestPermission(promise)
|
|
71
|
+
|
|
72
|
+
override fun registerForProvisionalAuthorization(promise: Promise) =
|
|
73
|
+
impl.registerForProvisionalAuthorization(promise)
|
|
74
|
+
|
|
75
|
+
// MARK: Notifications
|
|
76
|
+
|
|
77
|
+
override fun clearAllNotifications(promise: Promise) = impl.clearAllNotifications(promise)
|
|
78
|
+
|
|
79
|
+
override fun removeNotification(notificationId: String, promise: Promise) =
|
|
80
|
+
impl.removeNotification(notificationId, promise)
|
|
81
|
+
|
|
82
|
+
override fun removeNotifications(notificationIds: ReadableArray, promise: Promise) =
|
|
83
|
+
impl.removeNotifications(notificationIds, promise)
|
|
84
|
+
|
|
85
|
+
override fun removeNotificationGroup(groupKey: String, promise: Promise) =
|
|
86
|
+
impl.removeNotificationGroup(groupKey, promise)
|
|
87
|
+
|
|
88
|
+
override fun createNotificationChannel(config: ReadableMap, promise: Promise) =
|
|
89
|
+
impl.createNotificationChannel(config, promise)
|
|
90
|
+
|
|
91
|
+
override fun deleteNotificationChannel(channelId: String, promise: Promise) =
|
|
92
|
+
impl.deleteNotificationChannel(channelId, promise)
|
|
93
|
+
|
|
94
|
+
// MARK: Badges
|
|
95
|
+
|
|
96
|
+
override fun getBadgeCount(promise: Promise) = impl.getBadgeCount(promise)
|
|
97
|
+
|
|
98
|
+
override fun setBadgeCount(count: Double, promise: Promise) =
|
|
99
|
+
impl.setBadgeCount(count.toInt(), promise)
|
|
100
|
+
|
|
101
|
+
override fun incrementBadgeCount(delta: Double, promise: Promise) =
|
|
102
|
+
impl.incrementBadgeCount(delta.toInt(), promise)
|
|
103
|
+
|
|
104
|
+
override fun clearBadgeCount(promise: Promise) = impl.clearBadgeCount(promise)
|
|
105
|
+
|
|
106
|
+
override fun setAutoClearBadgeOnForeground(enabled: Boolean, promise: Promise) =
|
|
107
|
+
impl.setAutoClearBadgeOnForeground(enabled, promise)
|
|
108
|
+
|
|
109
|
+
override fun setAutoRegisterForRemoteNotifications(enabled: Boolean, promise: Promise) =
|
|
110
|
+
impl.setAutoRegisterForRemoteNotifications(enabled, promise)
|
|
111
|
+
|
|
112
|
+
// MARK: User
|
|
113
|
+
|
|
114
|
+
override fun addTag(key: String, value: String, promise: Promise) =
|
|
115
|
+
impl.addTag(key, value, promise)
|
|
116
|
+
|
|
117
|
+
override fun addTags(tags: ReadableMap, promise: Promise) = impl.addTags(tags, promise)
|
|
118
|
+
|
|
119
|
+
override fun removeTag(key: String, promise: Promise) = impl.removeTag(key, promise)
|
|
120
|
+
|
|
121
|
+
override fun removeTags(keys: ReadableArray, promise: Promise) = impl.removeTags(keys, promise)
|
|
122
|
+
|
|
123
|
+
override fun getTags(promise: Promise) = impl.getTags(promise)
|
|
124
|
+
|
|
125
|
+
override fun addAlias(label: String, id: String, promise: Promise) =
|
|
126
|
+
impl.addAlias(label, id, promise)
|
|
127
|
+
|
|
128
|
+
override fun addAliases(aliases: ReadableMap, promise: Promise) =
|
|
129
|
+
impl.addAliases(aliases, promise)
|
|
130
|
+
|
|
131
|
+
override fun removeAlias(label: String, promise: Promise) = impl.removeAlias(label, promise)
|
|
132
|
+
|
|
133
|
+
override fun removeAliases(labels: ReadableArray, promise: Promise) =
|
|
134
|
+
impl.removeAliases(labels, promise)
|
|
135
|
+
|
|
136
|
+
override fun addEmail(address: String, promise: Promise) = impl.addEmail(address, promise)
|
|
137
|
+
|
|
138
|
+
override fun removeEmail(address: String, promise: Promise) = impl.removeEmail(address, promise)
|
|
139
|
+
|
|
140
|
+
override fun setLanguage(languageCode: String, promise: Promise) =
|
|
141
|
+
impl.setLanguage(languageCode, promise)
|
|
142
|
+
|
|
143
|
+
override fun getLanguage(promise: Promise) = impl.getLanguage(promise)
|
|
144
|
+
|
|
145
|
+
override fun getPushSubscription(promise: Promise) = impl.getPushSubscription(promise)
|
|
146
|
+
|
|
147
|
+
override fun optIn(promise: Promise) = impl.optIn(promise)
|
|
148
|
+
|
|
149
|
+
override fun optOut(promise: Promise) = impl.optOut(promise)
|
|
150
|
+
|
|
151
|
+
override fun getOptedIn(promise: Promise) = impl.getOptedIn(promise)
|
|
152
|
+
|
|
153
|
+
// MARK: Consent
|
|
154
|
+
|
|
155
|
+
override fun setConsentRequired(required: Boolean, promise: Promise) =
|
|
156
|
+
impl.setConsentRequired(required, promise)
|
|
157
|
+
|
|
158
|
+
override fun getConsentRequired(promise: Promise) = impl.getConsentRequired(promise)
|
|
159
|
+
|
|
160
|
+
override fun setConsentGiven(given: Boolean, promise: Promise) =
|
|
161
|
+
impl.setConsentGiven(given, promise)
|
|
162
|
+
|
|
163
|
+
override fun getConsentGiven(promise: Promise) = impl.getConsentGiven(promise)
|
|
164
|
+
|
|
165
|
+
// MARK: Test device
|
|
166
|
+
|
|
167
|
+
override fun setTestDevice(enabled: Boolean, promise: Promise) =
|
|
168
|
+
impl.setTestDevice(enabled, promise)
|
|
169
|
+
|
|
170
|
+
override fun isTestDevice(promise: Promise) = impl.isTestDevice(promise)
|
|
171
|
+
|
|
172
|
+
// MARK: Background sync
|
|
173
|
+
|
|
174
|
+
override fun scheduleBackgroundSync(options: ReadableMap?, promise: Promise) =
|
|
175
|
+
impl.scheduleBackgroundSync(options, promise)
|
|
176
|
+
|
|
177
|
+
override fun cancelBackgroundSync(promise: Promise) = impl.cancelBackgroundSync(promise)
|
|
178
|
+
|
|
179
|
+
// MARK: Debug
|
|
180
|
+
|
|
181
|
+
override fun setLogLevel(level: String, promise: Promise) = impl.setLogLevel(level, promise)
|
|
182
|
+
|
|
183
|
+
// MARK: Foreground display control
|
|
184
|
+
|
|
185
|
+
override fun completeNotificationWillDisplay(
|
|
186
|
+
notificationId: String,
|
|
187
|
+
display: Boolean,
|
|
188
|
+
promise: Promise
|
|
189
|
+
) = impl.completeNotificationWillDisplay(notificationId, display, promise)
|
|
190
|
+
|
|
191
|
+
// MARK: NativeEventEmitter plumbing
|
|
192
|
+
//
|
|
193
|
+
// Required by the spec. RCTDeviceEventEmitter delivers the events, so there is
|
|
194
|
+
// no per-listener bookkeeping to do here.
|
|
195
|
+
|
|
196
|
+
override fun addListener(eventName: String) = Unit
|
|
197
|
+
|
|
198
|
+
override fun removeListeners(count: Double) = Unit
|
|
199
|
+
}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
package com.appsonairreactnativeapppush
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Promise
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
6
|
+
import com.facebook.react.bridge.ReactMethod
|
|
7
|
+
import com.facebook.react.bridge.ReadableArray
|
|
8
|
+
import com.facebook.react.bridge.ReadableMap
|
|
9
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Old Architecture (Bridge) module.
|
|
13
|
+
*
|
|
14
|
+
* Same class name and package as the New Architecture module in src/newarch --
|
|
15
|
+
* build.gradle puts exactly one of the two on the compile path, so the JS side
|
|
16
|
+
* resolves the same module name either way and never learns which is in use.
|
|
17
|
+
*
|
|
18
|
+
* The method set is kept in lockstep with src/NativeAppsonairApppush.ts by hand;
|
|
19
|
+
* there is no Codegen here to check it. When adding a method, add it to the spec,
|
|
20
|
+
* to this class, and to the newarch class together.
|
|
21
|
+
*
|
|
22
|
+
* `double` parameters match the New Architecture signatures deliberately: the
|
|
23
|
+
* bridge would accept `Int`, but keeping both classes identical means the shared
|
|
24
|
+
* implementation sees one calling convention.
|
|
25
|
+
*/
|
|
26
|
+
@ReactModule(name = AppsonairReactNativeApppushModuleImpl.NAME)
|
|
27
|
+
class AppsonairReactNativeApppushModule(reactContext: ReactApplicationContext) :
|
|
28
|
+
ReactContextBaseJavaModule(reactContext) {
|
|
29
|
+
|
|
30
|
+
private val impl = AppsonairReactNativeApppushModuleImpl(reactContext)
|
|
31
|
+
|
|
32
|
+
override fun getName(): String = AppsonairReactNativeApppushModuleImpl.NAME
|
|
33
|
+
|
|
34
|
+
// MARK: Lifecycle
|
|
35
|
+
|
|
36
|
+
@ReactMethod
|
|
37
|
+
fun initialize(config: ReadableMap?, promise: Promise) = impl.initialize(config, promise)
|
|
38
|
+
|
|
39
|
+
// MARK: Identity
|
|
40
|
+
|
|
41
|
+
@ReactMethod
|
|
42
|
+
fun getDeviceId(promise: Promise) = impl.getDeviceId(promise)
|
|
43
|
+
|
|
44
|
+
@ReactMethod
|
|
45
|
+
fun getSubscriptionId(promise: Promise) = impl.getSubscriptionId(promise)
|
|
46
|
+
|
|
47
|
+
@ReactMethod
|
|
48
|
+
fun setSubscriptionId(id: String, promise: Promise) = impl.setSubscriptionId(id, promise)
|
|
49
|
+
|
|
50
|
+
@ReactMethod
|
|
51
|
+
fun getExternalId(promise: Promise) = impl.getExternalId(promise)
|
|
52
|
+
|
|
53
|
+
@ReactMethod
|
|
54
|
+
fun login(externalId: String, promise: Promise) = impl.login(externalId, promise)
|
|
55
|
+
|
|
56
|
+
@ReactMethod
|
|
57
|
+
fun logout(promise: Promise) = impl.logout(promise)
|
|
58
|
+
|
|
59
|
+
// MARK: Token
|
|
60
|
+
|
|
61
|
+
@ReactMethod
|
|
62
|
+
fun getToken(promise: Promise) = impl.getToken(promise)
|
|
63
|
+
|
|
64
|
+
@ReactMethod
|
|
65
|
+
fun refreshToken(promise: Promise) = impl.refreshToken(promise)
|
|
66
|
+
|
|
67
|
+
@ReactMethod
|
|
68
|
+
fun getInstallationId(promise: Promise) = impl.getInstallationId(promise)
|
|
69
|
+
|
|
70
|
+
@ReactMethod
|
|
71
|
+
fun getApnsEnvironment(promise: Promise) = impl.getApnsEnvironment(promise)
|
|
72
|
+
|
|
73
|
+
// MARK: Permissions
|
|
74
|
+
|
|
75
|
+
@ReactMethod
|
|
76
|
+
fun requestPermission(fallbackToSettings: Boolean, promise: Promise) =
|
|
77
|
+
impl.requestPermission(fallbackToSettings, promise)
|
|
78
|
+
|
|
79
|
+
@ReactMethod
|
|
80
|
+
fun getPermission(promise: Promise) = impl.getPermission(promise)
|
|
81
|
+
|
|
82
|
+
@ReactMethod
|
|
83
|
+
fun getPermissionStatus(promise: Promise) = impl.getPermissionStatus(promise)
|
|
84
|
+
|
|
85
|
+
@ReactMethod
|
|
86
|
+
fun canRequestPermission(promise: Promise) = impl.canRequestPermission(promise)
|
|
87
|
+
|
|
88
|
+
@ReactMethod
|
|
89
|
+
fun registerForProvisionalAuthorization(promise: Promise) =
|
|
90
|
+
impl.registerForProvisionalAuthorization(promise)
|
|
91
|
+
|
|
92
|
+
// MARK: Notifications
|
|
93
|
+
|
|
94
|
+
@ReactMethod
|
|
95
|
+
fun clearAllNotifications(promise: Promise) = impl.clearAllNotifications(promise)
|
|
96
|
+
|
|
97
|
+
@ReactMethod
|
|
98
|
+
fun removeNotification(notificationId: String, promise: Promise) =
|
|
99
|
+
impl.removeNotification(notificationId, promise)
|
|
100
|
+
|
|
101
|
+
@ReactMethod
|
|
102
|
+
fun removeNotifications(notificationIds: ReadableArray, promise: Promise) =
|
|
103
|
+
impl.removeNotifications(notificationIds, promise)
|
|
104
|
+
|
|
105
|
+
@ReactMethod
|
|
106
|
+
fun removeNotificationGroup(groupKey: String, promise: Promise) =
|
|
107
|
+
impl.removeNotificationGroup(groupKey, promise)
|
|
108
|
+
|
|
109
|
+
@ReactMethod
|
|
110
|
+
fun createNotificationChannel(config: ReadableMap, promise: Promise) =
|
|
111
|
+
impl.createNotificationChannel(config, promise)
|
|
112
|
+
|
|
113
|
+
@ReactMethod
|
|
114
|
+
fun deleteNotificationChannel(channelId: String, promise: Promise) =
|
|
115
|
+
impl.deleteNotificationChannel(channelId, promise)
|
|
116
|
+
|
|
117
|
+
// MARK: Badges
|
|
118
|
+
|
|
119
|
+
@ReactMethod
|
|
120
|
+
fun getBadgeCount(promise: Promise) = impl.getBadgeCount(promise)
|
|
121
|
+
|
|
122
|
+
@ReactMethod
|
|
123
|
+
fun setBadgeCount(count: Double, promise: Promise) = impl.setBadgeCount(count.toInt(), promise)
|
|
124
|
+
|
|
125
|
+
@ReactMethod
|
|
126
|
+
fun incrementBadgeCount(delta: Double, promise: Promise) =
|
|
127
|
+
impl.incrementBadgeCount(delta.toInt(), promise)
|
|
128
|
+
|
|
129
|
+
@ReactMethod
|
|
130
|
+
fun clearBadgeCount(promise: Promise) = impl.clearBadgeCount(promise)
|
|
131
|
+
|
|
132
|
+
@ReactMethod
|
|
133
|
+
fun setAutoClearBadgeOnForeground(enabled: Boolean, promise: Promise) =
|
|
134
|
+
impl.setAutoClearBadgeOnForeground(enabled, promise)
|
|
135
|
+
|
|
136
|
+
@ReactMethod
|
|
137
|
+
fun setAutoRegisterForRemoteNotifications(enabled: Boolean, promise: Promise) =
|
|
138
|
+
impl.setAutoRegisterForRemoteNotifications(enabled, promise)
|
|
139
|
+
|
|
140
|
+
// MARK: User
|
|
141
|
+
|
|
142
|
+
@ReactMethod
|
|
143
|
+
fun addTag(key: String, value: String, promise: Promise) = impl.addTag(key, value, promise)
|
|
144
|
+
|
|
145
|
+
@ReactMethod
|
|
146
|
+
fun addTags(tags: ReadableMap, promise: Promise) = impl.addTags(tags, promise)
|
|
147
|
+
|
|
148
|
+
@ReactMethod
|
|
149
|
+
fun removeTag(key: String, promise: Promise) = impl.removeTag(key, promise)
|
|
150
|
+
|
|
151
|
+
@ReactMethod
|
|
152
|
+
fun removeTags(keys: ReadableArray, promise: Promise) = impl.removeTags(keys, promise)
|
|
153
|
+
|
|
154
|
+
@ReactMethod
|
|
155
|
+
fun getTags(promise: Promise) = impl.getTags(promise)
|
|
156
|
+
|
|
157
|
+
@ReactMethod
|
|
158
|
+
fun addAlias(label: String, id: String, promise: Promise) = impl.addAlias(label, id, promise)
|
|
159
|
+
|
|
160
|
+
@ReactMethod
|
|
161
|
+
fun addAliases(aliases: ReadableMap, promise: Promise) = impl.addAliases(aliases, promise)
|
|
162
|
+
|
|
163
|
+
@ReactMethod
|
|
164
|
+
fun removeAlias(label: String, promise: Promise) = impl.removeAlias(label, promise)
|
|
165
|
+
|
|
166
|
+
@ReactMethod
|
|
167
|
+
fun removeAliases(labels: ReadableArray, promise: Promise) = impl.removeAliases(labels, promise)
|
|
168
|
+
|
|
169
|
+
@ReactMethod
|
|
170
|
+
fun addEmail(address: String, promise: Promise) = impl.addEmail(address, promise)
|
|
171
|
+
|
|
172
|
+
@ReactMethod
|
|
173
|
+
fun removeEmail(address: String, promise: Promise) = impl.removeEmail(address, promise)
|
|
174
|
+
|
|
175
|
+
@ReactMethod
|
|
176
|
+
fun setLanguage(languageCode: String, promise: Promise) = impl.setLanguage(languageCode, promise)
|
|
177
|
+
|
|
178
|
+
@ReactMethod
|
|
179
|
+
fun getLanguage(promise: Promise) = impl.getLanguage(promise)
|
|
180
|
+
|
|
181
|
+
@ReactMethod
|
|
182
|
+
fun getPushSubscription(promise: Promise) = impl.getPushSubscription(promise)
|
|
183
|
+
|
|
184
|
+
@ReactMethod
|
|
185
|
+
fun optIn(promise: Promise) = impl.optIn(promise)
|
|
186
|
+
|
|
187
|
+
@ReactMethod
|
|
188
|
+
fun optOut(promise: Promise) = impl.optOut(promise)
|
|
189
|
+
|
|
190
|
+
@ReactMethod
|
|
191
|
+
fun getOptedIn(promise: Promise) = impl.getOptedIn(promise)
|
|
192
|
+
|
|
193
|
+
// MARK: Consent
|
|
194
|
+
|
|
195
|
+
@ReactMethod
|
|
196
|
+
fun setConsentRequired(required: Boolean, promise: Promise) =
|
|
197
|
+
impl.setConsentRequired(required, promise)
|
|
198
|
+
|
|
199
|
+
@ReactMethod
|
|
200
|
+
fun getConsentRequired(promise: Promise) = impl.getConsentRequired(promise)
|
|
201
|
+
|
|
202
|
+
@ReactMethod
|
|
203
|
+
fun setConsentGiven(given: Boolean, promise: Promise) = impl.setConsentGiven(given, promise)
|
|
204
|
+
|
|
205
|
+
@ReactMethod
|
|
206
|
+
fun getConsentGiven(promise: Promise) = impl.getConsentGiven(promise)
|
|
207
|
+
|
|
208
|
+
// MARK: Test device
|
|
209
|
+
|
|
210
|
+
@ReactMethod
|
|
211
|
+
fun setTestDevice(enabled: Boolean, promise: Promise) = impl.setTestDevice(enabled, promise)
|
|
212
|
+
|
|
213
|
+
@ReactMethod
|
|
214
|
+
fun isTestDevice(promise: Promise) = impl.isTestDevice(promise)
|
|
215
|
+
|
|
216
|
+
// MARK: Background sync
|
|
217
|
+
|
|
218
|
+
@ReactMethod
|
|
219
|
+
fun scheduleBackgroundSync(options: ReadableMap?, promise: Promise) =
|
|
220
|
+
impl.scheduleBackgroundSync(options, promise)
|
|
221
|
+
|
|
222
|
+
@ReactMethod
|
|
223
|
+
fun cancelBackgroundSync(promise: Promise) = impl.cancelBackgroundSync(promise)
|
|
224
|
+
|
|
225
|
+
// MARK: Debug
|
|
226
|
+
|
|
227
|
+
@ReactMethod
|
|
228
|
+
fun setLogLevel(level: String, promise: Promise) = impl.setLogLevel(level, promise)
|
|
229
|
+
|
|
230
|
+
// MARK: Foreground display control
|
|
231
|
+
|
|
232
|
+
@ReactMethod
|
|
233
|
+
fun completeNotificationWillDisplay(
|
|
234
|
+
notificationId: String,
|
|
235
|
+
display: Boolean,
|
|
236
|
+
promise: Promise
|
|
237
|
+
) = impl.completeNotificationWillDisplay(notificationId, display, promise)
|
|
238
|
+
|
|
239
|
+
// MARK: NativeEventEmitter plumbing
|
|
240
|
+
//
|
|
241
|
+
// NativeEventEmitter warns on the Old Architecture if the module does not
|
|
242
|
+
// declare these, even though RCTDeviceEventEmitter needs no bookkeeping.
|
|
243
|
+
|
|
244
|
+
@ReactMethod
|
|
245
|
+
fun addListener(eventName: String) = Unit
|
|
246
|
+
|
|
247
|
+
@ReactMethod
|
|
248
|
+
fun removeListeners(count: Double) = Unit
|
|
249
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
5
|
+
|
|
6
|
+
Pod::Spec.new do |s|
|
|
7
|
+
s.name = "appsonair-react-native-apppush"
|
|
8
|
+
s.version = package["version"]
|
|
9
|
+
s.summary = package["description"]
|
|
10
|
+
s.homepage = package["homepage"]
|
|
11
|
+
s.license = package["license"]
|
|
12
|
+
s.authors = package["author"]
|
|
13
|
+
|
|
14
|
+
# The native SDK is iOS 15+ (AppsOnAir-AppPush.podspec), so this cannot go lower
|
|
15
|
+
# even where the host app's min_ios_version_supported is older.
|
|
16
|
+
s.platforms = { :ios => "15.0" }
|
|
17
|
+
s.source = { :git => "https://github.com/apps-on-air/appsonair-react-native-push-notification.git", :tag => "#{s.version}" }
|
|
18
|
+
|
|
19
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
20
|
+
s.swift_version = "5.9"
|
|
21
|
+
|
|
22
|
+
# Pinned so the Swift-generated header is predictably named
|
|
23
|
+
# AppsonairReactNativeApppush-Swift.h. AppsonairReactNativeApppush.mm imports it by
|
|
24
|
+
# that name; without this, CocoaPods derives the module name from the pod name
|
|
25
|
+
# and the import becomes appsonair_react_native_push-Swift.h.
|
|
26
|
+
s.module_name = "AppsonairReactNativeApppush"
|
|
27
|
+
|
|
28
|
+
# The native AppsOnAir Push SDK, from the CocoaPods trunk.
|
|
29
|
+
#
|
|
30
|
+
# Exact-version pin, matching the AppLink/AppSync/AppRemark wrappers. Nothing
|
|
31
|
+
# else is needed in a host app's Podfile -- `pod install` resolves it from trunk.
|
|
32
|
+
#
|
|
33
|
+
# If `pod install` cannot find the version, the spec repo is stale: run
|
|
34
|
+
# `pod repo update`. To build against a local SDK checkout instead, declare it
|
|
35
|
+
# in the host app's own Podfile, which takes precedence over this line:
|
|
36
|
+
#
|
|
37
|
+
# pod 'AppsOnAir-AppPush', :path => '../../appsonair-ios-push-notification'
|
|
38
|
+
#
|
|
39
|
+
# See the README's iOS installation section.
|
|
40
|
+
s.dependency 'AppsOnAir-AppPush', '0.0.2-alpha'
|
|
41
|
+
|
|
42
|
+
# Compensates for a missing version floor upstream, and is not redundant with
|
|
43
|
+
# the line above: AppsOnAir-AppPush.podspec declares `core.dependency
|
|
44
|
+
# 'AppsOnAir-Core'` with no constraint, while the SDK's own Package.swift
|
|
45
|
+
# requires `from: "1.2.3"` and its AppsOnAirDeviceInfo calls
|
|
46
|
+
# AppsOnAirCoreServices.getDeviceMetadata(), which only exists in 1.2.x.
|
|
47
|
+
#
|
|
48
|
+
# A fresh `pod install` resolves the newest Core and is fine either way. The
|
|
49
|
+
# case this covers is a host app that already carries an older Core in its
|
|
50
|
+
# Podfile.lock -- likely if it also uses AppLink, AppSync or AppRemark -- where
|
|
51
|
+
# an unconstrained dependency is satisfied by 1.1.1 and the SDK then fails to
|
|
52
|
+
# compile. Remove once the upstream podspec carries its own floor.
|
|
53
|
+
s.dependency 'AppsOnAir-Core', '>= 1.2.3'
|
|
54
|
+
|
|
55
|
+
# Installs the React dependencies, and on RN >= 0.71 wires up the New
|
|
56
|
+
# Architecture (Codegen output, Folly, ReactCommon) when it is enabled. The
|
|
57
|
+
# else-branch is the pre-0.71 fallback.
|
|
58
|
+
if respond_to?(:install_modules_dependencies, true)
|
|
59
|
+
install_modules_dependencies(s)
|
|
60
|
+
else
|
|
61
|
+
s.dependency "React-Core"
|
|
62
|
+
|
|
63
|
+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
64
|
+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
65
|
+
s.pod_target_xcconfig = {
|
|
66
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
67
|
+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
68
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
69
|
+
}
|
|
70
|
+
s.dependency "React-Codegen"
|
|
71
|
+
s.dependency "RCT-Folly"
|
|
72
|
+
s.dependency "RCTRequired"
|
|
73
|
+
s.dependency "RCTTypeSafety"
|
|
74
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Makes the React promise block typedefs and RCTEventEmitter visible to
|
|
2
|
+
// AppsonairReactNativeApppushImpl.swift, which uses RCTPromiseResolveBlock and
|
|
3
|
+
// RCTPromiseRejectBlock in every exported method signature.
|
|
4
|
+
//
|
|
5
|
+
// Under CocoaPods this is reached through the pod's generated umbrella header
|
|
6
|
+
// rather than as a true Swift bridging header (CocoaPods never sets
|
|
7
|
+
// SWIFT_OBJC_BRIDGING_HEADER); the `#if canImport(React)` guard in the Swift
|
|
8
|
+
// file is the second path in. Keeping both is what the sibling AppRemark and
|
|
9
|
+
// AppSync wrappers do, and for the same reason.
|
|
10
|
+
|
|
11
|
+
#import <React/RCTBridgeModule.h>
|
|
12
|
+
#import <React/RCTEventEmitter.h>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#import <React/RCTBridgeModule.h>
|
|
2
|
+
#import <React/RCTEventEmitter.h>
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ObjC++ half of the iOS bridge.
|
|
6
|
+
*
|
|
7
|
+
* The base class is the same on both architectures -- RCTEventEmitter, which
|
|
8
|
+
* carries the ten AppsonairPush:* events. Only the adopted protocol differs:
|
|
9
|
+
* the Codegen-generated NativeAppsonairApppushSpec under the New Architecture, and
|
|
10
|
+
* plain RCTBridgeModule under the Old one.
|
|
11
|
+
*
|
|
12
|
+
* That is the whole conditional. Because Codegen derives its ObjC selectors from
|
|
13
|
+
* the same JS method names RCT_EXPORT_METHOD does, one method body in the .mm
|
|
14
|
+
* satisfies both -- see the note there.
|
|
15
|
+
*/
|
|
16
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
17
|
+
|
|
18
|
+
#import <AppsonairReactNativeApppushSpec/AppsonairReactNativeApppushSpec.h>
|
|
19
|
+
|
|
20
|
+
@interface AppsonairReactNativeApppush : RCTEventEmitter <NativeAppsonairApppushSpec>
|
|
21
|
+
@end
|
|
22
|
+
|
|
23
|
+
#else
|
|
24
|
+
|
|
25
|
+
@interface AppsonairReactNativeApppush : RCTEventEmitter <RCTBridgeModule>
|
|
26
|
+
@end
|
|
27
|
+
|
|
28
|
+
#endif
|