setContextProvider

Registers the context provider for a usage.

Pass the constant the feature exposes; apps don't declare usages. The subject type on Usage binds the provider's parameter type, so a mismatched provider is a compile error.

A provider registered here replaces setDefaultContextProvider for this usage rather than adding to it — the two are never combined. Merge the general context in yourself if you want both.

// `usage` is the constant the feature module exposes, e.g. for message suppression.
Airship.ai.setContextProvider(usage) { message ->
EvaluationContext(listOf(EvaluationContext.Item("Last booked: ${store.lastBooking}")))
}

Parameters

usage

The usage to provide context for.

provider

The provider, or null to clear it.