Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ object UserManager {
* @param userId
*/
fun set(userId: String) {
UpdateQueue.current.setUserId(userId)
UpdateQueue.setUserId(userId)
}

/**
Expand All @@ -58,7 +58,7 @@ object UserManager {
* @param key
*/
fun addAttribute(attribute: String, key: String) {
UpdateQueue.current.addAttribute(key, attribute)
UpdateQueue.addAttribute(key, attribute)
}

/**
Expand All @@ -67,7 +67,7 @@ object UserManager {
* @param attributes
*/
fun setAttributes(attributes: Map<String, String>) {
UpdateQueue.current.setAttributes(attributes)
UpdateQueue.setAttributes(attributes)
}

/**
Expand All @@ -76,7 +76,7 @@ object UserManager {
* @param language
*/
fun setLanguage(language: String) {
UpdateQueue.current.setLanguage(language)
UpdateQueue.setLanguage(language)
}

/**
Expand Down Expand Up @@ -143,7 +143,7 @@ object UserManager {
Formbricks.language = languageFromUserResponse
}

UpdateQueue.current.reset()
UpdateQueue.reset()
SurveyManager.filterSurveys()
startSyncTimer()
} catch (e: Exception) {
Expand Down Expand Up @@ -183,7 +183,7 @@ object UserManager {
backingLastDisplayedAt = null
backingExpiresAt = null
Formbricks.language = "default"
UpdateQueue.current.reset()
UpdateQueue.reset()

if(isUserIdDefined) {
Logger.d("User logged out successfully!")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import kotlin.concurrent.timer
* The given properties will be sent to the backend and updated in
* the user object when the debounce interval is reached.
*/
class UpdateQueue private constructor() {
object UpdateQueue {
private const val DEBOUNCE_INTERVAL: Long = 500 // 500 ms

private var userId: String? = null
private var attributes: MutableMap<String, String>? = null
Expand Down Expand Up @@ -74,9 +75,4 @@ class UpdateQueue private constructor() {
Logger.d("UpdateQueue - commit() called on UpdateQueue with $effectiveUserId and $attributes")
UserManager.syncUser(effectiveUserId, attributes)
}

companion object {
private const val DEBOUNCE_INTERVAL: Long = 500 // 500 ms
val current: UpdateQueue = UpdateQueue()
}
}
Loading