@@ -60,14 +60,14 @@ public class Analytics {
6060 /// - Parameters:
6161 /// - configuration: The configuration to use
6262 public init ( configuration: Configuration ) {
63- /* if Self.isActiveWriteKey(configuration.values.writeKey) {
63+ if Self . isActiveWriteKey ( configuration. values. writeKey) {
6464 // If you're hitting this in testing, it could be a memory leak, or something async is still running
6565 // and holding a reference. You can use XCTest.waitUntilFinished(...) to wait for things to complete.
6666 fatalError ( " Cannot initialize multiple instances of Analytics with the same write key " )
6767 } else {
6868 Self . addActiveWriteKey ( configuration. values. writeKey)
69- }*/
70-
69+ }
70+
7171 store = Store ( )
7272 storage = Storage (
7373 store: self . store,
@@ -80,15 +80,15 @@ public class Analytics {
8080 // provide our default state
8181 store. provide ( state: System . defaultState ( configuration: configuration, from: storage) )
8282 store. provide ( state: UserInfo . defaultState ( from: storage, anonIdGenerator: configuration. values. anonymousIdGenerator) )
83-
83+
8484 storage. analytics = self
8585
8686 checkSharedInstance ( )
8787
8888 // Get everything running
8989 platformStartup ( )
9090
91- Telemetry . shared. increment ( metric: Telemetry . INVOKE_METRIC) { it in
91+ Telemetry . shared. increment ( metric: Telemetry . INVOKE_METRIC) { it in
9292 it [ " message " ] = " configured "
9393 it [ " apihost " ] = configuration. values. apiHost
9494 it [ " cdnhost " ] = configuration. values. cdnHost
@@ -97,7 +97,7 @@ public class Analytics {
9797 it [ " config " ] = " seg: \( configuration. values. autoAddSegmentDestination) ua: \( configuration. values. userAgent ?? " N/A " ) "
9898 }
9999 }
100-
100+
101101 deinit {
102102 Self . removeActiveWriteKey ( configuration. values. writeKey)
103103 }
@@ -117,9 +117,9 @@ public class Analytics {
117117 policy.reset()
118118 }
119119 }*/
120-
120+
121121 let flushPolicies = configuration. values. flushPolicies
122-
122+
123123 var shouldFlush = false
124124 // if any policy says to flush, make note of that
125125 for policy in flushPolicies {
@@ -178,12 +178,12 @@ extension Analytics {
178178 store. dispatch ( action: System . ToggleEnabledAction ( enabled: value) )
179179 }
180180 }
181-
181+
182182 /// Returns the writekey in use for this instance.
183183 public var writeKey : String {
184184 return configuration. values. writeKey
185185 }
186-
186+
187187 /// Returns the anonymousId currently in use.
188188 public var anonymousId : String {
189189 if let userInfo: UserInfo = store. currentState ( ) {
@@ -260,7 +260,7 @@ extension Analytics {
260260 public func flush( completion: ( ( ) -> Void ) ? = nil ) {
261261 // only flush if we're enabled.
262262 guard enabled == true else { completion ? ( ) ; return }
263-
263+
264264 let completionGroup = CompletionGroup ( queue: configuration. values. flushQueue)
265265 apply { plugin in
266266 completionGroup. add { group in
@@ -273,7 +273,7 @@ extension Analytics {
273273 }
274274 }
275275 }
276-
276+
277277 completionGroup. run ( mode: operatingMode) {
278278 completion ? ( )
279279 }
@@ -450,18 +450,18 @@ extension Analytics {
450450 internal var isDead : Bool {
451451 return configuration. values. writeKey == Self . deadInstance
452452 }
453-
453+
454454 /// Manage active writekeys. It's wrapped in @atomic
455455 internal static func isActiveWriteKey( _ writeKey: String ) -> Bool {
456456 Self . activeWriteKeys. contains ( writeKey)
457457 }
458-
458+
459459 internal static func addActiveWriteKey( _ writeKey: String ) {
460460 Self . _activeWriteKeys. mutate { keys in
461461 keys. append ( writeKey)
462462 }
463463 }
464-
464+
465465 internal static func removeActiveWriteKey( _ writeKey: String ) {
466466 Self . _activeWriteKeys. mutate { keys in
467467 keys. removeAll { key in
0 commit comments