
com.amplitude.core.State.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of analytics-core Show documentation
Show all versions of analytics-core Show documentation
Amplitude Kotlin Core library
The newest version!
package com.amplitude.core
import com.amplitude.core.platform.ObservePlugin
class State {
var userId: String? = null
set(value: String?) {
field = value
plugins.forEach { plugin ->
plugin.onUserIdChanged(value)
}
}
var deviceId: String? = null
set(value: String?) {
field = value
plugins.forEach { plugin ->
plugin.onDeviceIdChanged(value)
}
}
val plugins: MutableList = mutableListOf()
fun add(plugin: ObservePlugin, amplitude: Amplitude) = synchronized(plugins) {
plugin.setup(amplitude)
plugins.add(plugin)
}
fun remove(plugin: ObservePlugin) = synchronized(plugins) {
plugins.removeAll { it === plugin }
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy