Migration to 4.X
Overview
This guide assists developers in migrating from Flagship 3.X to Flagship 4.X.
The primary changes include:
- Visitor Creation
- Flagship configuration
- Flagship SDK Status
For more details, see the change log
Visitor Creation
In version 4.X, the VisitorBuild api has been updated to be more descriptive.
Below is an example of how consent is used in versions 4.X and 3.X
var visitor = Fs.newVisitor("visitorId", true)
.SetIsAuthenticated(true)
.SetContext(new Dictionary<string, object>(){["isVip"] = true})
.build()
var visitor = Fs.newVisitor("visitorId", true)
.IsAuthenticated(true)
.WithContext(new Dictionary<string, object>(){["isVip"] = true})
.build()
Flagship configuration
In version 4.X, the StatusChangedCallback
setter of FlagshipConfig has been replaced with OnSdkStatusChanged
.
Flagship SDK Status
The FlagshipStatus
class has been superseded by FSSdkStatus
.
The table below matches the FlagshipStatus
enum keys from version 3.X to the corresponding FSSdkStatus
keys in version 4.X.
V4.X | V3.X |
---|---|
SDK_NOT_INITIALIZED | NOT_READY |
SDK_NOT_INITIALIZED | NOT_INITIALIZED |
SDK_INITIALIZING | STARTING |
SDK_INITIALIZING | POLLING |
SDK_PANIC | READY_PANIC_ON |
SDK_INITIALIZED | READY |
GetFlag
method update
GetFlag
method updateIn version 4.X, the approach to setting a flag's default value has been modified. The default value is no longer set using the getFlag method of visitor instance. Instead, it is now set using the getValue of flag instance.
Here's how you can retrieve the default value of a flag in versions 4.X and 3.X:
...
const flag = fsVisitor.GetFlag("myFlagKey");
const flagValue = flag.GetValue("default-value");
...
const flag = fsVisitor.GetFlag("myFlagKey", "default-value");
const flagValue = flag.GetValue();
Updated 3 months ago