@@ -176,7 +176,7 @@ Method signature:
176
176
177
177
Example Usage:
178
178
``` swift
179
- analytics.add (plugin : UIKitScreenTracking (name : " ScreenTracking" , analytics : analytics ))
179
+ analytics.add (plugin : UIKitScreenTracking (name : " ScreenTracking" ))
180
180
```
181
181
182
182
### find
@@ -235,9 +235,8 @@ class SomePlugin: Plugin {
235
235
let name: String
236
236
let analytics: Analytics
237
237
238
- init (name : String , analytics : Analytics ) {
238
+ init (name : String ) {
239
239
self .name = name
240
- self .analytics = analytics
241
240
}
242
241
243
242
override fun execute (event : BaseEvent): BaseEvent? {
@@ -260,9 +259,8 @@ class SomePlugin: EventPlugin {
260
259
let name: String
261
260
let analytics: Analytics
262
261
263
- init (name : String , analytics : Analytics ) {
262
+ init (name : String ) {
264
263
self .name = name
265
- self .analytics = analytics
266
264
}
267
265
268
266
func identify (event : IdentifyEvent) -> IdentifyEvent? {
@@ -280,34 +278,47 @@ class SomePlugin: EventPlugin {
280
278
- ` DestinationPlugin `
281
279
A plugin interface most commonly used for device-mode destinations. This plugin contains an internal timeline that follows the same process as the analytics timeline,
282
280
allowing you to modify/augment how events reach the particular destination.
283
- For example if you wanted to implement a device mode destination plugin for Amplitude
281
+ For example if you wanted to implement a device mode destination plugin for AppsFlyer
284
282
``` swift
285
- class AmplitudePlugin : DestinationPlugin {
286
- let type: PluginType = .destination
287
- let name: String
288
- let analytics: Analytics
289
- let timeline: Timeline
290
- let amplitudeSDK: Amplitude
291
-
292
- init (name : String , analytics : Analytics) {
293
- self .name = name
294
- self .analytics = analytics
295
- self .timeline = Timeline ()
296
-
297
- amplitudeSDK = Amplitude.instance ()
298
- amplitudeSDK.initializeApiKey (" API_KEY" )
299
- }
300
-
301
- func track (event : TrackEvent) -> TrackEvent? {
302
- amplitudeSDK.logEvent (event.name )
303
- return event
304
- }
283
+ internal struct AppsFlyerSettings : Codable {
284
+ let appsFlyerDevKey: String
285
+ let appleAppID: String
286
+ let trackAttributionData: Bool ?
305
287
}
306
288
289
+ @objc
290
+ class AppsFlyerDestination : UIResponder , DestinationPlugin , UserActivities , RemoteNotifications {
291
+
292
+ let timeline: Timeline = Timeline ()
293
+ let type: PluginType = .destination
294
+ let name: String
295
+ var analytics: Analytics?
296
+
297
+ internal var settings: AppsFlyerSettings? = nil
298
+
299
+ required init (name : String ) {
300
+ self .name = name
301
+ analytics? .track (name : " AppsFlyer Loaded" )
302
+ }
303
+
304
+ public func update (settings : Settings) {
305
+
306
+ guard let settings: AppsFlyerSettings = settings.integrationSettings (name : " AppsFlyer" ) else {return }
307
+ self .settings = settings
308
+
309
+
310
+ AppsFlyerLib.shared ().appsFlyerDevKey = settings.appsFlyerDevKey
311
+ AppsFlyerLib.shared ().appleAppID = settings.appleAppID
312
+ AppsFlyerLib.shared ().isDebug = true
313
+ AppsFlyerLib.shared ().deepLinkDelegate = self
314
+
315
+ // additional update logic
316
+ }
317
+
307
318
// ...
308
319
309
- analytics.add (plugin : AmplitudePlugin (name : " Amplitude " , analytics : analytics ))
310
- analytics.track (" Amplitude Event" )
320
+ analytics.add (plugin : AppsFlyerPlugin (name : " AppsFlyer " ))
321
+ analytics.track (" AppsFlyer Event" )
311
322
```
312
323
313
324
### Advanced concepts
0 commit comments