Migration to 4.X

Overview

This guide will assist developers to move from Flagship 3.X to Flagship 4.X.

The main breaking changes are:

  • Général implementation
  • SDK Status
  • Visitor consent
  • Get Flag value

See the full change log on Github.


Changes


SDK Status

Flagship SDK statuses have been renamed or changed:

4.X3.XDescription
NOT_INITIALIZEDNOT__INITIALIZEDFlagship SDK has not been started or initialized successfully.
INITIALIZINGSTARTINGFlagship SDK is initializing.
INITIALIZINGPOLLINGFlagship SDK has been started successfully but is still polling campaigns.
PANICPANICFlagship SDK is ready but is running in Panic mode: All features are disabled except the one which refresh this status.
INITIALIZEDREADYFlagship SDK is ready to use.

Flagship status listener have been renamed accordingly:


val config = FlagshipConfig.Bucketing()
	.withFlagshipStatusListener { flagshipStatus ->
    //use status
  })
val config = FlagshipConfig.Bucketing()
	.withFlagshipStatusListener { flagshipStatus ->
    //use status
  })

Visitor consent

The Flagship newVisitor method now takes consent as mandatory parameter.

Example:

 val visitor = Flagship.newVisitor("visitor_id", true).build()
 val visitor = Flagship.newVisitor("visitor_id").build()

Get flag value

In 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.


val flag = fsVisitor.getFlag("myFlagKey")
val flagValue = flag.value("myDefaultValue")
val flag = fsVisitor.getFlag("myFlagKey", "myDefaultValue")
val flagValue = flag.value()