Skip to content

Commit 088fdd4

Browse files
committed
Closing client before initializing a new one.
1 parent b3ea531 commit 088fdd4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ios/Classes/SwiftOptimizelyFlutterSdkPlugin.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ public class SwiftOptimizelyFlutterSdkPlugin: NSObject, FlutterPlugin {
9090
}
9191

9292
// Delete old user context
93-
userContextsTracker[sdkKey] = nil
9493
userContextsTracker.removeValue(forKey: sdkKey)
94+
// Close and remove old client
95+
getOptimizelyClient(arguments: call.arguments)?.close()
96+
optimizelyClientsTracker.removeValue(forKey: sdkKey)
9597

9698
// Creating new instance
9799
let optimizelyInstance = OptimizelyClient(sdkKey:sdkKey, eventDispatcher: eventDispatcher, periodicDownloadInterval: periodicDownloadInterval)

0 commit comments

Comments
 (0)