Mark recent changes as read when dismissing snackbar
This commit is contained in:
parent
2c89a69b17
commit
612f0b9477
2 changed files with 11 additions and 1 deletions
|
@ -13,7 +13,7 @@ import kotlinx.coroutines.flow.map
|
|||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
class RecentChangesViewModel(
|
||||
private val generalSettingsManager: GeneralSettingsManager,
|
||||
changeLogManager: ChangeLogManager
|
||||
private val changeLogManager: ChangeLogManager
|
||||
) : ViewModel() {
|
||||
val shouldShowRecentChangesHint = changeLogManager.changeLogFlow.flatMapLatest { changeLog ->
|
||||
if (changeLog.isFirstRun && !changeLog.isFirstRunEver) {
|
||||
|
@ -28,4 +28,8 @@ class RecentChangesViewModel(
|
|||
.map { generalSettings -> generalSettings.showRecentChanges }
|
||||
.distinctUntilChanged()
|
||||
}
|
||||
|
||||
fun onRecentChangesHintDismissed() {
|
||||
changeLogManager.writeCurrentVersion()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ import com.fsck.k9.ui.folders.FolderNameFormatterFactory
|
|||
import com.fsck.k9.ui.helper.RelativeDateTimeFormatter
|
||||
import com.fsck.k9.ui.messagelist.MessageListFragment.MessageListFragmentListener.Companion.MAX_PROGRESS
|
||||
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
import com.google.android.material.snackbar.BaseTransientBottomBar.BaseCallback
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import java.util.concurrent.Future
|
||||
import net.jcip.annotations.GuardedBy
|
||||
|
@ -369,6 +370,11 @@ class MessageListFragment :
|
|||
recentChangesSnackbar = Snackbar
|
||||
.make(coordinatorLayout, R.string.changelog_snackbar_text, Snackbar.LENGTH_INDEFINITE)
|
||||
.setAction(R.string.okay_action) { launchRecentChangesActivity() }
|
||||
.addCallback(object : BaseCallback<Snackbar>() {
|
||||
override fun onDismissed(transientBottomBar: Snackbar?, event: Int) {
|
||||
recentChangesViewModel.onRecentChangesHintDismissed()
|
||||
}
|
||||
})
|
||||
|
||||
recentChangesViewModel.shouldShowRecentChangesHint
|
||||
.observe(viewLifecycleOwner, shouldShowRecentChangesHintObserver)
|
||||
|
|
Loading…
Reference in a new issue