@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.
@@ -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 = '14.0'
13
+ s.ios.deployment_target = '15.0'
14
14
  s.dependency 'Capacitor'
15
- s.swift_version = '5.1'
16
- s.dependency "AirshipFrameworkProxy", "11.1.0"
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
@@ -1,17 +1,17 @@
1
1
  ext {
2
- airshipProxyVersion = project.hasProperty('airshipProxyVersion') ? rootProject.ext.airshipProxyVersion : '11.1.0'
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.10'
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.1'
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.VERSION_17
47
- targetCompatibility JavaVersion.VERSION_17
46
+ sourceCompatibility JavaVersion.VERSION_21
47
+ targetCompatibility JavaVersion.VERSION_21
48
48
  }
49
49
  kotlinOptions {
50
- jvmTarget = JavaVersion.VERSION_17
50
+ jvmTarget = JavaVersion.VERSION_21
51
51
  }
52
52
  }
53
53
 
@@ -3,5 +3,5 @@
3
3
  package com.airship.capacitor
4
4
 
5
5
  object AirshipCapacitorVersion {
6
- var version = "3.1.0"
6
+ var version = "4.0.1"
7
7
  }
@@ -90,248 +90,318 @@ class AirshipPlugin : Plugin() {
90
90
 
91
91
  val proxy = AirshipProxy.shared(context)
92
92
 
93
- scope.launch {
94
- when (method) {
95
- // Airship
96
- "takeOff" -> call.resolveResult(method) { proxy.takeOff(arg) }
97
- "isFlying" -> call.resolveResult(method) { proxy.isFlying() }
98
-
99
- // Channel
100
- "channel#getChannelId" -> call.resolveResult(method) { proxy.channel.getChannelId() }
101
-
102
- "channel#editTags" -> call.resolveResult(method) { proxy.channel.editTags(arg) }
103
- "channel#getTags" -> call.resolveResult(method) { proxy.channel.getTags().toList() }
104
- "channel#editTagGroups" -> call.resolveResult(method) { proxy.channel.editTagGroups(arg) }
105
- "channel#editSubscriptionLists" -> call.resolveResult(method) { proxy.channel.editSubscriptionLists(arg) }
106
- "channel#editAttributes" -> call.resolveResult(method) { proxy.channel.editAttributes(arg) }
107
- "channel#getSubscriptionLists" -> call.resolvePending(method) { proxy.channel.getSubscriptionLists() }
108
- "channel#enableChannelCreation" -> call.resolveResult(method) { proxy.channel.enableChannelCreation() }
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
- "push#isUserNotificationsEnabled" -> call.resolveResult(method) { proxy.push.isUserNotificationsEnabled() }
132
- "push#getNotificationStatus" -> call.resolveSuspending(method) { proxy.push.getNotificationStatus() }
133
- "push#getActiveNotifications" -> call.resolveResult(method) {
134
- if (Build.VERSION.SDK_INT >= 23) {
135
- proxy.push.getActiveNotifications()
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
- // In-App
160
- "inApp#setPaused" -> call.resolveResult(method) { proxy.inApp.setPaused(arg.getBoolean(false)) }
161
- "inApp#isPaused" -> call.resolveResult(method) { proxy.inApp.isPaused() }
162
- "inApp#setDisplayInterval" -> call.resolveResult(method) { proxy.inApp.setDisplayInterval(arg.getLong(0)) }
163
- "inApp#getDisplayInterval" -> call.resolveResult(method) { proxy.inApp.getDisplayInterval() }
164
-
165
- // Analytics
166
- "analytics#trackScreen" -> call.resolveResult(method) { proxy.analytics.trackScreen(arg.string) }
167
- "analytics#addCustomEvent" -> call.resolveResult(method) { proxy.analytics.addEvent(arg) }
168
- "analytics#associateIdentifier" -> {
169
- val associatedIdentifierArgs = arg.requireStringList()
170
- proxy.analytics.associateIdentifier(
171
- associatedIdentifierArgs[0],
172
- associatedIdentifierArgs.getOrNull(1)
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
- // Message Center
177
- "messageCenter#getMessages" -> call.resolveResult(method) {
178
- JsonValue.wrapOpt(proxy.messageCenter.getMessages())
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
- "messageCenter#dismiss" -> call.resolveResult(method) { proxy.messageCenter.dismiss() }
181
- "messageCenter#display" -> call.resolveResult(method) { proxy.messageCenter.display(arg.string) }
182
- "messageCenter#showMessageView" -> call.resolveResult(method) { proxy.messageCenter.showMessageView(arg.requireString()) }
183
- "messageCenter#showMessageCenter" -> call.resolveResult(method) { proxy.messageCenter.showMessageCenter(arg.string) }
184
-
185
- "messageCenter#markMessageRead" -> call.resolveResult(method) { proxy.messageCenter.markMessageRead(arg.requireString()) }
186
- "messageCenter#deleteMessage" -> call.resolveResult(method) { proxy.messageCenter.deleteMessage(arg.requireString()) }
187
- "messageCenter#getUnreadCount" -> call.resolveResult(method) { proxy.messageCenter.getUnreadMessagesCount() }
188
- "messageCenter#setAutoLaunchDefaultMessageCenter" -> call.resolveResult(method) { proxy.messageCenter.setAutoLaunchDefaultMessageCenter(arg.requireBoolean()) }
189
- "messageCenter#refreshMessages" -> call.resolveDeferred(method) { resolveCallback ->
190
- proxy.messageCenter.refreshInbox().addResultCallback {
191
- if (it == true) {
192
- resolveCallback(null, null)
193
- } else {
194
- resolveCallback(null, Exception("Failed to refresh"))
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
- // Preference Center
200
- "preferenceCenter#display" -> call.resolveResult(method) { proxy.preferenceCenter.displayPreferenceCenter(arg.requireString()) }
201
- "preferenceCenter#getConfig" -> call.resolvePending(method) { proxy.preferenceCenter.getPreferenceCenterConfig(arg.requireString()) }
202
- "preferenceCenter#setAutoLaunchPreferenceCenter" -> call.resolveResult(method) {
203
- val autoLaunchArgs = arg.requireList()
204
- proxy.preferenceCenter.setAutoLaunchPreferenceCenter(
205
- autoLaunchArgs.get(0).requireString(),
206
- autoLaunchArgs.get(1).getBoolean(false)
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
- // Privacy Manager
211
- "privacyManager#setEnabledFeatures" -> call.resolveResult(method) { proxy.privacyManager.setEnabledFeatures(arg.requireStringList()) }
212
- "privacyManager#getEnabledFeatures" -> call.resolveResult(method) { proxy.privacyManager.getFeatureNames() }
213
- "privacyManager#enableFeatures" -> call.resolveResult(method) { proxy.privacyManager.enableFeatures(arg.requireStringList()) }
214
- "privacyManager#disableFeatures" -> call.resolveResult(method) { proxy.privacyManager.disableFeatures(arg.requireStringList()) }
215
- "privacyManager#isFeaturesEnabled" -> call.resolveResult(method) { proxy.privacyManager.isFeatureEnabled(arg.requireStringList()) }
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
- // Feature Flag
239
- "featureFlagManager#flag" -> call.resolveSuspending(method) {
240
- proxy.featureFlagManager.flag(arg.requireString())
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
- "featureFlagManager#trackInteraction" -> {
244
- call.resolveSuspending(method) {
245
- val featureFlagProxy = FeatureFlagProxy(arg)
246
- proxy.featureFlagManager.trackInteraction(flag = featureFlagProxy)
247
- }
248
- }
225
+ // Message Center
226
+ "messageCenter#getMessages" -> call.resolve(scope, method) {
227
+ JsonValue.wrapOpt(proxy.messageCenter.getMessages())
228
+ }
249
229
 
250
- // Live Update
251
- "liveUpdateManager#list" -> call.resolveSuspending(method) {
252
- val request = LiveUpdateRequest.List.fromJson(arg)
253
- proxy.liveUpdateManager.list(request)
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
- "liveUpdateManager#listAll" -> call.resolveSuspending(method) {
257
- proxy.liveUpdateManager.listAll()
258
- }
238
+ "messageCenter#showMessageCenter" -> call.resolve(scope, method) {
239
+ proxy.messageCenter.showMessageCenter(
240
+ arg.string
241
+ )
242
+ }
259
243
 
260
- "liveUpdateManager#start" -> call.resolveSuspending(method) {
261
- val request = LiveUpdateRequest.Start.fromJson(arg)
262
- proxy.liveUpdateManager.start(request)
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
- "liveUpdateManager#update" -> call.resolveSuspending(method) {
266
- val request = LiveUpdateRequest.Update.fromJson(arg)
267
- proxy.liveUpdateManager.update(request)
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
- "liveUpdateManager#end" -> call.resolveSuspending(method) {
271
- val request = LiveUpdateRequest.End.fromJson(arg)
272
- proxy.liveUpdateManager.end(request)
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
- "liveUpdateManager#clearAll" -> call.resolveSuspending(method) {
276
- proxy.liveUpdateManager.clearAll()
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
- else -> call.reject("Not implemented")
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
- internal fun PluginCall.resolveResult(method: String, function: () -> Any?) {
288
- resolveDeferred(method) { callback -> callback(function(), null) }
289
- }
372
+ "liveUpdateManager#update" -> call.resolve(scope, method) {
373
+ val request = LiveUpdateRequest.Update.fromJson(arg)
374
+ proxy.liveUpdateManager.update(request)
375
+ }
290
376
 
291
- internal suspend fun PluginCall.resolveSuspending(method: String, function: suspend () -> Any?) {
292
- try {
293
- when (val result = function()) {
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
- else -> {
298
- this.resolve(jsonMapOf("value" to result).toJSObject())
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
- internal fun <T> PluginCall.resolveDeferred(method: String, function: ((T?, Exception?) -> Unit) -> Unit) {
307
- try {
308
- function { result, error ->
309
- if (error != null) {
310
- this.reject(method, error)
311
- } else {
312
- try {
313
- when (result) {
314
- is Unit -> {
315
- this.resolve(JSObject())
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
- } catch (e: Exception) {
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
  }
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var core = require('@capacitor/core');
6
4
 
7
5
  /**