@ua/capacitor-airship 3.1.0 → 4.0.1
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/UaCapacitorAirship.podspec +3 -3
- package/android/build.gradle +6 -6
- package/android/src/main/java/com/airship/capacitor/AirshipCapacitorVersion.kt +1 -1
- package/android/src/main/java/com/airship/capacitor/AirshipPlugin.kt +277 -207
- package/dist/plugin.cjs.js +0 -2
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +0 -2
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/AirshipCapacitorAutopilot.swift +2 -4
- package/ios/Plugin/AirshipCapacitorVersion.swift +1 -1
- package/ios/Plugin/AirshipPlugin.swift +48 -33
- package/ios/Plugin/AirshipPluginLoader.swift +4 -1
- package/package.json +16 -16
|
@@ -10,9 +10,9 @@ Pod::Spec.new do |s|
|
|
|
10
10
|
s.homepage = package['repository']['url']
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
|
-
s.ios.deployment_target
|
|
13
|
+
s.ios.deployment_target = '15.0'
|
|
14
14
|
s.dependency 'Capacitor'
|
|
15
|
-
s.swift_version = '
|
|
16
|
-
s.dependency "AirshipFrameworkProxy", "
|
|
15
|
+
s.swift_version = '6'
|
|
16
|
+
s.dependency "AirshipFrameworkProxy", "13.0.1"
|
|
17
17
|
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
18
18
|
end
|
package/android/build.gradle
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
ext {
|
|
2
|
-
airshipProxyVersion = project.hasProperty('airshipProxyVersion') ? rootProject.ext.airshipProxyVersion : '
|
|
2
|
+
airshipProxyVersion = project.hasProperty('airshipProxyVersion') ? rootProject.ext.airshipProxyVersion : '13.0.1'
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
buildscript {
|
|
7
|
-
ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.9.
|
|
7
|
+
ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.9.25'
|
|
8
8
|
|
|
9
9
|
repositories {
|
|
10
10
|
google()
|
|
11
11
|
mavenCentral()
|
|
12
12
|
}
|
|
13
13
|
dependencies {
|
|
14
|
-
classpath 'com.android.tools.build:gradle:8.2
|
|
14
|
+
classpath 'com.android.tools.build:gradle:8.7.2'
|
|
15
15
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -43,11 +43,11 @@ android {
|
|
|
43
43
|
abortOnError false
|
|
44
44
|
}
|
|
45
45
|
compileOptions {
|
|
46
|
-
sourceCompatibility JavaVersion.
|
|
47
|
-
targetCompatibility JavaVersion.
|
|
46
|
+
sourceCompatibility JavaVersion.VERSION_21
|
|
47
|
+
targetCompatibility JavaVersion.VERSION_21
|
|
48
48
|
}
|
|
49
49
|
kotlinOptions {
|
|
50
|
-
jvmTarget = JavaVersion.
|
|
50
|
+
jvmTarget = JavaVersion.VERSION_21
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -90,248 +90,318 @@ class AirshipPlugin : Plugin() {
|
|
|
90
90
|
|
|
91
91
|
val proxy = AirshipProxy.shared(context)
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// Contact
|
|
111
|
-
"contact#reset" -> call.resolveResult(method) { proxy.contact.reset() }
|
|
112
|
-
"contact#notifyRemoteLogin" -> call.resolveResult(method) { proxy.contact.notifyRemoteLogin() }
|
|
113
|
-
"contact#identify" -> call.resolveResult(method) { proxy.contact.identify(arg.requireString()) }
|
|
114
|
-
"contact#getNamedUserId" -> call.resolveResult(method) { proxy.contact.getNamedUserId() }
|
|
115
|
-
"contact#editTagGroups" -> call.resolveResult(method) { proxy.contact.editTagGroups(arg) }
|
|
116
|
-
"contact#editSubscriptionLists" -> call.resolveResult(method) { proxy.contact.editSubscriptionLists(arg) }
|
|
117
|
-
"contact#editAttributes" -> call.resolveResult(method) { proxy.contact.editAttributes(arg) }
|
|
118
|
-
"contact#getSubscriptionLists" -> call.resolvePending(method) { proxy.contact.getSubscriptionLists() }
|
|
119
|
-
|
|
120
|
-
// Push
|
|
121
|
-
"push#setUserNotificationsEnabled" -> call.resolveResult(method) { proxy.push.setUserNotificationsEnabled(arg.requireBoolean()) }
|
|
122
|
-
"push#enableUserNotifications" -> call.resolveSuspending(method) {
|
|
123
|
-
val options = if (arg.isNull) {
|
|
124
|
-
null
|
|
125
|
-
} else {
|
|
126
|
-
EnableUserNotificationsArgs.fromJson(arg)
|
|
127
|
-
}
|
|
128
|
-
proxy.push.enableUserPushNotifications(options)
|
|
129
|
-
}
|
|
93
|
+
when (method) {
|
|
94
|
+
// Airship
|
|
95
|
+
"takeOff" -> call.resolve(scope, method) { proxy.takeOff(arg) }
|
|
96
|
+
"isFlying" -> call.resolve(scope, method) { proxy.isFlying() }
|
|
97
|
+
|
|
98
|
+
// Channel
|
|
99
|
+
"channel#getChannelId" -> call.resolve(scope, method) { proxy.channel.getChannelId() }
|
|
100
|
+
|
|
101
|
+
"channel#editTags" -> call.resolve(scope, method) { proxy.channel.editTags(arg) }
|
|
102
|
+
"channel#getTags" -> call.resolve(scope, method) { proxy.channel.getTags().toList() }
|
|
103
|
+
"channel#editTagGroups" -> call.resolve(scope, method) { proxy.channel.editTagGroups(arg) }
|
|
104
|
+
"channel#editSubscriptionLists" -> call.resolve(scope, method) {
|
|
105
|
+
proxy.channel.editSubscriptionLists(
|
|
106
|
+
arg
|
|
107
|
+
)
|
|
108
|
+
}
|
|
130
109
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
} else {
|
|
137
|
-
emptyList()
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
"push#clearNotification" -> call.resolveResult(method) { proxy.push.clearNotification(arg.requireString()) }
|
|
141
|
-
"push#clearNotifications" -> call.resolveResult(method) { proxy.push.clearNotifications() }
|
|
142
|
-
"push#getPushToken" -> call.resolveResult(method) { proxy.push.getRegistrationToken() }
|
|
143
|
-
"push#android#isNotificationChannelEnabled" -> call.resolveResult(method) {
|
|
144
|
-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
145
|
-
proxy.push.isNotificationChannelEnabled(arg.requireString())
|
|
146
|
-
} else {
|
|
147
|
-
true
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
"push#android#setNotificationConfig" -> call.resolveResult(method) { proxy.push.setNotificationConfig(arg) }
|
|
151
|
-
"push#android#setForegroundNotificationsEnabled" -> call.resolveResult(method) {
|
|
152
|
-
proxy.push.isForegroundNotificationsEnabled = arg.requireBoolean()
|
|
153
|
-
return@resolveResult Unit
|
|
154
|
-
}
|
|
155
|
-
"push#android#isForegroundNotificationsEnabled" -> call.resolveResult(method) {
|
|
156
|
-
proxy.push.isForegroundNotificationsEnabled
|
|
157
|
-
}
|
|
110
|
+
"channel#editAttributes" -> call.resolve(scope, method) {
|
|
111
|
+
proxy.channel.editAttributes(
|
|
112
|
+
arg
|
|
113
|
+
)
|
|
114
|
+
}
|
|
158
115
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
116
|
+
"channel#getSubscriptionLists" -> call.resolve(scope, method) { proxy.channel.getSubscriptionLists() }
|
|
117
|
+
"channel#enableChannelCreation" -> call.resolve(scope, method) { proxy.channel.enableChannelCreation() }
|
|
118
|
+
|
|
119
|
+
// Contact
|
|
120
|
+
"contact#reset" -> call.resolve(scope, method) { proxy.contact.reset() }
|
|
121
|
+
"contact#notifyRemoteLogin" -> call.resolve(scope, method) { proxy.contact.notifyRemoteLogin() }
|
|
122
|
+
"contact#identify" -> call.resolve(scope, method) { proxy.contact.identify(arg.requireString()) }
|
|
123
|
+
"contact#getNamedUserId" -> call.resolve(scope, method) { proxy.contact.getNamedUserId() }
|
|
124
|
+
"contact#editTagGroups" -> call.resolve(scope, method) { proxy.contact.editTagGroups(arg) }
|
|
125
|
+
"contact#editSubscriptionLists" -> call.resolve(scope, method) {
|
|
126
|
+
proxy.contact.editSubscriptionLists(
|
|
127
|
+
arg
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
"contact#editAttributes" -> call.resolve(scope, method) {
|
|
132
|
+
proxy.contact.editAttributes(
|
|
133
|
+
arg
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
"contact#getSubscriptionLists" -> call.resolve(scope, method) { proxy.contact.getSubscriptionLists() }
|
|
138
|
+
|
|
139
|
+
// Push
|
|
140
|
+
"push#setUserNotificationsEnabled" -> call.resolve(scope, method) {
|
|
141
|
+
proxy.push.setUserNotificationsEnabled(
|
|
142
|
+
arg.requireBoolean()
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
"push#enableUserNotifications" -> call.resolve(scope, method) {
|
|
147
|
+
val options = if (arg.isNull) {
|
|
148
|
+
null
|
|
149
|
+
} else {
|
|
150
|
+
EnableUserNotificationsArgs.fromJson(arg)
|
|
174
151
|
}
|
|
152
|
+
proxy.push.enableUserPushNotifications(options)
|
|
153
|
+
}
|
|
175
154
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
155
|
+
"push#isUserNotificationsEnabled" -> call.resolve(scope, method) { proxy.push.isUserNotificationsEnabled() }
|
|
156
|
+
"push#getNotificationStatus" -> call.resolve(scope, method) { proxy.push.getNotificationStatus() }
|
|
157
|
+
"push#getActiveNotifications" -> call.resolve(scope, method) {
|
|
158
|
+
if (Build.VERSION.SDK_INT >= 23) {
|
|
159
|
+
proxy.push.getActiveNotifications()
|
|
160
|
+
} else {
|
|
161
|
+
emptyList()
|
|
179
162
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
"push#clearNotification" -> call.resolve(scope, method) {
|
|
166
|
+
proxy.push.clearNotification(
|
|
167
|
+
arg.requireString()
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
"push#clearNotifications" -> call.resolve(scope, method) { proxy.push.clearNotifications() }
|
|
172
|
+
"push#getPushToken" -> call.resolve(scope, method) { proxy.push.getRegistrationToken() }
|
|
173
|
+
"push#android#isNotificationChannelEnabled" -> call.resolve(scope, method) {
|
|
174
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
175
|
+
proxy.push.isNotificationChannelEnabled(arg.requireString())
|
|
176
|
+
} else {
|
|
177
|
+
true
|
|
197
178
|
}
|
|
179
|
+
}
|
|
198
180
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
181
|
+
"push#android#setNotificationConfig" -> call.resolve(scope, method) {
|
|
182
|
+
proxy.push.setNotificationConfig(
|
|
183
|
+
arg
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
"push#android#setForegroundNotificationsEnabled" -> call.resolve(scope, method) {
|
|
188
|
+
proxy.push.isForegroundNotificationsEnabled = arg.requireBoolean()
|
|
189
|
+
return@resolve Unit
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
"push#android#isForegroundNotificationsEnabled" -> call.resolve(scope, method) {
|
|
193
|
+
proxy.push.isForegroundNotificationsEnabled
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// In-App
|
|
197
|
+
"inApp#setPaused" -> call.resolve(scope, method) {
|
|
198
|
+
proxy.inApp.setPaused(
|
|
199
|
+
arg.getBoolean(
|
|
200
|
+
false
|
|
207
201
|
)
|
|
208
|
-
|
|
202
|
+
)
|
|
203
|
+
}
|
|
209
204
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
// Locale
|
|
218
|
-
"locale#setLocaleOverride" -> call.resolveResult(method) { proxy.locale.setCurrentLocale(arg.requireString()) }
|
|
219
|
-
"locale#getCurrentLocale" -> call.resolveResult(method) { proxy.locale.getCurrentLocale() }
|
|
220
|
-
"locale#clearLocaleOverride" -> call.resolveResult(method) { proxy.locale.clearLocale() }
|
|
221
|
-
|
|
222
|
-
// Actions
|
|
223
|
-
"actions#run" -> call.resolveDeferred(method) { resolveCallback ->
|
|
224
|
-
val actionArgs = arg.requireList()
|
|
225
|
-
val name= actionArgs.get(0).requireString()
|
|
226
|
-
val value: JsonValue? = if (actionArgs.size() == 2) { actionArgs.get(1) } else { null }
|
|
227
|
-
|
|
228
|
-
proxy.actions.runAction(name, value)
|
|
229
|
-
.addResultCallback { actionResult ->
|
|
230
|
-
if (actionResult != null && actionResult.status == ActionResult.STATUS_COMPLETED) {
|
|
231
|
-
resolveCallback(actionResult.value, null)
|
|
232
|
-
} else {
|
|
233
|
-
resolveCallback(null, Exception("Action failed ${actionResult?.status}"))
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
205
|
+
"inApp#isPaused" -> call.resolve(scope, method) { proxy.inApp.isPaused() }
|
|
206
|
+
"inApp#setDisplayInterval" -> call.resolve(scope, method) {
|
|
207
|
+
proxy.inApp.setDisplayInterval(
|
|
208
|
+
arg.getLong(0)
|
|
209
|
+
)
|
|
210
|
+
}
|
|
237
211
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
212
|
+
"inApp#getDisplayInterval" -> call.resolve(scope, method) { proxy.inApp.getDisplayInterval() }
|
|
213
|
+
|
|
214
|
+
// Analytics
|
|
215
|
+
"analytics#trackScreen" -> call.resolve(scope, method) { proxy.analytics.trackScreen(arg.string) }
|
|
216
|
+
"analytics#addCustomEvent" -> call.resolve(scope, method) { proxy.analytics.addEvent(arg) }
|
|
217
|
+
"analytics#associateIdentifier" -> {
|
|
218
|
+
val associatedIdentifierArgs = arg.requireStringList()
|
|
219
|
+
proxy.analytics.associateIdentifier(
|
|
220
|
+
associatedIdentifierArgs[0],
|
|
221
|
+
associatedIdentifierArgs.getOrNull(1)
|
|
222
|
+
)
|
|
223
|
+
}
|
|
242
224
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
}
|
|
225
|
+
// Message Center
|
|
226
|
+
"messageCenter#getMessages" -> call.resolve(scope, method) {
|
|
227
|
+
JsonValue.wrapOpt(proxy.messageCenter.getMessages())
|
|
228
|
+
}
|
|
249
229
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
230
|
+
"messageCenter#dismiss" -> call.resolve(scope, method) { proxy.messageCenter.dismiss() }
|
|
231
|
+
"messageCenter#display" -> call.resolve(scope, method) { proxy.messageCenter.display(arg.string) }
|
|
232
|
+
"messageCenter#showMessageView" -> call.resolve(scope, method) {
|
|
233
|
+
proxy.messageCenter.showMessageView(
|
|
234
|
+
arg.requireString()
|
|
235
|
+
)
|
|
236
|
+
}
|
|
255
237
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
238
|
+
"messageCenter#showMessageCenter" -> call.resolve(scope, method) {
|
|
239
|
+
proxy.messageCenter.showMessageCenter(
|
|
240
|
+
arg.string
|
|
241
|
+
)
|
|
242
|
+
}
|
|
259
243
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
244
|
+
"messageCenter#markMessageRead" -> call.resolve(scope, method) {
|
|
245
|
+
proxy.messageCenter.markMessageRead(
|
|
246
|
+
arg.requireString()
|
|
247
|
+
)
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
"messageCenter#deleteMessage" -> call.resolve(scope, method) {
|
|
251
|
+
proxy.messageCenter.deleteMessage(
|
|
252
|
+
arg.requireString()
|
|
253
|
+
)
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
"messageCenter#getUnreadCount" -> call.resolve(scope, method) { proxy.messageCenter.getUnreadMessagesCount() }
|
|
257
|
+
"messageCenter#setAutoLaunchDefaultMessageCenter" -> call.resolve(scope, method) {
|
|
258
|
+
proxy.messageCenter.setAutoLaunchDefaultMessageCenter(
|
|
259
|
+
arg.requireBoolean()
|
|
260
|
+
)
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
"messageCenter#refreshMessages" -> call.resolve(scope, method) {
|
|
264
|
+
if (!proxy.messageCenter.refreshInbox()) {
|
|
265
|
+
throw Exception("Failed to refresh")
|
|
263
266
|
}
|
|
267
|
+
return@resolve Unit
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// Preference Center
|
|
271
|
+
"preferenceCenter#display" -> call.resolve(scope, method) {
|
|
272
|
+
proxy.preferenceCenter.displayPreferenceCenter(
|
|
273
|
+
arg.requireString()
|
|
274
|
+
)
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
"preferenceCenter#getConfig" -> call.resolve(scope, method) {
|
|
278
|
+
proxy.preferenceCenter.getPreferenceCenterConfig(
|
|
279
|
+
arg.requireString()
|
|
280
|
+
)
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
"preferenceCenter#setAutoLaunchPreferenceCenter" -> call.resolve(scope, method) {
|
|
284
|
+
val autoLaunchArgs = arg.requireList()
|
|
285
|
+
proxy.preferenceCenter.setAutoLaunchPreferenceCenter(
|
|
286
|
+
autoLaunchArgs.get(0).requireString(),
|
|
287
|
+
autoLaunchArgs.get(1).getBoolean(false)
|
|
288
|
+
)
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// Privacy Manager
|
|
292
|
+
"privacyManager#setEnabledFeatures" -> call.resolve(scope, method) {
|
|
293
|
+
proxy.privacyManager.setEnabledFeatures(
|
|
294
|
+
arg.requireStringList()
|
|
295
|
+
)
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
"privacyManager#getEnabledFeatures" -> call.resolve(scope, method) { proxy.privacyManager.getFeatureNames() }
|
|
299
|
+
"privacyManager#enableFeatures" -> call.resolve(scope, method) {
|
|
300
|
+
proxy.privacyManager.enableFeatures(
|
|
301
|
+
arg.requireStringList()
|
|
302
|
+
)
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
"privacyManager#disableFeatures" -> call.resolve(scope, method) {
|
|
306
|
+
proxy.privacyManager.disableFeatures(
|
|
307
|
+
arg.requireStringList()
|
|
308
|
+
)
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
"privacyManager#isFeaturesEnabled" -> call.resolve(scope, method) {
|
|
312
|
+
proxy.privacyManager.isFeatureEnabled(
|
|
313
|
+
arg.requireStringList()
|
|
314
|
+
)
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// Locale
|
|
318
|
+
"locale#setLocaleOverride" -> call.resolve(scope, method) {
|
|
319
|
+
proxy.locale.setCurrentLocale(
|
|
320
|
+
arg.requireString()
|
|
321
|
+
)
|
|
322
|
+
}
|
|
264
323
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
324
|
+
"locale#getCurrentLocale" -> call.resolve(scope, method) { proxy.locale.getCurrentLocale() }
|
|
325
|
+
"locale#clearLocaleOverride" -> call.resolve(scope, method) { proxy.locale.clearLocale() }
|
|
326
|
+
|
|
327
|
+
// Actions
|
|
328
|
+
"actions#run" -> call.resolve(scope, method) {
|
|
329
|
+
val actionArgs = arg.requireList()
|
|
330
|
+
val name = actionArgs.get(0).requireString()
|
|
331
|
+
val value: JsonValue? = if (actionArgs.size() == 2) {
|
|
332
|
+
actionArgs.get(1)
|
|
333
|
+
} else {
|
|
334
|
+
null
|
|
268
335
|
}
|
|
269
336
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
337
|
+
val result = proxy.actions.runAction(name, value)
|
|
338
|
+
if (result.status == ActionResult.STATUS_COMPLETED) {
|
|
339
|
+
result.value
|
|
340
|
+
} else {
|
|
341
|
+
throw Exception("Action failed ${result.status}")
|
|
273
342
|
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// Feature Flag
|
|
346
|
+
"featureFlagManager#flag" -> call.resolve(scope, method) {
|
|
347
|
+
proxy.featureFlagManager.flag(arg.requireString())
|
|
348
|
+
}
|
|
274
349
|
|
|
275
|
-
|
|
276
|
-
|
|
350
|
+
"featureFlagManager#trackInteraction" -> {
|
|
351
|
+
call.resolve(scope, method) {
|
|
352
|
+
val featureFlagProxy = FeatureFlagProxy(arg)
|
|
353
|
+
proxy.featureFlagManager.trackInteraction(flag = featureFlagProxy)
|
|
277
354
|
}
|
|
355
|
+
}
|
|
278
356
|
|
|
279
|
-
|
|
357
|
+
// Live Update
|
|
358
|
+
"liveUpdateManager#list" -> call.resolve(scope, method) {
|
|
359
|
+
val request = LiveUpdateRequest.List.fromJson(arg)
|
|
360
|
+
proxy.liveUpdateManager.list(request)
|
|
280
361
|
}
|
|
281
|
-
}
|
|
282
362
|
|
|
283
|
-
|
|
284
|
-
|
|
363
|
+
"liveUpdateManager#listAll" -> call.resolve(scope, method) {
|
|
364
|
+
proxy.liveUpdateManager.listAll()
|
|
365
|
+
}
|
|
285
366
|
|
|
367
|
+
"liveUpdateManager#start" -> call.resolve(scope, method) {
|
|
368
|
+
val request = LiveUpdateRequest.Start.fromJson(arg)
|
|
369
|
+
proxy.liveUpdateManager.start(request)
|
|
370
|
+
}
|
|
286
371
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
372
|
+
"liveUpdateManager#update" -> call.resolve(scope, method) {
|
|
373
|
+
val request = LiveUpdateRequest.Update.fromJson(arg)
|
|
374
|
+
proxy.liveUpdateManager.update(request)
|
|
375
|
+
}
|
|
290
376
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
is Unit -> {
|
|
295
|
-
this.resolve(JSObject())
|
|
377
|
+
"liveUpdateManager#end" -> call.resolve(scope, method) {
|
|
378
|
+
val request = LiveUpdateRequest.End.fromJson(arg)
|
|
379
|
+
proxy.liveUpdateManager.end(request)
|
|
296
380
|
}
|
|
297
|
-
|
|
298
|
-
|
|
381
|
+
|
|
382
|
+
"liveUpdateManager#clearAll" -> call.resolve(scope, method) {
|
|
383
|
+
proxy.liveUpdateManager.clearAll()
|
|
299
384
|
}
|
|
385
|
+
|
|
386
|
+
else -> call.reject("Not implemented")
|
|
300
387
|
}
|
|
301
|
-
} catch (e: Exception) {
|
|
302
|
-
this.reject(method, e)
|
|
303
388
|
}
|
|
304
389
|
}
|
|
305
390
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
}
|
|
317
|
-
else -> {
|
|
318
|
-
this.resolve(jsonMapOf("value" to result).toJSObject())
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
} catch (e: Exception) {
|
|
322
|
-
this.reject(method, e)
|
|
391
|
+
|
|
392
|
+
internal fun PluginCall.resolve(scope: CoroutineScope, method: String, function: suspend () -> Any?) {
|
|
393
|
+
scope.launch {
|
|
394
|
+
try {
|
|
395
|
+
when (val result = function()) {
|
|
396
|
+
is Unit -> {
|
|
397
|
+
this@resolve.resolve(JSObject())
|
|
398
|
+
}
|
|
399
|
+
else -> {
|
|
400
|
+
this@resolve.resolve(jsonMapOf("value" to result).toJSObject())
|
|
323
401
|
}
|
|
324
402
|
}
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
this.reject(method, e)
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
internal fun <T> PluginCall.resolvePending(method: String, function: () -> PendingResult<T>) {
|
|
332
|
-
resolveDeferred(method) { callback ->
|
|
333
|
-
function().addResultCallback {
|
|
334
|
-
callback(it, null)
|
|
403
|
+
} catch (e: Exception) {
|
|
404
|
+
this@resolve.reject(method, e)
|
|
335
405
|
}
|
|
336
406
|
}
|
|
337
407
|
}
|