Fixes the wrong import

This commit is contained in:
Vitor Pamplona
2025-08-28 15:54:14 -04:00
parent f7eb043aac
commit 8493c95e07
5 changed files with 8 additions and 5 deletions

View File

@@ -26,7 +26,6 @@ import com.vitorpamplona.amethyst.model.LocalCache
import com.vitorpamplona.amethyst.model.NoteState import com.vitorpamplona.amethyst.model.NoteState
import com.vitorpamplona.amethyst.model.nip51Lists.blockedRelays.BlockedRelayListState import com.vitorpamplona.amethyst.model.nip51Lists.blockedRelays.BlockedRelayListState
import com.vitorpamplona.amethyst.model.nip51Lists.proxyRelays.ProxyRelayListState import com.vitorpamplona.amethyst.model.nip51Lists.proxyRelays.ProxyRelayListState
import com.vitorpamplona.amethyst.ui.navigation.navs.EmptyNav.scope
import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.core.HexKey
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent

View File

@@ -25,10 +25,12 @@ import androidx.datastore.preferences.core.stringPreferencesKey
import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.core.HexKey
import com.vitorpamplona.quartz.nip47WalletConnect.Nip47WalletConnect import com.vitorpamplona.quartz.nip47WalletConnect.Nip47WalletConnect
import com.vitorpamplona.quartz.utils.LargeCache import com.vitorpamplona.quartz.utils.LargeCache
import kotlinx.coroutines.CoroutineScope
import java.io.File import java.io.File
class AccountSecretsEncryptedStores( class AccountSecretsEncryptedStores(
val rootFilesDir: () -> File, val rootFilesDir: () -> File,
val scope: CoroutineScope,
) { ) {
companion object Companion { companion object Companion {
val encryption = KeyStoreEncryption() val encryption = KeyStoreEncryption()
@@ -47,6 +49,7 @@ class AccountSecretsEncryptedStores(
produceFile = { file(npub) }, produceFile = { file(npub) },
), ),
encryption, encryption,
scope = scope,
) )
} }

View File

@@ -24,8 +24,7 @@ import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.edit import androidx.datastore.preferences.core.edit
import androidx.datastore.preferences.core.emptyPreferences import androidx.datastore.preferences.core.emptyPreferences
import com.vitorpamplona.amethyst.ui.navigation.navs.EmptyNav.scope import kotlinx.coroutines.CoroutineScope
import com.vitorpamplona.quartz.nip47WalletConnect.Nip47WalletConnect.Nip47URI.Companion.parser
import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
import java.io.IOException import java.io.IOException
@@ -34,6 +33,7 @@ suspend fun <T> DataStore<Preferences>.getProperty(
key: Preferences.Key<String>, key: Preferences.Key<String>,
parser: (String) -> T, parser: (String) -> T,
serializer: (T) -> String, serializer: (T) -> String,
scope: CoroutineScope,
): UpdatablePropertyFlow<T> = ): UpdatablePropertyFlow<T> =
UpdatablePropertyFlow<T>( UpdatablePropertyFlow<T>(
flow = flow =

View File

@@ -24,7 +24,7 @@ import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.edit import androidx.datastore.preferences.core.edit
import androidx.datastore.preferences.core.emptyPreferences import androidx.datastore.preferences.core.emptyPreferences
import com.vitorpamplona.amethyst.ui.navigation.navs.EmptyNav.scope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.firstOrNull import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
@@ -34,6 +34,7 @@ import java.util.Base64
class EncryptedDataStore( class EncryptedDataStore(
private val store: DataStore<Preferences>, private val store: DataStore<Preferences>,
private val encryption: KeyStoreEncryption = KeyStoreEncryption(), private val encryption: KeyStoreEncryption = KeyStoreEncryption(),
private val scope: CoroutineScope,
) { ) {
private fun decode(str: String): ByteArray = Base64.getDecoder().decode(str) private fun decode(str: String): ByteArray = Base64.getDecoder().decode(str)

View File

@@ -47,7 +47,6 @@ import com.vitorpamplona.amethyst.service.notifications.PushNotificationUtils
import com.vitorpamplona.amethyst.service.relayClient.authCommand.compose.RelayAuthSubscription import com.vitorpamplona.amethyst.service.relayClient.authCommand.compose.RelayAuthSubscription
import com.vitorpamplona.amethyst.service.relayClient.reqCommand.account.AccountFilterAssemblerSubscription import com.vitorpamplona.amethyst.service.relayClient.reqCommand.account.AccountFilterAssemblerSubscription
import com.vitorpamplona.amethyst.ui.navigation.AppNavigation import com.vitorpamplona.amethyst.ui.navigation.AppNavigation
import com.vitorpamplona.amethyst.ui.navigation.navs.EmptyNav.scope
import com.vitorpamplona.amethyst.ui.navigation.routes.Route import com.vitorpamplona.amethyst.ui.navigation.routes.Route
import com.vitorpamplona.amethyst.ui.screen.AccountStateViewModel import com.vitorpamplona.amethyst.ui.screen.AccountStateViewModel
import com.vitorpamplona.amethyst.ui.screen.SharedPreferencesViewModel import com.vitorpamplona.amethyst.ui.screen.SharedPreferencesViewModel
@@ -166,6 +165,7 @@ fun NotificationRegistration(accountViewModel: AccountViewModel) {
} }
} }
} else { } else {
val scope = rememberCoroutineScope()
// no need for push permissions before 33 // no need for push permissions before 33
LifecycleResumeEffect(key1 = accountViewModel) { LifecycleResumeEffect(key1 = accountViewModel) {
Log.d("RegisterAccounts", "Registering for push notifications") Log.d("RegisterAccounts", "Registering for push notifications")