File tree Expand file tree Collapse file tree 2 files changed +7
-12
lines changed
Sources/Amplitude/Plugins Expand file tree Collapse file tree 2 files changed +7
-12
lines changed Original file line number Diff line number Diff line change 66//
77
88public class AmplitudeDestinationPlugin : DestinationPlugin {
9+ public let timeline = Timeline ( )
910 public var amplitude : Amplitude ? = nil
1011 public let type : PluginType = . destination
1112 private var pipeline : EventPipeline ?
Original file line number Diff line number Diff line change 66//
77
88public protocol DestinationPlugin : EventPlugin {
9-
9+ var timeline : Timeline { get }
1010}
1111
12- private var _timeline : Timeline ? = nil
1312extension DestinationPlugin {
14- var timeline : Timeline ? {
15- if _timeline == nil {
16- _timeline = Timeline ( )
17- }
18- return _timeline
19- }
13+
2014 var enabled : Bool {
2115 return true
2216 }
@@ -28,21 +22,21 @@ extension DestinationPlugin {
2822 @discardableResult
2923 func add( plugin: Plugin ) -> Plugin {
3024 plugin. amplitude = self . amplitude
31- timeline? . add ( plugin: plugin)
25+ timeline. add ( plugin: plugin)
3226 return plugin
3327 }
3428
3529 func remove( plugin: Plugin ) {
36- timeline? . remove ( plugin: plugin)
30+ timeline. remove ( plugin: plugin)
3731 }
3832
3933 func process( event: BaseEvent ? ) -> BaseEvent ? {
4034 // Skip this destination if it is disabled via settings
4135 if !enabled {
4236 return nil
4337 }
44- let beforeResult = timeline? . applyPlugin ( pluginType: . before, event: event)
45- let enrichmentResult = timeline? . applyPlugin ( pluginType: . enrichment, event: beforeResult)
38+ let beforeResult = timeline. applyPlugin ( pluginType: . before, event: event)
39+ let enrichmentResult = timeline. applyPlugin ( pluginType: . enrichment, event: beforeResult)
4640 var destinationResult : BaseEvent ? = nil
4741 switch enrichmentResult {
4842 case let e as IdentifyEvent :
You can’t perform that action at this time.
0 commit comments