mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-03-26 17:52:29 +01:00
Removing unecessary livedata objects for translation services
This commit is contained in:
parent
239f973e89
commit
ec83ad9d20
@ -219,7 +219,6 @@ class Account(
|
||||
|
||||
// Observers line up here.
|
||||
val live: AccountLiveData = AccountLiveData(this)
|
||||
val liveLanguages: AccountLiveData = AccountLiveData(this)
|
||||
val saveable: AccountLiveData = AccountLiveData(this)
|
||||
|
||||
@Immutable
|
||||
@ -2831,21 +2830,16 @@ class Account(
|
||||
|
||||
fun updateLocalRelayServers(servers: Set<String>) {
|
||||
localRelayServers = servers
|
||||
liveLanguages.invalidateData()
|
||||
saveable.invalidateData()
|
||||
}
|
||||
|
||||
fun addDontTranslateFrom(languageCode: String) {
|
||||
dontTranslateFrom = dontTranslateFrom.plus(languageCode)
|
||||
liveLanguages.invalidateData()
|
||||
|
||||
saveable.invalidateData()
|
||||
}
|
||||
|
||||
fun updateTranslateTo(languageCode: String) {
|
||||
translateTo = languageCode
|
||||
liveLanguages.invalidateData()
|
||||
|
||||
saveable.invalidateData()
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,6 @@ class AccountViewModel(
|
||||
) : ViewModel(),
|
||||
Dao {
|
||||
val accountLiveData: LiveData<AccountState> = account.live.map { it }
|
||||
val accountLanguagesLiveData: LiveData<AccountState> = account.liveLanguages.map { it }
|
||||
|
||||
// TODO: contact lists are not notes yet
|
||||
// val kind3Relays: StateFlow<ContactListEvent?> = observeByAuthor(ContactListEvent.KIND, account.signer.pubKey)
|
||||
|
@ -42,7 +42,6 @@ import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.derivedStateOf
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.livedata.observeAsState
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
@ -366,9 +365,10 @@ fun TranslateAndWatchLanguageChanges(
|
||||
accountViewModel: AccountViewModel,
|
||||
onTranslated: (TranslationConfig) -> Unit,
|
||||
) {
|
||||
val accountState by accountViewModel.accountLanguagesLiveData.observeAsState()
|
||||
// Don't automatically update translations.
|
||||
// val accountState by accountViewModel.accountLanguagesLiveData.observeAsState()
|
||||
|
||||
LaunchedEffect(accountState) {
|
||||
LaunchedEffect(Unit) {
|
||||
// This takes some time. Launches as a Composition scope to make sure this gets cancel if this
|
||||
// item gets out of view.
|
||||
withContext(Dispatchers.IO) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user