Manage Properties and Settings¶
Reload a plan with new settings, apply or remove current settings, and track the plan loading status.
Overview¶
- The presenter (
IExpoFpPlanPresenter
) exposes properties and methods to control settings of the current plan. - You can:
- Inspect current settings (link, params, provider).
- Reload the plan with new or previous settings.
- Dynamically update additional parameters, location provider, or message listener.
- Observe loading and readiness state via
planStatusFlow
.
Step 1. Plan Properties¶
presenter.additionalParams // List<URLQueryItem>, applied to the plan
presenter.planLink // ExpoFpLinkType, source of the plan
presenter.locationProvider // IExpoFpLocationProvider?, current provider
presenter.planStatusFlow // Flow<ExpoFpPlanStatus>, plan lifecycle state
Step 2. Reload Plan¶
Reload the plan with new settings.
If a parameter is null
, the previous value will be reused.
presenter.reloadPlan(
planLink = ExpoFpLinkType.ExpoKey("YourExpoKey"), // or null
additionalParams = listOf(URLQueryItem("noOverlay", "true")), // or null
locationProvider = YourLocationProvider(), // or null
messageListener = YourListener() // or null
)
Important: If a plan is reloaded with a new
planLink
, the link info is also updated in the correspondingExpoFpPreloadedPlanInfo
(if the plan was preloaded).
Step 3. Change Current Settings¶
Additional parameters¶
presenter.additionalParams
// Example: listOf(URLQueryItem("noOverlay", "true"))
val newParams = listOf(URLQueryItem("noOverlay", "false"))
presenter.applyNewAdditionalParams(newParams)
presenter.removeAdditionalParams(listOf("noOverlay"))
Location provider¶
presenter.locationProvider // SomeLocationProvider or null
presenter.setLocationProvider(YourLocationProvider())
presenter.removeLocationProvider()
Message listener¶
presenter.setMessageListener(YourPlanMessageListener())
presenter.removeMessageListener()
Step 4. Monitor Plan Status¶
Observe planStatusFlow
to react to lifecycle changes.
lifecycleScope.launchWhenStarted {
presenter.planStatusFlow.collect { status ->
when (status) {
is ExpoFpPlanStatus.Initialization -> { /* starting */ }
is ExpoFpPlanStatus.Loading -> { /* status.percentage */ }
is ExpoFpPlanStatus.Ready -> { /* ready */ }
is ExpoFpPlanStatus.Error -> { /* status.error */ }
}
}
}