Constructors

Link copied to clipboard
constructor(pointer: <Error class: unknown class>)
constructor(noPointer: NoPointer)

This constructor can be used to instantiate a fake object. Only used for tests. Any attempt to actually use an object constructed this way will fail as there is no connected Rust object.

constructor(appCtx: AppContext, recordedContext: RecordedContext?, coenrollingFeatureIds: List<String>, dbpath: String, remoteSettingsConfig: RemoteSettingsConfig?, metricsHandler: MetricsHandler)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun advanceEventTime(bySeconds: Long)

Advances what the event store thinks is now. This, and record_past_event are useful for testing. by_seconds must be positive.

Link copied to clipboard

Apply the updated experiments from the last fetch. After calling this, the list of active experiments might change (there might be new experiments, or old experiments might have expired).

Link copied to clipboard
open override fun clearEvents()
Link copied to clipboard
open override fun close()
Link copied to clipboard
open override fun createStringHelper(additionalContext: <Error class: unknown class>?): NimbusStringHelper

This provides a unified String interpolation library which exposes the application context. It's first use is in the messaging helper, to add extra parameters to URLs.

Link copied to clipboard
open override fun createTargetingHelper(additionalContext: <Error class: unknown class>?): NimbusTargetingHelper

This provides low level access to the targeting machinery for other uses by the application (e.g. messages) Additional parameters can be added via the optional JSON object. This allows for many JEXL expressions to be run across the same context.

Link copied to clipboard
open override fun destroy()
Link copied to clipboard
open override fun dumpStateToLog()
Link copied to clipboard
open override fun fetchExperiments()

Fetches the list of experiments from the server. This does not affect the list of active experiments or experiment enrolment. Fetched experiments are not applied until apply_pending_updates() is called.

Link copied to clipboard

Returns a list of experiments this user is enrolled in.

Link copied to clipboard

Returns a list of experiments for this app_name, as specified in the AppContext. It is not intended to be used to be used for user facing applications.

Link copied to clipboard
open override fun getExperimentBranch(id: String): String?

Returns the branch allocated for a given slug or id.

Link copied to clipboard
open override fun getExperimentBranches(experimentSlug: String): List<ExperimentBranch>

Returns a list of experiment branches for a given experiment ID.

Link copied to clipboard
open override fun getFeatureConfigVariables(featureId: String): String?
Link copied to clipboard
open override fun getGlobalUserParticipation(): Boolean

Getter and setter for user's participation in all experiments. Possible values are:

Link copied to clipboard
open override fun initialize()

Initializes the database and caches enough information so that the non-blocking API functions (eg, get_experiment_branch()) can return accurate results rather than throwing a "not initialized" error. It's not strictly necessary to call this function - any function that wants to use the database will implicitly initialize too - this exists so that the consuming application can have confidence the non-blocking functions will return data instead of returning an error, and will do the minimum amount of work to achieve that.

Link copied to clipboard
open override fun isFetchEnabled(): Boolean
Link copied to clipboard
open override fun optInWithBranch(experimentSlug: String, branch: String): List<EnrollmentChangeEvent>

Opt in to a specific branch on a specific experiment. Useful for developers to test their app's interaction with the experiment.

Link copied to clipboard
open override fun optOut(experimentSlug: String): List<EnrollmentChangeEvent>

Opt out of a specific experiment.

Link copied to clipboard
open override fun recordEvent(eventId: String, count: Long)

Records an event for the purposes of behavioral targeting. This function is used to record and persist data used for the behavioral targeting such as "core-active" user targeting.

Link copied to clipboard
open override fun recordFeatureExposure(featureId: String, slug: String?)

Records a Glean event that this feature has been exposed. If the feature is not involved in an experiment, then the event is suppressed. If the feature is only involved in a rollout, then the event is suppressed. If the feature is involved in an experiment, then record the experiment slug and branch. If the feature is involved in an experiment and a rollout, then record only the experiment slug and branch. If the slug is specified, then use this as the experiment, and use it to look up the branch. This is useful for coenrolling features.

Link copied to clipboard
open override fun recordMalformedFeatureConfig(featureId: String, partId: String)

Records a Glean event that this feature configuration is malformed. Accepts a part_id to give the experiment owner or feature implementer clues where to look. The Glean event will always fire, but the content of that event will vary depending on whether then feature is part of an experiment or rollout or not.

Link copied to clipboard
open override fun recordPastEvent(eventId: String, secondsAgo: Long, count: Long)

Records an event as if it were in the past. This, and advance_event_time are useful for testing. seconds_ago must be positive.

Link copied to clipboard
open override fun resetEnrollments()

These are test-only functions and should never be exposed to production users, as they mess with the "statistical requirements" of the SDK. Reset the enrollments and experiments in the database to an empty state.

Link copied to clipboard

Reset internal state in response to application-level telemetry reset.

Link copied to clipboard
open override fun setExperimentsLocally(experimentsJson: String)

A convenience method for apps to set the experiments from a local source for either testing, or before the first fetch has finished.

Link copied to clipboard
open override fun setFetchEnabled(flag: Boolean)

Toggles the enablement of the fetch. If false, then calling fetch_experiments returns immediately, having not done any fetching from remote settings. This is only useful for QA, and should not be used in production: use set_global_user_participation instead.

Link copied to clipboard
Link copied to clipboard
fun uniffiClonePointer(): <Error class: unknown class>