appsflyer-capacitor-plugin 6.3.5-beta.0 → 6.4.4-rc2

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.
@@ -11,6 +11,7 @@ Pod::Spec.new do |s|
11
11
  s.author = package['author']
12
12
  s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
13
  s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
+ s.static_framework = true
14
15
  s.ios.deployment_target = '12.0'
15
16
  s.dependency 'Capacitor'
16
17
  s.swift_version = '5.1'
package/CHANGELOG.md ADDED
@@ -0,0 +1,31 @@
1
+ # Release Notes
2
+ ### 6.4.4-rc2
3
+ Release date: *2021-December-13*
4
+ - Updated AppsFlyer Android SDK to v6.4.3
5
+ - Updated AppsFlyer iOS SDK to v6.4.4
6
+ ### 6.4.0
7
+ Release date: *2021-Sep-14*
8
+
9
+ **Overview and Highlights:**
10
+ - Capacitor >> Update Plugin to v6.4.0
11
+ - Capacitor >> Add APIs
12
+ - added `logCrossPromoteImpression` API
13
+ - added `setUserEmails` API
14
+ - added `logLocation` API
15
+ - added `setPhoneNumber` API
16
+ - added `setPartnerData` API
17
+ - added `deepLinkTimeout` Parameter
18
+ - added `logInvite` API
19
+ - added `setSharingFilterForPartners` API
20
+ - deprecate `setSharingFilterForAllPartners` API
21
+ - deprecate `setSharingFilter` API
22
+
23
+
24
+ ### 6.3.50
25
+ Release date: *2021-Aug-22*
26
+
27
+ **Overview and Highlights:**
28
+ - Create a new plugin
29
+ - Use iOS native SDK V6.3.5
30
+ - Use Android native SDK V6.3.2
31
+ - Support the new API `setCurrentDeviceLanguage` for iOS
package/README.md CHANGED
@@ -1,12 +1,11 @@
1
- <img src="https://massets.appsflyer.com/wp-content/uploads/2018/06/20092440/static-ziv_1TP.png" width="400" >
1
+ <img src="https://raw.githubusercontent.com/AppsFlyerSDK/appsflyer-capacitor-plugin/main/assets/AFLogo_primary.png" width="600" >
2
2
 
3
3
  # AppsFlyer Capacitor plugin for Android and iOS.
4
4
 
5
5
 
6
- [![npm version](https://badge.fury.io/js/appsflyer-capacitor-plugin.svg)](https://badge.fury.io/js/cordova-plugin-appsflyer-sdk)
6
+ [![npm version](https://badge.fury.io/js/appsflyer-capacitor-plugin.svg)](https://badge.fury.io/js/appsflyer-capacitor-plugin)
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
8
- [![Downloads](https://img.shields.io/npm/dm/appsflyer-capacitor-plugin.svg)](https://www.npmjs.com/package/cordova-plugin-appsflyer-sdk)
9
-
8
+ [![Downloads](https://img.shields.io/npm/dm/appsflyer-capacitor-plugin)](https://www.npmjs.com/package/appsflyer-capacitor-plugin)
10
9
 
11
10
  🛠 In order for us to provide optimal support, we would kindly ask you to submit any issues to support@appsflyer.com
12
11
 
@@ -15,8 +14,8 @@
15
14
 
16
15
  ### <a id="plugin-build-for"> This plugin is built for
17
16
 
18
- - Android AppsFlyer SDK **6.3.2️**
19
- - iOS AppsFlyer SDK **6.3.5️**
17
+ - Android AppsFlyer SDK **6.4.0️**
18
+ - iOS AppsFlyer SDK **6.4.4️**
20
19
 
21
20
  <!---
22
21
  ## <a id="breaking-changes"> ❗❗ Breaking changes when updating to ✏️v*.*.*✏️❗❗
@@ -59,10 +59,10 @@ dependencies {
59
59
  testImplementation "junit:junit:$junitVersion"
60
60
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
61
61
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
62
- implementation "androidx.core:core-ktx:+"
62
+ implementation "androidx.core:core-ktx:1.6.0"
63
63
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
64
64
 
65
- implementation 'com.appsflyer:af-android-sdk:6.3.2'
65
+ implementation 'com.appsflyer:af-android-sdk:6.4.3'
66
66
  implementation "com.android.installreferrer:installreferrer:2.2"
67
67
 
68
68
 
@@ -49,8 +49,16 @@ object AppsFlyerConstants {
49
49
  const val AF_MIN_TIME = "minTimeBetweenSessions"
50
50
  const val AF_PARAMETERS= "parameters"
51
51
  const val AF_CONTAINS = "contains"
52
+ const val AF_EMAILS = "emails"
53
+ const val AF_ENCODE = "encode"
52
54
  const val AF_NULL_DEV_KEY = "Dev key is null"
53
-
55
+ const val AF_LATITUDE = "latitude"
56
+ const val AF_LONGITUDE = "longitude"
57
+ const val AF_PHONE = "phone"
58
+ const val AF_DATA = "data"
59
+ const val AF_PARTNER_ID = "partnerId"
60
+ const val AF_DEEP_LINK_TIME_OUT = "deepLinkTimeout"
61
+ const val AF_EVENT_PARAMETERS = "eventParameters"
54
62
 
55
63
 
56
64
 
@@ -6,6 +6,7 @@ import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_ADDITIONAL_DATA
6
6
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_ADDITIONAL_PARAMETERS
7
7
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_ADD_PARAMETERS
8
8
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_ANONYMIZE_USER
9
+ import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_APP_ID
9
10
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_BASE_DEEPLINK
10
11
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_BRAND_DOMAIN
11
12
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_CAMPAIGN
@@ -15,24 +16,33 @@ import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_CONVERSION_LISTENER
15
16
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_CUID
16
17
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_CURRENCY
17
18
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_CURRENCY_CODE
19
+ import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_DATA
18
20
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_DEBUG
19
21
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_DEEPLINK_URLS
22
+ import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_DEEP_LINK_TIME_OUT
20
23
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_DEV_KEY
21
24
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_DISABLE_SKAD
25
+ import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_EMAILS
26
+ import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_ENCODE
22
27
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_EVENT_NAME
28
+ import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_EVENT_PARAMETERS
23
29
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_EVENT_VALUE
24
30
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_FB
25
31
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_FILTERS
26
32
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_HOST_NAME
27
33
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_HOST_PREFIX
28
34
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_IS_STOP
35
+ import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_LATITUDE
29
36
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_LINK_READY
37
+ import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_LONGITUDE
30
38
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_MIN_TIME
31
39
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_OAOA
32
40
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_ONELINK_DOMAIN
33
41
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_ONELINK_ID
34
42
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_PARAMETERS
43
+ import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_PARTNER_ID
35
44
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_PATH
45
+ import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_PHONE
36
46
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_PRICE
37
47
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_PUBLIC_KEY
38
48
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_PURCHASE_DATA
@@ -48,13 +58,11 @@ import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.AF_UID
48
58
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.CONVERSION_CALLBACK
49
59
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.OAOA_CALLBACK
50
60
  import capacitor.plugin.appsflyer.sdk.AppsFlyerConstants.UDL_CALLBACK
51
- import com.appsflyer.AppsFlyerConversionListener
52
- import com.appsflyer.AppsFlyerInAppPurchaseValidatorListener
53
- import com.appsflyer.AppsFlyerLib
54
- import com.appsflyer.CreateOneLinkHttpTask
61
+ import com.appsflyer.*
55
62
  import com.appsflyer.attribution.AppsFlyerRequestListener
56
63
  import com.appsflyer.deeplink.DeepLinkListener
57
64
  import com.appsflyer.deeplink.DeepLinkResult
65
+ import com.appsflyer.share.CrossPromotionHelper
58
66
  import com.appsflyer.share.ShareInviteHelper
59
67
  import com.getcapacitor.JSObject
60
68
  import com.getcapacitor.Plugin
@@ -96,6 +104,7 @@ class AppsFlyerPlugin : Plugin() {
96
104
  conversion = call.getBoolean(AF_CONVERSION_LISTENER, true)
97
105
  oaoa = call.getBoolean(AF_OAOA, true)
98
106
  udl = call.getBoolean(AF_UDL, false)
107
+ val timeout = call.getInt(AF_DEEP_LINK_TIME_OUT)?.toLong()
99
108
 
100
109
  AppsFlyerLib.getInstance().apply {
101
110
  if (debug == true) {
@@ -116,7 +125,11 @@ class AppsFlyerPlugin : Plugin() {
116
125
 
117
126
  }
118
127
  if (udl == true) {
128
+ if (timeout != null){
129
+ subscribeForDeepLink(getDeepLinkListener(), timeout)
130
+ }else{
119
131
  subscribeForDeepLink(getDeepLinkListener())
132
+ }
120
133
  }
121
134
  start(activity ?: context.applicationContext, null, object : AppsFlyerRequestListener {
122
135
  override fun onSuccess() {
@@ -237,6 +250,7 @@ class AppsFlyerPlugin : Plugin() {
237
250
  }
238
251
  }
239
252
 
253
+ @Deprecated("Use setSharingFilterForPartners")
240
254
  @PluginMethod(returnType = PluginMethod.RETURN_NONE)
241
255
  fun setSharingFilter(call: PluginCall) {
242
256
  val arr = call.getArray(AF_FILTERS)
@@ -248,11 +262,20 @@ class AppsFlyerPlugin : Plugin() {
248
262
  }
249
263
  }
250
264
 
265
+ @Deprecated("Use setSharingFilterForPartners")
251
266
  @PluginMethod(returnType = PluginMethod.RETURN_NONE)
252
267
  fun setSharingFilterForAllPartners(call: PluginCall) {
253
268
  AppsFlyerLib.getInstance().setSharingFilterForAllPartners()
254
269
  }
255
270
 
271
+ @PluginMethod(returnType = PluginMethod.RETURN_NONE)
272
+ fun setSharingFilterForPartners(call: PluginCall) {
273
+ val filters = call.getArray(AF_FILTERS)?.run {
274
+ toList<String>().toTypedArray()
275
+ } ?: return call.reject("cannot extract the filters value")
276
+ AppsFlyerLib.getInstance().setSharingFilterForPartners(*filters)
277
+
278
+ }
256
279
  @PluginMethod(returnType = PluginMethod.RETURN_NONE)
257
280
  fun setAdditionalData(call: PluginCall) {
258
281
  val data = call.getObject(AF_ADDITIONAL_DATA)
@@ -440,6 +463,87 @@ class AppsFlyerPlugin : Plugin() {
440
463
  activity.intent = i
441
464
  AppsFlyerLib.getInstance().sendPushNotificationData(activity)
442
465
 
466
+ }
467
+ @PluginMethod()
468
+ fun logCrossPromoteImpression(call: PluginCall) {
469
+ val appID = call.getString(AF_APP_ID) ?: return call.reject("cannot extract the appID value")
470
+ val campaign = call.getString(AF_CAMPAIGN) ?: return call.reject("cannot extract the campaign value")
471
+ val parameters = AFHelpers.jsonToStringMap(call.getObject(AF_PARAMETERS)) ?: return call.reject("cannot extract the parameters value")
472
+
473
+ CrossPromotionHelper.logCrossPromoteImpression(
474
+ context.applicationContext ,
475
+ appID,
476
+ campaign,
477
+ parameters
478
+ )
479
+ val ret = JSObject()
480
+ ret.put("res", "ok")
481
+ call.resolve(ret)
482
+
483
+ }
484
+
485
+ @PluginMethod()
486
+ fun setUserEmails(call: PluginCall) {
487
+ val emails = call.getArray(AF_EMAILS)?.run {
488
+ toList<String>().toTypedArray()
489
+ } ?: return call.reject("cannot extract the emails value")
490
+
491
+ val enc = call.getBoolean(AF_ENCODE)
492
+
493
+ if(enc != true){
494
+ AppsFlyerLib.getInstance().setUserEmails(*emails)
495
+ }else{
496
+ AppsFlyerLib.getInstance().setUserEmails(AppsFlyerProperties.EmailsCryptType.SHA256 ,*emails)
497
+ }
498
+
499
+ val ret = JSObject()
500
+ ret.put("res", "ok")
501
+ call.resolve(ret)
502
+
503
+ }
504
+
505
+ @PluginMethod()
506
+ fun logLocation(call: PluginCall) {
507
+ val longitude = call.getDouble(AF_LONGITUDE) ?: return call.reject("cannot extract the longitude value")
508
+ val latitude = call.getDouble(AF_LATITUDE) ?: return call.reject("cannot extract the latitude value")
509
+ AppsFlyerLib.getInstance().logLocation(context.applicationContext , latitude , longitude)
510
+ val ret = JSObject()
511
+ ret.put("res", "ok")
512
+ call.resolve(ret)
513
+
514
+ }
515
+
516
+ @PluginMethod()
517
+ fun setPhoneNumber(call: PluginCall) {
518
+ val phone = call.getString(AF_PHONE) ?: return call.reject("cannot extract the phone value")
519
+ AppsFlyerLib.getInstance().setPhoneNumber(phone)
520
+ val ret = JSObject()
521
+ ret.put("res", "ok")
522
+ call.resolve(ret)
523
+
524
+ }
525
+
526
+ @PluginMethod()
527
+ fun setPartnerData(call: PluginCall) {
528
+ val data = AFHelpers.jsonToMap(call.getObject(AF_DATA)) ?: return call.reject("cannot extract the data value")
529
+ val pid = call.getString(AF_PARTNER_ID) ?: return call.reject("cannot extract the partnerId value")
530
+
531
+ AppsFlyerLib.getInstance().setPartnerData(pid,data)
532
+ val ret = JSObject()
533
+ ret.put("res", "ok")
534
+ call.resolve(ret)
535
+
536
+ }
537
+
538
+ @PluginMethod()
539
+ fun logInvite(call: PluginCall) {
540
+ val data = AFHelpers.jsonToStringMap(call.getObject(AF_EVENT_PARAMETERS)) ?: return call.reject("cannot extract the eventParameters value")
541
+ val channel = call.getString(AF_CHANNEL) ?: return call.reject("cannot extract the channel value")
542
+ ShareInviteHelper.logInvite(activity.application, channel, data)
543
+ val ret = JSObject()
544
+ ret.put("res", "ok")
545
+ call.resolve(ret)
546
+
443
547
  }
444
548
 
445
549
  private fun getDeepLinkListener(): DeepLinkListener {
@@ -9,6 +9,7 @@ export interface AFInit {
9
9
  useUninstallSandbox?: boolean;
10
10
  useReceiptValidationSandbox?: boolean;
11
11
  minTimeBetweenSessions?: number;
12
+ deepLinkTimeout?: number;
12
13
  }
13
14
  export interface AFEvent {
14
15
  eventName?: string;
@@ -57,6 +58,23 @@ export interface AFIosInAppPurchase extends AFInAppPurchase {
57
58
  price: string;
58
59
  transactionId: string;
59
60
  }
61
+ export interface AFPromotion {
62
+ appID: string;
63
+ campaign: string;
64
+ parameters: StringMap;
65
+ }
66
+ export interface AFLatLng {
67
+ latitude: number;
68
+ longitude: number;
69
+ }
70
+ export interface AFPartnerData {
71
+ data: any;
72
+ partnerId: string;
73
+ }
74
+ export interface AFLogInvite {
75
+ eventParameters: StringMap;
76
+ channel: string;
77
+ }
60
78
  export interface AFLink {
61
79
  link: string;
62
80
  }
@@ -90,6 +108,10 @@ export interface AFUrls {
90
108
  export interface AFPath {
91
109
  path: string[];
92
110
  }
111
+ export interface AFEmails {
112
+ emails: string[];
113
+ encode?: boolean;
114
+ }
93
115
  export interface AFStop {
94
116
  stop: boolean;
95
117
  }
@@ -114,6 +136,9 @@ export interface AFPushPayload {
114
136
  export interface AFLanguage {
115
137
  language: string;
116
138
  }
139
+ export interface AFPhone {
140
+ phone: string;
141
+ }
117
142
  export interface AFHost {
118
143
  hostPrefixName: string;
119
144
  hostName: string;
@@ -1,6 +1,6 @@
1
1
  import type { PluginListenerHandle } from "@capacitor/core";
2
2
  import type { AFConstants } from "./Appsflyer_constants";
3
- import type { AFAndroidInAppPurchase, AFAnonymizeUser, AFAppendToDeepLink, AFCuid, AFCurrency, AFData, AFDisable, AFEvent, AFFbDAL, AFFilters, AFHost, AFInit, AFIosInAppPurchase, AFIsStopped, AFLink, AFLinkGenerator, AFOnelinkDomain, AFOnelinkID, AFPath, AFPushPayload, AFRes, AFStop, AFUid, AFUninstall, AFUrls, AFLanguage, OnAppOpenAttribution, OnConversionDataResult, OnDeepLink } from "./appsflyer_interfaces";
3
+ import type { AFAndroidInAppPurchase, AFAnonymizeUser, AFAppendToDeepLink, AFCuid, AFCurrency, AFData, AFDisable, AFEvent, AFFbDAL, AFFilters, AFHost, AFInit, AFIosInAppPurchase, AFIsStopped, AFLink, AFLinkGenerator, AFOnelinkDomain, AFOnelinkID, AFPath, AFPushPayload, AFRes, AFStop, AFUid, AFUninstall, AFUrls, AFLanguage, OnAppOpenAttribution, OnConversionDataResult, OnDeepLink, AFPromotion, AFEmails, AFLatLng, AFPhone, AFPartnerData, AFLogInvite } from "./appsflyer_interfaces";
4
4
  export interface AppsFlyerPlugin {
5
5
  addListener(eventName: AFConstants.CONVERSION_CALLBACK, listenerFunc: (event: OnConversionDataResult) => void): PluginListenerHandle;
6
6
  addListener(eventName: AFConstants.OAOA_CALLBACK, listenerFunc: (event: OnAppOpenAttribution) => void): PluginListenerHandle;
@@ -54,12 +54,18 @@ export interface AppsFlyerPlugin {
54
54
  addPushNotificationDeepLinkPath(path: AFPath): Promise<void>;
55
55
  /**
56
56
  * Stops events from propagating to the specified AppsFlyer partners.
57
+ * @deprecated deprecated since 6.4.0. Use setSharingFilterForPartners instead
57
58
  */
58
59
  setSharingFilter(filters: AFFilters): Promise<void>;
59
60
  /**
60
61
  * Stops events from propagating to all AppsFlyer partners. Overwrites setSharingFilter.
62
+ * @deprecated deprecated since 6.4.0. Use setSharingFilterForPartners instead
61
63
  */
62
64
  setSharingFilterForAllPartners(): Promise<void>;
65
+ /**
66
+ * Stops events from propagating to the specified AppsFlyer partners.
67
+ */
68
+ setSharingFilterForPartners(filters: AFFilters): Promise<void>;
63
69
  /**
64
70
  * Set additional data to be sent to AppsFlyer. See
65
71
  */
@@ -121,4 +127,30 @@ export interface AppsFlyerPlugin {
121
127
  *
122
128
  */
123
129
  setCurrentDeviceLanguage(language: AFLanguage): Promise<AFRes>;
130
+ /**
131
+ * logs an impression as part of a cross-promotion campaign. Make sure to use the promoted App ID as it appears within the AppsFlyer dashboard.
132
+ *
133
+ */
134
+ logCrossPromoteImpression(data: AFPromotion): Promise<AFRes>;
135
+ /**
136
+ * Set the user emails and encrypt them.
137
+ */
138
+ setUserEmails(emails: AFEmails): Promise<AFRes>;
139
+ /**
140
+ * Manually log the location of the user
141
+ */
142
+ logLocation(latLng: AFLatLng): Promise<AFRes>;
143
+ /**
144
+ * Will be sent as an SHA-256 encrypted string.
145
+ */
146
+ setPhoneNumber(phone: AFPhone): Promise<AFRes>;
147
+ /**
148
+ * Allows sending custom data for partner integration purposes.
149
+ */
150
+ setPartnerData(data: AFPartnerData): Promise<AFRes>;
151
+ /**
152
+ * Use to log a user-invite in-app event (af_invite).
153
+ *
154
+ */
155
+ logInvite(data: AFLogInvite): Promise<AFRes>;
124
156
  }
package/dist/plugin.js CHANGED
@@ -20,5 +20,5 @@ var AppsFlyerCapacitorPlugin = (function (exports, core) {
20
20
 
21
21
  return exports;
22
22
 
23
- }({}, capacitorExports));
23
+ })({}, capacitorExports);
24
24
  //# sourceMappingURL=plugin.js.map
@@ -59,5 +59,14 @@ class AppsFlyerConstants {
59
59
  static let AF_PARAMETERS = "parameters"
60
60
  static let AF_CONTAINS = "contains"
61
61
  static let AF_LANGUAGE = "language"
62
-
62
+ static let AF_EMAILS = "emails"
63
+ static let AF_ENCODE = "encode"
64
+ static let AF_LATITUDE = "latitude"
65
+ static let AF_LONGITUDE = "longitude"
66
+ static let AF_PHONE = "phone"
67
+ static let AF_DEEP_LINK_TIME_OUT = "deepLinkTimeout"
68
+ static let AF_EVENT_PARAMETERS = "eventParameters"
69
+ static let AF_PARTNER_ID = "partnerId"
70
+ static let AF_DATA = "data"
71
+
63
72
  }
@@ -31,6 +31,16 @@ CAP_PLUGIN(AppsFlyerPlugin, "AppsFlyerPlugin",
31
31
  CAP_PLUGIN_METHOD(enableFacebookDeferredApplinks, CAPPluginReturnPromise);
32
32
  CAP_PLUGIN_METHOD(sendPushNotificationData, CAPPluginReturnNone);
33
33
  CAP_PLUGIN_METHOD(setCurrentDeviceLanguage, CAPPluginReturnPromise);
34
+ CAP_PLUGIN_METHOD(logCrossPromoteImpression, CAPPluginReturnPromise);
35
+ CAP_PLUGIN_METHOD(setUserEmails, CAPPluginReturnPromise);
36
+ CAP_PLUGIN_METHOD(logLocation, CAPPluginReturnPromise);
37
+ CAP_PLUGIN_METHOD(setPhoneNumber, CAPPluginReturnPromise);
38
+ CAP_PLUGIN_METHOD(setPartnerData, CAPPluginReturnPromise);
39
+ CAP_PLUGIN_METHOD(logInvite, CAPPluginReturnPromise);
40
+ CAP_PLUGIN_METHOD(setSharingFilterForPartners, CAPPluginReturnPromise);
41
+
42
+
43
+
34
44
 
35
45
 
36
46
 
@@ -32,6 +32,7 @@ public class AppsFlyerPlugin: CAPPlugin {
32
32
  let debug = call.getBool(AppsFlyerConstants.AF_DEBUG, false)
33
33
  let sandbox = call.getBool(AppsFlyerConstants.AF_SANDBOX, false)
34
34
  let receiptSandbox = call.getBool(AppsFlyerConstants.AF_RECEIPT_SANDBOX , false)
35
+
35
36
  conversion = call.getBool(AppsFlyerConstants.AF_CONVERSION_LISTENER, true)
36
37
  oaoa = call.getBool(AppsFlyerConstants.AF_OAOA, true)
37
38
  udl = call.getBool(AppsFlyerConstants.AF_UDL, false)
@@ -46,6 +47,9 @@ public class AppsFlyerPlugin: CAPPlugin {
46
47
  appsflyer.minTimeBetweenSessions = UInt(minTime)
47
48
  }
48
49
 
50
+ if let timeout = call.getInt(AppsFlyerConstants.AF_DEEP_LINK_TIME_OUT){
51
+ appsflyer.deepLinkTimeout = UInt(timeout)
52
+ }
49
53
 
50
54
  if conversion || oaoa {
51
55
  appsflyer.delegate = self
@@ -109,6 +113,7 @@ public class AppsFlyerPlugin: CAPPlugin {
109
113
  }
110
114
  AppsFlyerLib.shared().currencyCode = code
111
115
 
116
+
112
117
  }
113
118
 
114
119
  @objc func updateServerUninstallToken(_ call: CAPPluginCall){
@@ -189,25 +194,30 @@ public class AppsFlyerPlugin: CAPPlugin {
189
194
 
190
195
  }
191
196
 
197
+ @available(*, deprecated, message: "Use setSharingFilterForPartners")
192
198
  @objc func setSharingFilter(_ call: CAPPluginCall){
193
- let arr = call.getArray(AppsFlyerConstants.AF_FILTERS)
194
- var filters :[String] = []
195
- if arr != nil {
196
- for f in arr! {
197
- filters.append(f as! String)
198
- }
199
- }
199
+ let filters = call.getArray(AppsFlyerConstants.AF_FILTERS , String.self)
200
+
200
201
  AppsFlyerLib.shared().sharingFilter = filters
201
202
 
202
203
  }
203
204
 
204
-
205
+ @available(*, deprecated, message: "Use setSharingFilterForPartners")
205
206
  @objc func setSharingFilterForAllPartners(_ call: CAPPluginCall){
206
207
 
207
208
  AppsFlyerLib.shared().setSharingFilterForAllPartners()
208
209
 
209
210
  }
210
211
 
212
+ @objc func setSharingFilterForPartners(_ call: CAPPluginCall){
213
+ guard let filters = call.getArray(AppsFlyerConstants.AF_FILTERS , String.self) else{
214
+ return call.reject("cannot extract the filters value")
215
+ }
216
+
217
+ AppsFlyerLib.shared().setSharingFilterForPartners(filters)
218
+
219
+ }
220
+
211
221
  @objc func setAdditionalData(_ call: CAPPluginCall){
212
222
  guard let data = call.getObject(AppsFlyerConstants.AF_ADDITIONAL_DATA) else {
213
223
  call.reject("Data is missing")
@@ -397,8 +407,95 @@ public class AppsFlyerPlugin: CAPPlugin {
397
407
 
398
408
  }
399
409
 
410
+ @objc func logCrossPromoteImpression(_ call: CAPPluginCall){
411
+ guard let appID = call.getString(AppsFlyerConstants.AF_APP_ID) else {
412
+ call.reject("cannot extract the appID value")
413
+ return
414
+ }
415
+ guard let campaign = call.getString(AppsFlyerConstants.AF_CAMPAIGN) else {
416
+ call.reject("cannot extract the campaign value")
417
+ return
418
+ }
419
+ guard let parameters = call.getObject(AppsFlyerConstants.AF_PARAMETERS) else {
420
+ call.reject("cannot extract the parameters value")
421
+ return
422
+ }
423
+ AppsFlyerCrossPromotionHelper.logCrossPromoteImpression(appID, campaign: campaign, parameters: parameters)
424
+ call.resolve(["res": "ok"])
425
+
426
+ }
427
+
428
+ @objc func setUserEmails(_ call: CAPPluginCall){
429
+ guard let emails = call.getArray(AppsFlyerConstants.AF_EMAILS, String.self) else {
430
+ call.reject("cannot extract the emails value")
431
+ return
432
+ }
433
+ if let enc = call.getBool(AppsFlyerConstants.AF_ENCODE) , enc == true{
434
+ AppsFlyerLib.shared().setUserEmails(emails, with: EmailCryptTypeSHA256)
435
+
436
+ }else{
437
+ AppsFlyerLib.shared().setUserEmails(emails, with: EmailCryptTypeNone)
438
+
439
+ }
440
+ call.resolve(["res": "ok"])
441
+
442
+ }
443
+
444
+ @objc func logLocation(_ call: CAPPluginCall){
445
+ guard let longitude = call.getDouble(AppsFlyerConstants.AF_LONGITUDE) else {
446
+ call.reject("cannot extract the longitude value")
447
+ return
448
+ }
449
+ guard let latitude = call.getDouble(AppsFlyerConstants.AF_LATITUDE) else {
450
+ call.reject("cannot extract the longitude value")
451
+ return
452
+ }
453
+
454
+ AppsFlyerLib.shared().logLocation(longitude: longitude, latitude: latitude)
455
+ call.resolve(["res": "ok"])
456
+
457
+ }
400
458
 
459
+ @objc func setPhoneNumber(_ call: CAPPluginCall){
460
+ guard let phone = call.getString(AppsFlyerConstants.AF_PHONE) else {
461
+ call.reject("cannot extract the phone value")
462
+ return
463
+ }
464
+
465
+ AppsFlyerLib.shared().phoneNumber = phone
466
+ call.resolve(["res": "ok"])
467
+
468
+ }
401
469
 
470
+ @objc func setPartnerData(_ call: CAPPluginCall){
471
+ guard let data = call.getObject(AppsFlyerConstants.AF_DATA) else {
472
+ call.reject("cannot extract the data value")
473
+ return
474
+ }
475
+ guard let pid = call.getString(AppsFlyerConstants.AF_PARTNER_ID) else {
476
+ call.reject("cannot extract the partnerId value")
477
+ return
478
+ }
479
+
480
+ AppsFlyerLib.shared().setPartnerData(partnerId: pid, partnerInfo: data)
481
+ call.resolve(["res": "ok"])
482
+
483
+ }
484
+
485
+ @objc func logInvite(_ call: CAPPluginCall){
486
+ guard let data = call.getObject(AppsFlyerConstants.AF_EVENT_PARAMETERS) else {
487
+ call.reject("cannot extract the eventParameters value")
488
+ return
489
+ }
490
+ guard let channel = call.getString(AppsFlyerConstants.AF_CHANNEL) else {
491
+ call.reject("cannot extract the channel value")
492
+ return
493
+ }
494
+
495
+ AppsFlyerShareInviteHelper.logInvite(channel, parameters: data)
496
+ call.resolve(["res": "ok"])
497
+
498
+ }
402
499
  }
403
500
 
404
501
  extension AppsFlyerPlugin{
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "appsflyer-capacitor-plugin",
3
- "version": "6.3.5-beta.0",
4
- "iosSdkVersion": "6.3.5",
3
+ "version" : "6.4.4-rc2",
4
+ "iosSdkVersion": "6.4.4",
5
5
  "description": "AppsFlyer SDK plugin for Capacitor",
6
6
  "main": "dist/plugin.cjs.js",
7
7
  "module": "dist/esm/index.js",
@@ -3,12 +3,13 @@ export interface AFInit{
3
3
  appID: string;
4
4
  isDebug?: boolean;
5
5
  waitForATTUserAuthorization?: number;
6
- registerConversionListener? : boolean;
7
- registerOnAppOpenAttribution? : boolean;
8
- registerOnDeepLink? : boolean;
9
- useUninstallSandbox? :boolean;
10
- useReceiptValidationSandbox? :boolean;
11
- minTimeBetweenSessions?:number
6
+ registerConversionListener?: boolean;
7
+ registerOnAppOpenAttribution?: boolean;
8
+ registerOnDeepLink?: boolean;
9
+ useUninstallSandbox?: boolean;
10
+ useReceiptValidationSandbox?: boolean;
11
+ minTimeBetweenSessions?: number
12
+ deepLinkTimeout?: number
12
13
 
13
14
  }
14
15
 
@@ -64,6 +65,24 @@ export interface AFIosInAppPurchase extends AFInAppPurchase{
64
65
  transactionId: string;
65
66
  }
66
67
 
68
+ export interface AFPromotion {
69
+ appID:string,
70
+ campaign:string,
71
+ parameters:StringMap,
72
+ }
73
+
74
+ export interface AFLatLng{
75
+ latitude: number,
76
+ longitude: number
77
+ }
78
+ export interface AFPartnerData{
79
+ data: any,
80
+ partnerId: string
81
+ }
82
+ export interface AFLogInvite{
83
+ eventParameters: StringMap,
84
+ channel: string
85
+ }
67
86
  export interface AFLink {link:string}
68
87
  export interface AFRes {res:string}
69
88
  export interface AFUninstall {token: string}
@@ -75,6 +94,8 @@ export interface AFOnelinkID {onelinkID: string}
75
94
  export interface AFOnelinkDomain {domains: string[]}
76
95
  export interface AFUrls {urls: string[]}
77
96
  export interface AFPath {path: string[]}
97
+ export interface AFEmails {emails: string[],
98
+ encode?: boolean}
78
99
  export interface AFStop {stop: boolean}
79
100
  export interface AFIsStopped {isStopped: boolean}
80
101
  export interface AFFilters{filters: string[]}
@@ -83,6 +104,7 @@ export interface AFDisable{shouldDisable: boolean}
83
104
  export interface AFFbDAL{enableFacebookDAL: boolean}
84
105
  export interface AFPushPayload{pushPayload: StringMap}
85
106
  export interface AFLanguage{language: string}
107
+ export interface AFPhone{phone: string}
86
108
  export interface AFHost{hostPrefixName: string;
87
109
  hostName: string;
88
110
  }
@@ -30,7 +30,13 @@ import type {
30
30
  AFLanguage,
31
31
  OnAppOpenAttribution,
32
32
  OnConversionDataResult,
33
- OnDeepLink
33
+ OnDeepLink,
34
+ AFPromotion,
35
+ AFEmails,
36
+ AFLatLng,
37
+ AFPhone,
38
+ AFPartnerData,
39
+ AFLogInvite
34
40
  } from "./appsflyer_interfaces";
35
41
 
36
42
  export interface AppsFlyerPlugin {
@@ -111,14 +117,21 @@ export interface AppsFlyerPlugin {
111
117
 
112
118
  /**
113
119
  * Stops events from propagating to the specified AppsFlyer partners.
120
+ * @deprecated deprecated since 6.4.0. Use setSharingFilterForPartners instead
114
121
  */
115
122
  setSharingFilter(filters: AFFilters): Promise<void>
116
123
 
117
124
  /**
118
125
  * Stops events from propagating to all AppsFlyer partners. Overwrites setSharingFilter.
126
+ * @deprecated deprecated since 6.4.0. Use setSharingFilterForPartners instead
119
127
  */
120
128
  setSharingFilterForAllPartners(): Promise<void>
121
129
 
130
+ /**
131
+ * Stops events from propagating to the specified AppsFlyer partners.
132
+ */
133
+ setSharingFilterForPartners(filters: AFFilters): Promise<void>
134
+
122
135
  /**
123
136
  * Set additional data to be sent to AppsFlyer. See
124
137
  */
@@ -195,5 +208,36 @@ export interface AppsFlyerPlugin {
195
208
  */
196
209
  setCurrentDeviceLanguage(language: AFLanguage): Promise<AFRes>;
197
210
 
211
+ /**
212
+ * logs an impression as part of a cross-promotion campaign. Make sure to use the promoted App ID as it appears within the AppsFlyer dashboard.
213
+ *
214
+ */
215
+ logCrossPromoteImpression(data: AFPromotion): Promise<AFRes>;
216
+
217
+ /**
218
+ * Set the user emails and encrypt them.
219
+ */
220
+ setUserEmails(emails: AFEmails): Promise<AFRes>;
221
+
222
+ /**
223
+ * Manually log the location of the user
224
+ */
225
+ logLocation(latLng : AFLatLng): Promise<AFRes>;
226
+
227
+ /**
228
+ * Will be sent as an SHA-256 encrypted string.
229
+ */
230
+ setPhoneNumber(phone : AFPhone): Promise<AFRes>;
231
+
232
+ /**
233
+ * Allows sending custom data for partner integration purposes.
234
+ */
235
+ setPartnerData(data : AFPartnerData): Promise<AFRes>;
236
+
237
+ /**
238
+ * Use to log a user-invite in-app event (af_invite).
239
+ *
240
+ */
241
+ logInvite(data : AFLogInvite): Promise<AFRes>;
198
242
  }
199
243