mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-27 18:56:49 +02:00
Small correction in the method name
This commit is contained in:
@@ -498,7 +498,7 @@ object LocalPreferences {
|
|||||||
Log.d("LocalPreferences", "Saved to encrypted storage")
|
Log.d("LocalPreferences", "Saved to encrypted storage")
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun loadCurrentAccountFromEncryptedStorage(): AccountSettings? = currentAccount()?.let { loadCurrentAccountFromEncryptedStorage(it) }
|
suspend fun loadAccountConfigFromEncryptedStorage(): AccountSettings? = currentAccount()?.let { loadAccountConfigFromEncryptedStorage(it) }
|
||||||
|
|
||||||
suspend fun saveSharedSettings(
|
suspend fun saveSharedSettings(
|
||||||
sharedSettings: Settings,
|
sharedSettings: Settings,
|
||||||
@@ -529,7 +529,7 @@ object LocalPreferences {
|
|||||||
|
|
||||||
val mutex = Mutex()
|
val mutex = Mutex()
|
||||||
|
|
||||||
suspend fun loadCurrentAccountFromEncryptedStorage(npub: String): AccountSettings? {
|
suspend fun loadAccountConfigFromEncryptedStorage(npub: String): AccountSettings? {
|
||||||
// if already loaded, return right away
|
// if already loaded, return right away
|
||||||
if (cachedAccounts.containsKey(npub)) {
|
if (cachedAccounts.containsKey(npub)) {
|
||||||
return cachedAccounts[npub]
|
return cachedAccounts[npub]
|
||||||
|
@@ -66,7 +66,7 @@ class EventNotificationConsumer(
|
|||||||
var matchAccount = false
|
var matchAccount = false
|
||||||
LocalPreferences.allSavedAccounts().forEach {
|
LocalPreferences.allSavedAccounts().forEach {
|
||||||
if (!matchAccount && (it.hasPrivKey || it.loggedInWithExternalSigner)) {
|
if (!matchAccount && (it.hasPrivKey || it.loggedInWithExternalSigner)) {
|
||||||
LocalPreferences.loadCurrentAccountFromEncryptedStorage(it.npub)?.let { acc ->
|
LocalPreferences.loadAccountConfigFromEncryptedStorage(it.npub)?.let { acc ->
|
||||||
Log.d(TAG, "New Notification Testing if for ${it.npub}")
|
Log.d(TAG, "New Notification Testing if for ${it.npub}")
|
||||||
try {
|
try {
|
||||||
consumeIfMatchesAccount(event, acc)
|
consumeIfMatchesAccount(event, acc)
|
||||||
@@ -124,7 +124,7 @@ class EventNotificationConsumer(
|
|||||||
var matchAccount = false
|
var matchAccount = false
|
||||||
LocalPreferences.allSavedAccounts().forEach {
|
LocalPreferences.allSavedAccounts().forEach {
|
||||||
if (!matchAccount && (it.hasPrivKey || it.loggedInWithExternalSigner) && it.npub in npubs) {
|
if (!matchAccount && (it.hasPrivKey || it.loggedInWithExternalSigner) && it.npub in npubs) {
|
||||||
LocalPreferences.loadCurrentAccountFromEncryptedStorage(it.npub)?.let { accountSettings ->
|
LocalPreferences.loadAccountConfigFromEncryptedStorage(it.npub)?.let { accountSettings ->
|
||||||
Log.d(TAG, "New Notification Testing if for ${it.npub}")
|
Log.d(TAG, "New Notification Testing if for ${it.npub}")
|
||||||
try {
|
try {
|
||||||
val account = Amethyst.instance.loadAccount(accountSettings)
|
val account = Amethyst.instance.loadAccount(accountSettings)
|
||||||
|
@@ -80,7 +80,7 @@ class RegisterAccounts(
|
|||||||
if (account.hasPrivKey || account.loggedInWithExternalSigner) {
|
if (account.hasPrivKey || account.loggedInWithExternalSigner) {
|
||||||
Log.d(tag, "Register Account ${account.npub}")
|
Log.d(tag, "Register Account ${account.npub}")
|
||||||
|
|
||||||
val acc = LocalPreferences.loadCurrentAccountFromEncryptedStorage(account.npub)
|
val acc = LocalPreferences.loadAccountConfigFromEncryptedStorage(account.npub)
|
||||||
if (acc != null && acc.isWriteable()) {
|
if (acc != null && acc.isWriteable()) {
|
||||||
val nip65Read = acc.backupNIP65RelayList?.readRelaysNorm() ?: emptyList()
|
val nip65Read = acc.backupNIP65RelayList?.readRelaysNorm() ?: emptyList()
|
||||||
val nip17Read = acc.backupDMRelayList?.relays() ?: emptyList()
|
val nip17Read = acc.backupDMRelayList?.relays() ?: emptyList()
|
||||||
|
@@ -98,7 +98,7 @@ class AccountStateViewModel : ViewModel() {
|
|||||||
private suspend fun loginWithDefaultAccount(route: Route? = null) {
|
private suspend fun loginWithDefaultAccount(route: Route? = null) {
|
||||||
val accountSettings =
|
val accountSettings =
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
LocalPreferences.loadCurrentAccountFromEncryptedStorage()
|
LocalPreferences.loadAccountConfigFromEncryptedStorage()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (accountSettings != null) {
|
if (accountSettings != null) {
|
||||||
|
Reference in New Issue
Block a user