-
Notifications
You must be signed in to change notification settings - Fork 842
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PM-14596] Sync on database scheme change (#4257)
- Loading branch information
1 parent
40f33df
commit f86c100
Showing
9 changed files
with
126 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
app/src/main/java/com/x8bit/bitwarden/data/platform/manager/DatabaseSchemeManagerImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,34 @@ | ||
package com.x8bit.bitwarden.data.platform.manager | ||
|
||
import com.x8bit.bitwarden.data.platform.datasource.disk.SettingsDiskSource | ||
import com.x8bit.bitwarden.data.platform.manager.dispatcher.DispatcherManager | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.flow.SharingStarted | ||
import kotlinx.coroutines.flow.stateIn | ||
import java.time.Instant | ||
|
||
/** | ||
* Primary implementation of [DatabaseSchemeManager]. | ||
*/ | ||
class DatabaseSchemeManagerImpl( | ||
val settingsDiskSource: SettingsDiskSource, | ||
val dispatcherManager: DispatcherManager, | ||
) : DatabaseSchemeManager { | ||
|
||
private val unconfinedScope = CoroutineScope(dispatcherManager.unconfined) | ||
|
||
override var lastDatabaseSchemeChangeInstant: Instant? | ||
get() = settingsDiskSource.lastDatabaseSchemeChangeInstant | ||
set(value) { | ||
settingsDiskSource.lastDatabaseSchemeChangeInstant = value | ||
} | ||
|
||
override val lastDatabaseSchemeChangeInstantFlow = | ||
settingsDiskSource | ||
.lastDatabaseSchemeChangeInstantFlow | ||
.stateIn( | ||
scope = unconfinedScope, | ||
started = SharingStarted.Eagerly, | ||
initialValue = settingsDiskSource.lastDatabaseSchemeChangeInstant, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters