mirror of
https://github.com/tabidachinokaze/Electro.git
synced 2026-03-01 11:59:44 +08:00
修复退出登录闪退
This commit is contained in:
@@ -22,6 +22,7 @@ import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.flow.filter
|
||||
import kotlinx.coroutines.flow.filterNotNull
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.flow.update
|
||||
@@ -87,7 +88,7 @@ class ElectroViewModel @Inject constructor(
|
||||
viewModelScope.launch {
|
||||
application.dataStore.data.map {
|
||||
it[PreferenceConstant.Key.THEME]
|
||||
}.filterNotNull().collect {
|
||||
}.filterNotNull().filter { it.isNotBlank() }.collect {
|
||||
theme = Theme.valueOf(it)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package cn.tabidachi.electro.data.database.dao
|
||||
|
||||
import androidx.paging.PagingSource
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Insert
|
||||
import androidx.room.Query
|
||||
@@ -31,6 +30,4 @@ interface MessageDao {
|
||||
fun delete(mid: Long)
|
||||
@Query("select * from message where sid = :sid ORDER BY createTime DESC LIMIT :size")
|
||||
fun messages(sid: Long, size: Int): List<Message>
|
||||
@Query("select * from message where sid = :sid ORDER BY createTime DESC")
|
||||
fun messagePagingSource(sid: Long): PagingSource<Int, Message>
|
||||
}
|
||||
@@ -33,6 +33,7 @@ import io.minio.http.Method
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.filter
|
||||
import kotlinx.coroutines.flow.filterNotNull
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.flow.update
|
||||
@@ -65,7 +66,7 @@ class SettingsViewModel @Inject constructor(
|
||||
viewModelScope.launch {
|
||||
application.dataStore.data.map {
|
||||
it[PreferenceConstant.Key.THEME]
|
||||
}.filterNotNull().collect {
|
||||
}.filterNotNull().filter { it.isNotBlank() }.collect {
|
||||
theme = Theme.valueOf(it)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user