appsflyer-capacitor-plugin 6.4.2-rc2 → 6.5.2
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/CHANGELOG.md +9 -5
- package/README.md +2 -2
- package/android/build.gradle +1 -1
- package/dist/plugin.js +1 -1
- package/ios/Plugin/AppsFlyerPlugin.swift +556 -555
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
# Release Notes
|
|
2
|
-
### 6.
|
|
3
|
-
Release date: *
|
|
4
|
-
- Updated AppsFlyer Android SDK to v6.
|
|
5
|
-
- Updated AppsFlyer iOS SDK to v6.
|
|
2
|
+
### 6.5.2
|
|
3
|
+
Release date: *2022-February-07*
|
|
4
|
+
- Updated AppsFlyer Android SDK to v6.5.2
|
|
5
|
+
- Updated AppsFlyer iOS SDK to v6.5.2
|
|
6
6
|
|
|
7
7
|
**Overview and Highlights:**
|
|
8
|
-
-
|
|
8
|
+
- Capacitor >> iOS >> `is_deferred` not available
|
|
9
|
+
### 6.4.4
|
|
10
|
+
Release date: *2021-December-13*
|
|
11
|
+
- Updated AppsFlyer Android SDK to v6.4.3
|
|
12
|
+
- Updated AppsFlyer iOS SDK to v6.4.4
|
|
9
13
|
### 6.4.0
|
|
10
14
|
Release date: *2021-Sep-14*
|
|
11
15
|
|
package/README.md
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
|
|
15
15
|
### <a id="plugin-build-for"> This plugin is built for
|
|
16
16
|
|
|
17
|
-
- Android AppsFlyer SDK **6.
|
|
18
|
-
- iOS AppsFlyer SDK **6.
|
|
17
|
+
- Android AppsFlyer SDK **6.5.2️**
|
|
18
|
+
- iOS AppsFlyer SDK **6.5.2️**
|
|
19
19
|
|
|
20
20
|
<!---
|
|
21
21
|
## <a id="breaking-changes"> ❗❗ Breaking changes when updating to ✏️v*.*.*✏️❗❗
|
package/android/build.gradle
CHANGED
|
@@ -62,7 +62,7 @@ dependencies {
|
|
|
62
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.
|
|
65
|
+
implementation 'com.appsflyer:af-android-sdk:6.5.2'
|
|
66
66
|
implementation "com.android.installreferrer:installreferrer:2.2"
|
|
67
67
|
|
|
68
68
|
|
package/dist/plugin.js
CHANGED
|
@@ -5,599 +5,600 @@ import AppsFlyerLib
|
|
|
5
5
|
|
|
6
6
|
@objc(AppsFlyerPlugin)
|
|
7
7
|
public class AppsFlyerPlugin: CAPPlugin {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
private var conversion = true
|
|
9
|
+
private var oaoa = true
|
|
10
|
+
private var udl = false
|
|
11
|
+
|
|
12
|
+
override public func load() {
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
NotificationCenter.default.addObserver(self, selector: #selector(self.handleUrlOpened(notification:)), name: Notification.Name.capacitorOpenURL, object: nil)
|
|
15
|
-
NotificationCenter.default.addObserver(self, selector: #selector(self.handleUniversalLink(notification:)), name: Notification.Name.capacitorOpenUniversalLink, object: nil)
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@objc func initSDK(_ call: CAPPluginCall){
|
|
21
|
-
let appsflyer = AppsFlyerLib.shared()
|
|
22
|
-
guard let devKey = call.getString(AppsFlyerConstants.AF_DEV_KEY) else{
|
|
23
|
-
call.reject("devkey is missing")
|
|
24
|
-
return
|
|
25
|
-
}
|
|
26
|
-
guard let appID = call.getString(AppsFlyerConstants.AF_APP_ID) else{
|
|
27
|
-
call.reject("appID is missing")
|
|
28
|
-
return
|
|
29
|
-
}
|
|
30
|
-
let attInterval = call.getInt(AppsFlyerConstants.AF_ATT)
|
|
31
|
-
|
|
32
|
-
let debug = call.getBool(AppsFlyerConstants.AF_DEBUG, false)
|
|
33
|
-
let sandbox = call.getBool(AppsFlyerConstants.AF_SANDBOX, false)
|
|
34
|
-
let receiptSandbox = call.getBool(AppsFlyerConstants.AF_RECEIPT_SANDBOX , false)
|
|
35
|
-
|
|
36
|
-
conversion = call.getBool(AppsFlyerConstants.AF_CONVERSION_LISTENER, true)
|
|
37
|
-
oaoa = call.getBool(AppsFlyerConstants.AF_OAOA, true)
|
|
38
|
-
udl = call.getBool(AppsFlyerConstants.AF_UDL, false)
|
|
39
|
-
|
|
40
|
-
appsflyer.isDebug = debug
|
|
41
|
-
appsflyer.appsFlyerDevKey = devKey
|
|
42
|
-
appsflyer.appleAppID = appID
|
|
43
|
-
appsflyer.useUninstallSandbox = sandbox
|
|
44
|
-
appsflyer.useReceiptValidationSandbox = receiptSandbox
|
|
45
|
-
|
|
46
|
-
if let minTime = call.getInt(AppsFlyerConstants.AF_MIN_TIME){
|
|
47
|
-
appsflyer.minTimeBetweenSessions = UInt(minTime)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if let timeout = call.getInt(AppsFlyerConstants.AF_DEEP_LINK_TIME_OUT){
|
|
51
|
-
appsflyer.deepLinkTimeout = UInt(timeout)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if conversion || oaoa {
|
|
55
|
-
appsflyer.delegate = self
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if udl {
|
|
59
|
-
appsflyer.deepLinkDelegate = self
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
reportBridgeReady()
|
|
63
|
-
|
|
64
|
-
#if !AFSDK_NO_IDFA
|
|
65
|
-
if attInterval != nil {
|
|
66
|
-
appsflyer.waitForATTUserAuthorization(timeoutInterval: Double(attInterval!))
|
|
67
|
-
}
|
|
68
|
-
#endif
|
|
69
|
-
|
|
70
|
-
NotificationCenter.default.addObserver(self, selector: #selector(sendLaunch), name: UIApplication.didBecomeActiveNotification, object: nil)
|
|
71
|
-
|
|
72
|
-
appsflyer.start(completionHandler: { (dictionnary, error) in
|
|
73
|
-
if (error != nil){
|
|
74
|
-
call.reject(error!.localizedDescription)
|
|
75
|
-
return
|
|
76
|
-
} else {
|
|
77
|
-
call.resolve(["res":"ok"])
|
|
78
|
-
return
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
@objc func logEvent(_ call: CAPPluginCall){
|
|
84
|
-
guard let eventName = call.getString(AppsFlyerConstants.AF_EVENT_NAME) else{
|
|
85
|
-
call.reject("missing event name")
|
|
86
|
-
return
|
|
87
|
-
}
|
|
88
|
-
let eventValue = call.getObject(AppsFlyerConstants.AF_EVENT_VALUE)
|
|
89
|
-
|
|
90
|
-
AppsFlyerLib.shared().logEvent(name: eventName, values: eventValue) { (response: [String : Any]?, error: Error?) in
|
|
91
|
-
if let response = response {
|
|
92
|
-
call.resolve(["res":response])
|
|
93
|
-
}
|
|
94
|
-
if let error = error {
|
|
95
|
-
call.reject(error.localizedDescription, nil, error)
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
@objc func setCustomerUserId(_ call: CAPPluginCall){
|
|
101
|
-
guard let cuid = call.getString(AppsFlyerConstants.AF_CUID) else {
|
|
102
|
-
call.reject("Invalid Customer User ID")
|
|
103
|
-
return
|
|
104
|
-
}
|
|
105
|
-
AppsFlyerLib.shared().customerUserID = cuid
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
@objc func setCurrencyCode(_ call: CAPPluginCall){
|
|
110
|
-
guard let code = call.getString(AppsFlyerConstants.AF_CURRENCY_CODE) else {
|
|
111
|
-
call.reject("Invalid Currency Code")
|
|
112
|
-
return
|
|
113
|
-
}
|
|
114
|
-
AppsFlyerLib.shared().currencyCode = code
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
@objc func updateServerUninstallToken(_ call: CAPPluginCall){
|
|
120
|
-
guard let token = call.getString(AppsFlyerConstants.AF_TOKEN) else {
|
|
121
|
-
call.reject("Invalid device token")
|
|
122
|
-
|
|
123
|
-
return
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
guard let deviceTokenData = token.hexadecimalToData else{
|
|
127
|
-
call.reject("Invalid device token")
|
|
128
|
-
return
|
|
129
|
-
}
|
|
130
|
-
AppsFlyerLib.shared().registerUninstall(deviceTokenData)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
@objc func setAppInviteOneLink(_ call: CAPPluginCall){
|
|
134
|
-
guard let id = call.getString(AppsFlyerConstants.AF_ONELINK_ID) else {
|
|
135
|
-
call.reject("Onelink id is missing")
|
|
136
|
-
return
|
|
137
|
-
}
|
|
138
|
-
AppsFlyerLib.shared().appInviteOneLinkID = id
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
@objc func setOneLinkCustomDomain(_ call: CAPPluginCall){
|
|
143
|
-
guard let arr = call.getArray(AppsFlyerConstants.AF_ONELINK_DOMAIN) else {
|
|
144
|
-
call.reject("Domains are missing")
|
|
145
|
-
return
|
|
146
|
-
}
|
|
147
|
-
var domains :[String] = []
|
|
148
|
-
for dom in arr {
|
|
149
|
-
domains.append(dom as! String)
|
|
150
|
-
}
|
|
151
|
-
AppsFlyerLib.shared().oneLinkCustomDomains = domains
|
|
152
|
-
|
|
153
|
-
}
|
|
14
|
+
NotificationCenter.default.addObserver(self, selector: #selector(self.handleUrlOpened(notification:)), name: Notification.Name.capacitorOpenURL, object: nil)
|
|
15
|
+
NotificationCenter.default.addObserver(self, selector: #selector(self.handleUniversalLink(notification:)), name: Notification.Name.capacitorOpenUniversalLink, object: nil)
|
|
154
16
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
for (k,v) in parameters{
|
|
164
|
-
params[k] = (v as! String)
|
|
165
|
-
}
|
|
166
|
-
AppsFlyerLib.shared().appendParametersToDeeplinkURL(contains: contains, parameters:params )
|
|
167
|
-
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@objc func initSDK(_ call: CAPPluginCall){
|
|
21
|
+
let appsflyer = AppsFlyerLib.shared()
|
|
22
|
+
guard let devKey = call.getString(AppsFlyerConstants.AF_DEV_KEY) else{
|
|
23
|
+
call.reject("devkey is missing")
|
|
24
|
+
return
|
|
168
25
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
guard let arr = call.getArray(AppsFlyerConstants.AF_DEEPLINK_URLS) else {
|
|
173
|
-
call.reject("URLs are missing")
|
|
174
|
-
return
|
|
175
|
-
}
|
|
176
|
-
var urls :[String] = []
|
|
177
|
-
for url in arr {
|
|
178
|
-
urls.append(url as! String)
|
|
179
|
-
}
|
|
180
|
-
AppsFlyerLib.shared().oneLinkCustomDomains = urls
|
|
181
|
-
|
|
26
|
+
guard let appID = call.getString(AppsFlyerConstants.AF_APP_ID) else{
|
|
27
|
+
call.reject("appID is missing")
|
|
28
|
+
return
|
|
182
29
|
}
|
|
30
|
+
let attInterval = call.getInt(AppsFlyerConstants.AF_ATT)
|
|
183
31
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
path.append(p as! String)
|
|
192
|
-
}
|
|
193
|
-
AppsFlyerLib.shared().addPushNotificationDeepLinkPath(path)
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
@available(*, deprecated, message: "Use setSharingFilterForPartners")
|
|
198
|
-
@objc func setSharingFilter(_ call: CAPPluginCall){
|
|
199
|
-
let filters = call.getArray(AppsFlyerConstants.AF_FILTERS , String.self)
|
|
200
|
-
|
|
201
|
-
AppsFlyerLib.shared().sharingFilter = filters
|
|
202
|
-
|
|
203
|
-
}
|
|
32
|
+
let debug = call.getBool(AppsFlyerConstants.AF_DEBUG, false)
|
|
33
|
+
let sandbox = call.getBool(AppsFlyerConstants.AF_SANDBOX, false)
|
|
34
|
+
let receiptSandbox = call.getBool(AppsFlyerConstants.AF_RECEIPT_SANDBOX , false)
|
|
35
|
+
|
|
36
|
+
conversion = call.getBool(AppsFlyerConstants.AF_CONVERSION_LISTENER, true)
|
|
37
|
+
oaoa = call.getBool(AppsFlyerConstants.AF_OAOA, true)
|
|
38
|
+
udl = call.getBool(AppsFlyerConstants.AF_UDL, false)
|
|
204
39
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
40
|
+
appsflyer.isDebug = debug
|
|
41
|
+
appsflyer.appsFlyerDevKey = devKey
|
|
42
|
+
appsflyer.appleAppID = appID
|
|
43
|
+
appsflyer.useUninstallSandbox = sandbox
|
|
44
|
+
appsflyer.useReceiptValidationSandbox = receiptSandbox
|
|
45
|
+
|
|
46
|
+
if let minTime = call.getInt(AppsFlyerConstants.AF_MIN_TIME){
|
|
47
|
+
appsflyer.minTimeBetweenSessions = UInt(minTime)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if let timeout = call.getInt(AppsFlyerConstants.AF_DEEP_LINK_TIME_OUT){
|
|
51
|
+
appsflyer.deepLinkTimeout = UInt(timeout)
|
|
210
52
|
}
|
|
211
53
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
54
|
+
if conversion || oaoa {
|
|
55
|
+
appsflyer.delegate = self
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if udl {
|
|
59
|
+
appsflyer.deepLinkDelegate = self
|
|
60
|
+
}
|
|
220
61
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
AppsFlyerLib.shared().customData = data
|
|
227
|
-
|
|
62
|
+
reportBridgeReady()
|
|
63
|
+
|
|
64
|
+
#if !AFSDK_NO_IDFA
|
|
65
|
+
if attInterval != nil {
|
|
66
|
+
appsflyer.waitForATTUserAuthorization(timeoutInterval: Double(attInterval!))
|
|
228
67
|
}
|
|
68
|
+
#endif
|
|
229
69
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
70
|
+
NotificationCenter.default.addObserver(self, selector: #selector(sendLaunch), name: UIApplication.didBecomeActiveNotification, object: nil)
|
|
71
|
+
|
|
72
|
+
appsflyer.start(completionHandler: { (dictionnary, error) in
|
|
73
|
+
if (error != nil){
|
|
74
|
+
call.reject(error!.localizedDescription)
|
|
75
|
+
return
|
|
76
|
+
} else {
|
|
77
|
+
call.resolve(["res":"ok"])
|
|
78
|
+
return
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@objc func logEvent(_ call: CAPPluginCall){
|
|
84
|
+
guard let eventName = call.getString(AppsFlyerConstants.AF_EVENT_NAME) else{
|
|
85
|
+
call.reject("missing event name")
|
|
86
|
+
return
|
|
87
|
+
}
|
|
88
|
+
let eventValue = call.getObject(AppsFlyerConstants.AF_EVENT_VALUE)
|
|
89
|
+
|
|
90
|
+
AppsFlyerLib.shared().logEvent(name: eventName, values: eventValue) { (response: [String : Any]?, error: Error?) in
|
|
91
|
+
if let response = response {
|
|
92
|
+
call.resolve(["res":response])
|
|
93
|
+
}
|
|
94
|
+
if let error = error {
|
|
95
|
+
call.reject(error.localizedDescription, nil, error)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@objc func setCustomerUserId(_ call: CAPPluginCall){
|
|
101
|
+
guard let cuid = call.getString(AppsFlyerConstants.AF_CUID) else {
|
|
102
|
+
call.reject("Invalid Customer User ID")
|
|
103
|
+
return
|
|
104
|
+
}
|
|
105
|
+
AppsFlyerLib.shared().customerUserID = cuid
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@objc func setCurrencyCode(_ call: CAPPluginCall){
|
|
110
|
+
guard let code = call.getString(AppsFlyerConstants.AF_CURRENCY_CODE) else {
|
|
111
|
+
call.reject("Invalid Currency Code")
|
|
112
|
+
return
|
|
235
113
|
}
|
|
114
|
+
AppsFlyerLib.shared().currencyCode = code
|
|
236
115
|
|
|
237
|
-
@objc func anonymizeUser(_ call: CAPPluginCall){
|
|
238
|
-
guard let anonymize = call.getBool(AppsFlyerConstants.AF_ANONYMIZE_USER) else{
|
|
239
|
-
call.reject("Missing boolean value anonymizeUser")
|
|
240
|
-
return
|
|
241
|
-
}
|
|
242
|
-
AppsFlyerLib.shared().anonymizeUser = anonymize
|
|
243
|
-
|
|
244
|
-
}
|
|
245
116
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@objc func updateServerUninstallToken(_ call: CAPPluginCall){
|
|
120
|
+
guard let token = call.getString(AppsFlyerConstants.AF_TOKEN) else {
|
|
121
|
+
call.reject("Invalid device token")
|
|
122
|
+
|
|
123
|
+
return
|
|
252
124
|
}
|
|
253
125
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
return
|
|
258
|
-
}
|
|
259
|
-
AppsFlyerLib.shared().disableSKAdNetwork = disable
|
|
260
|
-
|
|
126
|
+
guard let deviceTokenData = token.hexadecimalToData else{
|
|
127
|
+
call.reject("Invalid device token")
|
|
128
|
+
return
|
|
261
129
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
AppsFlyerLib.shared().disableAdvertisingIdentifier = disable
|
|
270
|
-
|
|
130
|
+
AppsFlyerLib.shared().registerUninstall(deviceTokenData)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@objc func setAppInviteOneLink(_ call: CAPPluginCall){
|
|
134
|
+
guard let id = call.getString(AppsFlyerConstants.AF_ONELINK_ID) else {
|
|
135
|
+
call.reject("Onelink id is missing")
|
|
136
|
+
return
|
|
271
137
|
}
|
|
272
|
-
|
|
138
|
+
AppsFlyerLib.shared().appInviteOneLinkID = id
|
|
273
139
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
@objc func setHost(_ call: CAPPluginCall){
|
|
283
|
-
let pre = call.getString(AppsFlyerConstants.AF_HOST_PREFIX)
|
|
284
|
-
let post = call.getString(AppsFlyerConstants.AF_HOST_POSTFIX)
|
|
285
|
-
if (pre != nil && post != nil) {
|
|
286
|
-
AppsFlyerLib.shared().setHost(post!, withHostPrefix: pre!)
|
|
287
|
-
} else {
|
|
288
|
-
call.reject("Missing host prefix and/or host name")
|
|
289
|
-
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@objc func setOneLinkCustomDomain(_ call: CAPPluginCall){
|
|
143
|
+
guard let arr = call.getArray(AppsFlyerConstants.AF_ONELINK_DOMAIN) else {
|
|
144
|
+
call.reject("Domains are missing")
|
|
145
|
+
return
|
|
290
146
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
147
|
+
var domains :[String] = []
|
|
148
|
+
for dom in arr {
|
|
149
|
+
domains.append(dom as! String)
|
|
150
|
+
}
|
|
151
|
+
AppsFlyerLib.shared().oneLinkCustomDomains = domains
|
|
152
|
+
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
@objc func appendParametersToDeepLinkingURL(_ call: CAPPluginCall){
|
|
156
|
+
guard let contains = call.getString(AppsFlyerConstants.AF_CONTAINS) else {
|
|
157
|
+
return
|
|
158
|
+
}
|
|
159
|
+
guard let parameters = call.getObject(AppsFlyerConstants.AF_PARAMETERS) else {
|
|
160
|
+
return
|
|
161
|
+
}
|
|
162
|
+
var params: [String:String] = [:]
|
|
163
|
+
for (k,v) in parameters{
|
|
164
|
+
params[k] = (v as! String)
|
|
165
|
+
}
|
|
166
|
+
AppsFlyerLib.shared().appendParametersToDeeplinkURL(contains: contains, parameters:params )
|
|
167
|
+
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
@objc func setResolveDeepLinkURLs(_ call: CAPPluginCall){
|
|
172
|
+
guard let arr = call.getArray(AppsFlyerConstants.AF_DEEPLINK_URLS) else {
|
|
173
|
+
call.reject("URLs are missing")
|
|
174
|
+
return
|
|
175
|
+
}
|
|
176
|
+
var urls :[String] = []
|
|
177
|
+
for url in arr {
|
|
178
|
+
urls.append(url as! String)
|
|
179
|
+
}
|
|
180
|
+
AppsFlyerLib.shared().oneLinkCustomDomains = urls
|
|
181
|
+
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
@objc func addPushNotificationDeepLinkPath(_ call: CAPPluginCall){
|
|
185
|
+
guard let arr = call.getArray(AppsFlyerConstants.AF_PATH) else {
|
|
186
|
+
call.reject("Path is missing")
|
|
187
|
+
return
|
|
188
|
+
}
|
|
189
|
+
var path :[String] = []
|
|
190
|
+
for p in arr {
|
|
191
|
+
path.append(p as! String)
|
|
192
|
+
}
|
|
193
|
+
AppsFlyerLib.shared().addPushNotificationDeepLinkPath(path)
|
|
194
|
+
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
@available(*, deprecated, message: "Use setSharingFilterForPartners")
|
|
198
|
+
@objc func setSharingFilter(_ call: CAPPluginCall){
|
|
199
|
+
let filters = call.getArray(AppsFlyerConstants.AF_FILTERS , String.self)
|
|
200
|
+
|
|
201
|
+
AppsFlyerLib.shared().sharingFilter = filters
|
|
202
|
+
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
@available(*, deprecated, message: "Use setSharingFilterForPartners")
|
|
206
|
+
@objc func setSharingFilterForAllPartners(_ call: CAPPluginCall){
|
|
207
|
+
|
|
208
|
+
AppsFlyerLib.shared().setSharingFilterForAllPartners()
|
|
209
|
+
|
|
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
|
+
|
|
221
|
+
@objc func setAdditionalData(_ call: CAPPluginCall){
|
|
222
|
+
guard let data = call.getObject(AppsFlyerConstants.AF_ADDITIONAL_DATA) else {
|
|
223
|
+
call.reject("Data is missing")
|
|
224
|
+
return
|
|
225
|
+
}
|
|
226
|
+
AppsFlyerLib.shared().customData = data
|
|
227
|
+
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
@objc func getAppsFlyerUID(_ call: CAPPluginCall){
|
|
232
|
+
let uid = AppsFlyerLib.shared().getAppsFlyerUID()
|
|
233
|
+
call.resolve(["uid":uid])
|
|
234
|
+
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
@objc func anonymizeUser(_ call: CAPPluginCall){
|
|
238
|
+
guard let anonymize = call.getBool(AppsFlyerConstants.AF_ANONYMIZE_USER) else{
|
|
239
|
+
call.reject("Missing boolean value anonymizeUser")
|
|
240
|
+
return
|
|
241
|
+
}
|
|
242
|
+
AppsFlyerLib.shared().anonymizeUser = anonymize
|
|
243
|
+
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
@objc func stop(_ call: CAPPluginCall){
|
|
247
|
+
let stop = call.getBool(AppsFlyerConstants.AF_STOP)
|
|
248
|
+
if stop != nil {
|
|
249
|
+
AppsFlyerLib.shared().isStopped = stop!
|
|
250
|
+
}
|
|
251
|
+
call.resolve([AppsFlyerConstants.AF_IS_STOP : AppsFlyerLib.shared().isStopped ])
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
@objc func disableSKAdNetwork(_ call: CAPPluginCall){
|
|
255
|
+
guard let disable = call.getBool(AppsFlyerConstants.AF_DISABLE_SKAD) else {
|
|
256
|
+
call.reject("Missing boolean value shouldDisable")
|
|
257
|
+
return
|
|
258
|
+
}
|
|
259
|
+
AppsFlyerLib.shared().disableSKAdNetwork = disable
|
|
260
|
+
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
#if !AFSDK_NO_IDFA
|
|
264
|
+
@objc func disableAdvertisingIdentifier(_ call: CAPPluginCall){
|
|
265
|
+
guard let disable = call.getBool(AppsFlyerConstants.AF_DISABLE_SKAD) else {
|
|
266
|
+
call.reject("Missing boolean value shouldDisable")
|
|
267
|
+
return
|
|
268
|
+
}
|
|
269
|
+
AppsFlyerLib.shared().disableAdvertisingIdentifier = disable
|
|
270
|
+
|
|
271
|
+
}
|
|
272
|
+
#endif
|
|
273
|
+
|
|
274
|
+
@objc func disableCollectASA(_ call: CAPPluginCall){
|
|
275
|
+
guard let disable = call.getBool(AppsFlyerConstants.AF_DISABLE_SKAD) else {
|
|
276
|
+
call.reject("Missing boolean value shouldDisable")
|
|
277
|
+
return
|
|
278
|
+
}
|
|
279
|
+
AppsFlyerLib.shared().disableCollectASA = disable
|
|
280
|
+
|
|
281
|
+
}
|
|
282
|
+
@objc func setHost(_ call: CAPPluginCall){
|
|
283
|
+
let pre = call.getString(AppsFlyerConstants.AF_HOST_PREFIX)
|
|
284
|
+
let post = call.getString(AppsFlyerConstants.AF_HOST_POSTFIX)
|
|
285
|
+
if (pre != nil && post != nil) {
|
|
286
|
+
AppsFlyerLib.shared().setHost(post!, withHostPrefix: pre!)
|
|
287
|
+
} else {
|
|
288
|
+
call.reject("Missing host prefix and/or host name")
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
@objc func generateInviteLink(_ call: CAPPluginCall){
|
|
293
|
+
AppsFlyerShareInviteHelper.generateInviteUrl(linkGenerator:
|
|
294
|
+
{(_ generator: AppsFlyerLinkGenerator) -> AppsFlyerLinkGenerator in
|
|
295
|
+
if let channel = call.getString(AppsFlyerConstants.AF_CHANNEL){
|
|
296
|
+
generator.setChannel(channel)
|
|
297
|
+
}
|
|
298
|
+
if let brandDomain = call.getString(AppsFlyerConstants.AF_BRAND_DOMAIN){
|
|
299
|
+
generator.brandDomain = brandDomain
|
|
300
|
+
}
|
|
301
|
+
if let campaign = call.getString(AppsFlyerConstants.AF_CAMPAIGN){
|
|
302
|
+
generator.setCampaign(campaign)
|
|
303
|
+
}
|
|
304
|
+
if let referrerName = call.getString(AppsFlyerConstants.AF_REFERRER_NAME){
|
|
305
|
+
generator.setReferrerName(referrerName)
|
|
306
|
+
}
|
|
307
|
+
if let referrerImageURL = call.getString(AppsFlyerConstants.AF_REFERRER_IMAGE_URL){
|
|
308
|
+
generator.setReferrerImageURL(referrerImageURL)
|
|
309
|
+
}
|
|
310
|
+
if let referrerCustomerId = call.getString(AppsFlyerConstants.AF_REFERRER_CUSTOMER_ID){
|
|
311
|
+
generator.setReferrerCustomerId(referrerCustomerId)
|
|
312
|
+
}
|
|
313
|
+
if let baseDeeplink = call.getString(AppsFlyerConstants.AF_BASE_DEEPLINK){
|
|
314
|
+
generator.setBaseDeeplink(baseDeeplink)
|
|
315
|
+
}
|
|
316
|
+
if let addParameters = call.getObject(AppsFlyerConstants.AF_ADD_PARAMETERS){
|
|
317
|
+
generator.addParameters(addParameters)
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return generator },completionHandler: {url in
|
|
321
|
+
if url != nil{
|
|
322
|
+
call.resolve([AppsFlyerConstants.AF_LINK_READY: url!.absoluteString])
|
|
361
323
|
}else{
|
|
362
|
-
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
324
|
+
call.reject("Failed to generate a link")
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
)
|
|
328
|
+
|
|
329
|
+
}
|
|
330
|
+
@objc func validateAndLogInAppPurchaseAndroid(_ call: CAPPluginCall){
|
|
331
|
+
call.unavailable()
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
@objc func validateAndLogInAppPurchaseIos(_ call: CAPPluginCall){
|
|
335
|
+
let currency = call.getString(AppsFlyerConstants.AF_CURRENCY)
|
|
336
|
+
let price = call.getString(AppsFlyerConstants.AF_PRICE)
|
|
337
|
+
let _inAppPurchase = call.getString(AppsFlyerConstants.AF_IN_APP_PURCHASE)
|
|
338
|
+
let transactionId = call.getString(AppsFlyerConstants.AF_TRANSACTION_ID)
|
|
339
|
+
let additionalParameters = call.getObject(AppsFlyerConstants.AF_ADDITIONAL_PARAMETERS) ?? [:]
|
|
340
|
+
|
|
341
|
+
if currency != nil && price != nil && _inAppPurchase != nil && transactionId != nil && currency != nil {
|
|
342
|
+
AppsFlyerLib.shared().validateAndLog(
|
|
343
|
+
inAppPurchase: _inAppPurchase,
|
|
344
|
+
price: price,
|
|
345
|
+
currency: currency,
|
|
346
|
+
transactionId: transactionId,
|
|
347
|
+
additionalParameters: additionalParameters,
|
|
348
|
+
success: {result in
|
|
349
|
+
call.resolve(["res":result])
|
|
350
|
+
},
|
|
351
|
+
failure: { error, result in
|
|
352
|
+
guard let emptyInApp = result as? [String:Any]
|
|
353
|
+
else
|
|
354
|
+
{
|
|
355
|
+
call.reject((error)?.localizedDescription ?? "error" )
|
|
356
|
+
return
|
|
357
|
+
}
|
|
358
|
+
call.reject((error)?.localizedDescription ?? "error" , emptyInApp.jsonStringRepresentation)
|
|
359
|
+
|
|
360
|
+
})
|
|
361
|
+
}else{
|
|
362
|
+
call.reject("Missing some fields")
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
@objc func getSdkVersion(_ call: CAPPluginCall){
|
|
369
|
+
|
|
370
|
+
call.resolve(["res": AppsFlyerLib.shared().getSDKVersion()])
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
@objc func enableFacebookDeferredApplinks(_ call: CAPPluginCall){
|
|
374
|
+
guard let enable = call.getBool(AppsFlyerConstants.AF_FB) else {
|
|
375
|
+
call.reject("missing boolean value: \(AppsFlyerConstants.AF_FB)")
|
|
376
|
+
return
|
|
377
|
+
}
|
|
378
|
+
if enable{
|
|
379
|
+
#if canImport(FacebookCore)
|
|
380
|
+
AppsFlyerLib.shared().enableFacebookDeferredApplinks(with: FBSDKAppLinkUtility.self)
|
|
381
|
+
call.resolve(["res": "enabled"])
|
|
382
|
+
#else
|
|
383
|
+
call.reject("Please install FBSDK First!")
|
|
384
|
+
#endif
|
|
385
|
+
}else{
|
|
386
|
+
AppsFlyerLib.shared().enableFacebookDeferredApplinks(with: nil)
|
|
387
|
+
call.resolve(["res": "disabled"])
|
|
388
|
+
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
@objc func sendPushNotificationData(_ call: CAPPluginCall){
|
|
394
|
+
let json = call.getObject(AppsFlyerConstants.AF_PUSH_PAYLOAD)
|
|
395
|
+
AppsFlyerLib.shared().handlePushNotification(json)
|
|
396
|
+
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
@objc func setCurrentDeviceLanguage(_ call: CAPPluginCall){
|
|
401
|
+
guard let language = call.getString(AppsFlyerConstants.AF_LANGUAGE) else {
|
|
402
|
+
call.reject("cannot extract the language value")
|
|
403
|
+
return
|
|
404
|
+
}
|
|
405
|
+
AppsFlyerLib.shared().currentDeviceLanguage = language
|
|
406
|
+
call.resolve(["res": "ok"])
|
|
407
|
+
|
|
408
|
+
}
|
|
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
|
+
}
|
|
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
|
+
}
|
|
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
|
|
498
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
|
+
}
|
|
499
499
|
}
|
|
500
500
|
|
|
501
501
|
extension AppsFlyerPlugin{
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
502
|
+
private func reportBridgeReady(){
|
|
503
|
+
AppsFlyerAttribution.shared.bridgReady = true
|
|
504
|
+
NotificationCenter.default.post(name: Notification.Name.appsflyerBridge, object: nil)
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
@objc private func sendLaunch(){
|
|
508
|
+
AppsFlyerLib.shared().start()
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
@objc func handleUrlOpened(notification: NSNotification) {
|
|
512
|
+
guard let object = notification.object as? [String: Any?] else {
|
|
513
|
+
return
|
|
514
|
+
}
|
|
515
|
+
guard let url = object["url"] else {
|
|
516
|
+
afLogger(msg: "handleUrlOpened url is nil")
|
|
517
|
+
return
|
|
518
|
+
}
|
|
519
|
+
guard let options = object["options"] else {
|
|
520
|
+
afLogger(msg: "handleUrlOpened options is nil")
|
|
521
|
+
|
|
522
|
+
return
|
|
523
|
+
}
|
|
524
|
+
afLogger(msg: "handleUrlOpened with \((url as! URL).absoluteString)")
|
|
525
|
+
AppsFlyerAttribution.shared.handleOpenUrl(open: url as! URL, options: options as! [UIApplication.OpenURLOptionsKey: Any])
|
|
526
|
+
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
@objc func handleUniversalLink(notification: NSNotification) {
|
|
530
|
+
guard let object = notification.object as? [String: Any?] else {
|
|
531
|
+
return
|
|
532
|
+
}
|
|
533
|
+
let user = NSUserActivity(activityType: NSUserActivityTypeBrowsingWeb)
|
|
534
|
+
guard let url = object["url"] else {
|
|
535
|
+
afLogger(msg: "handleUrlOpened options is url")
|
|
536
|
+
return
|
|
537
|
+
}
|
|
538
|
+
user.webpageURL = (url as! URL)
|
|
539
|
+
afLogger(msg: "handleUniversalLink with \(user.webpageURL?.absoluteString ?? "null")")
|
|
540
|
+
AppsFlyerAttribution.shared.continueUserActivity(userActivity: user)
|
|
541
|
+
|
|
542
|
+
}
|
|
543
|
+
|
|
544
544
|
}
|
|
545
545
|
|
|
546
546
|
extension AppsFlyerPlugin : AppsFlyerLibDelegate {
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
547
|
+
public func onConversionDataSuccess(_ conversionInfo: [AnyHashable : Any]) {
|
|
548
|
+
let json : [String: Any] = ["callbackName":"onConversionDataSuccess", "data":conversionInfo]
|
|
549
|
+
self.notifyListeners(AppsFlyerConstants.CONVERSION_CALLBACK, data: json)
|
|
550
|
+
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
public func onConversionDataFail(_ error: Error) {
|
|
554
|
+
let json : [String: Any] = ["callbackName":"onConversionDataFail", "status":error.localizedDescription]
|
|
555
|
+
self.notifyListeners(AppsFlyerConstants.CONVERSION_CALLBACK, data: json)
|
|
556
|
+
}
|
|
557
|
+
public func onAppOpenAttribution(_ attributionData: [AnyHashable : Any]) {
|
|
558
|
+
let json : [String: Any] = ["callbackName":"onAppOpenAttribution", "data":attributionData]
|
|
559
|
+
self.notifyListeners(AppsFlyerConstants.OAOA_CALLBACK, data: json)
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
public func onAppOpenAttributionFailure(_ error: Error) {
|
|
563
|
+
let json : [String: Any] = ["callbackName":"onAppOpenAttributionFailure", "status":error.localizedDescription]
|
|
564
|
+
self.notifyListeners(AppsFlyerConstants.OAOA_CALLBACK, data: json)
|
|
565
|
+
|
|
566
|
+
}
|
|
567
|
+
|
|
568
568
|
}
|
|
569
569
|
|
|
570
570
|
|
|
571
571
|
// Mark -
|
|
572
572
|
extension AppsFlyerPlugin : DeepLinkDelegate{
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
if result.error != nil {
|
|
586
|
-
json["error"] = result.error!.localizedDescription
|
|
587
|
-
}
|
|
588
|
-
if result.deepLink != nil {
|
|
589
|
-
json["deepLink"] = result.deepLink!.clickEvent
|
|
590
|
-
|
|
591
|
-
}
|
|
592
|
-
self.notifyListeners(AppsFlyerConstants.UDL_CALLBACK, data: json)
|
|
573
|
+
public func didResolveDeepLink(_ result: DeepLinkResult) {
|
|
574
|
+
var json : [String: Any] = [:]
|
|
575
|
+
|
|
576
|
+
switch result.status {
|
|
577
|
+
case .notFound :
|
|
578
|
+
json["status"] = "NOT_FOUND"
|
|
579
|
+
case .failure :
|
|
580
|
+
json["status"] = "FAILURE"
|
|
581
|
+
case .found :
|
|
582
|
+
json["status"] = "FOUND"
|
|
593
583
|
}
|
|
594
584
|
|
|
585
|
+
if result.error != nil {
|
|
586
|
+
json["error"] = result.error!.localizedDescription
|
|
587
|
+
}
|
|
588
|
+
if result.deepLink != nil {
|
|
589
|
+
var deepLinkDic = result.deepLink!.clickEvent
|
|
590
|
+
deepLinkDic["is_deferred"] = result.deepLink!.isDeferred
|
|
591
|
+
json["deepLink"] = deepLinkDic
|
|
592
|
+
}
|
|
593
|
+
self.notifyListeners(AppsFlyerConstants.UDL_CALLBACK, data: json)
|
|
594
|
+
}
|
|
595
|
+
|
|
595
596
|
}
|
|
596
597
|
|
|
597
598
|
extension AppsFlyerPlugin{
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
599
|
+
private func afLogger(msg : String){
|
|
600
|
+
NSLog ("AppsFlyer [Debug][Capacitor]: \(msg)");
|
|
601
|
+
}
|
|
601
602
|
}
|
|
602
603
|
|
|
603
604
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appsflyer-capacitor-plugin",
|
|
3
|
-
"version"
|
|
4
|
-
"iosSdkVersion": "6.
|
|
3
|
+
"version": "6.5.2",
|
|
4
|
+
"iosSdkVersion": "6.5.2",
|
|
5
5
|
"description": "AppsFlyer SDK plugin for Capacitor",
|
|
6
6
|
"main": "dist/plugin.cjs.js",
|
|
7
7
|
"module": "dist/esm/index.js",
|