Vitor Pamplona 2023-09-25 14:27:45 -04:00
commit a3865e68bd
5 zmienionych plików z 29 dodań i 4 usunięć

Wyświetl plik

@ -43,6 +43,7 @@ class EventNotificationConsumer(private val applicationContext: Context) {
private suspend fun consumeIfMatchesAccount(pushWrappedEvent: GiftWrapEvent, account: Account) { private suspend fun consumeIfMatchesAccount(pushWrappedEvent: GiftWrapEvent, account: Account) {
val key = account.keyPair.privKey val key = account.keyPair.privKey
if (account.loginWithExternalSigner) { if (account.loginWithExternalSigner) {
ExternalSignerUtils.account = account
var cached = ExternalSignerUtils.cachedDecryptedContent[pushWrappedEvent.id] var cached = ExternalSignerUtils.cachedDecryptedContent[pushWrappedEvent.id]
if (cached == null) { if (cached == null) {
ExternalSignerUtils.decrypt( ExternalSignerUtils.decrypt(

Wyświetl plik

@ -4,6 +4,7 @@ import android.util.Log
import com.vitorpamplona.amethyst.AccountInfo import com.vitorpamplona.amethyst.AccountInfo
import com.vitorpamplona.amethyst.BuildConfig import com.vitorpamplona.amethyst.BuildConfig
import com.vitorpamplona.amethyst.LocalPreferences import com.vitorpamplona.amethyst.LocalPreferences
import com.vitorpamplona.amethyst.service.ExternalSignerUtils
import com.vitorpamplona.amethyst.service.HttpClient import com.vitorpamplona.amethyst.service.HttpClient
import com.vitorpamplona.quartz.events.RelayAuthEvent import com.vitorpamplona.quartz.events.RelayAuthEvent
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
@ -23,7 +24,10 @@ class RegisterAccounts(
): List<RelayAuthEvent> { ): List<RelayAuthEvent> {
return accounts.mapNotNull { return accounts.mapNotNull {
val acc = LocalPreferences.loadFromEncryptedStorage(it.npub) val acc = LocalPreferences.loadFromEncryptedStorage(it.npub)
if (acc != null && acc.isWriteable()) { if (acc != null && (acc.isWriteable() || acc.loginWithExternalSigner)) {
if (acc.loginWithExternalSigner) {
ExternalSignerUtils.account = acc
}
val relayToUse = acc.activeRelays()?.firstOrNull { it.read } val relayToUse = acc.activeRelays()?.firstOrNull { it.read }
if (relayToUse != null) { if (relayToUse != null) {
acc.createAuthEvent(relayToUse, notificationToken) acc.createAuthEvent(relayToUse, notificationToken)
@ -66,5 +70,6 @@ class RegisterAccounts(
postRegistrationEvent( postRegistrationEvent(
signEventsToProveControlOfAccounts(accounts, notificationToken) signEventsToProveControlOfAccounts(accounts, notificationToken)
) )
PushNotificationUtils.hasInit = true
} }
} }

Wyświetl plik

@ -111,7 +111,15 @@ fun RelayInformationDialog(
Section(stringResource(R.string.contact)) Section(stringResource(R.string.contact))
Box(modifier = Modifier.padding(start = 10.dp)) { Box(modifier = Modifier.padding(start = 10.dp)) {
ClickableEmail(relayInfo.contact ?: "") relayInfo.contact?.let {
if (it.startsWith("https:")) {
ClickableUrl(urlText = it, url = it)
} else if (it.startsWith("mailto:") || it.contains('@')) {
ClickableEmail(it)
} else {
SectionContent(it)
}
}
} }
Section(stringResource(R.string.supports)) Section(stringResource(R.string.supports))

Wyświetl plik

@ -13,11 +13,12 @@ import androidx.compose.ui.text.AnnotatedString
@Composable @Composable
fun ClickableEmail(email: String) { fun ClickableEmail(email: String) {
val stripped = email.replaceFirst("mailto:", "")
val context = LocalContext.current val context = LocalContext.current
ClickableText( ClickableText(
text = remember { AnnotatedString(email) }, text = remember { AnnotatedString(stripped) },
onClick = { runCatching { context.sendMail(email) } }, onClick = { runCatching { context.sendMail(stripped) } },
style = LocalTextStyle.current.copy(color = MaterialTheme.colors.primary) style = LocalTextStyle.current.copy(color = MaterialTheme.colors.primary)
) )
} }

Wyświetl plik

@ -430,6 +430,8 @@
<string name="automatically_load_images_gifs">Prévisualisation des images</string> <string name="automatically_load_images_gifs">Prévisualisation des images</string>
<string name="automatically_play_videos">Lecture vidéo</string> <string name="automatically_play_videos">Lecture vidéo</string>
<string name="automatically_show_url_preview">Prévisualisation des URLs</string> <string name="automatically_show_url_preview">Prévisualisation des URLs</string>
<string name="automatically_hide_nav_bars">Défilement immersif</string>
<string name="automatically_hide_nav_bars_description">Masquer les barres de navigation lors du défilement</string>
<string name="load_image">Charger l\'image</string> <string name="load_image">Charger l\'image</string>
<string name="spamming_users">Spammeurs</string> <string name="spamming_users">Spammeurs</string>
<string name="muted_button">Silencieux. Cliquer pour réactiver le son</string> <string name="muted_button">Silencieux. Cliquer pour réactiver le son</string>
@ -458,6 +460,7 @@
<string name="messages_group_descriptor">Membres de ce groupe</string> <string name="messages_group_descriptor">Membres de ce groupe</string>
<string name="messages_new_subject_message">Explication aux membres</string> <string name="messages_new_subject_message">Explication aux membres</string>
<string name="messages_new_subject_message_placeholder">Changement de nom pour les nouveaux objectifs.</string> <string name="messages_new_subject_message_placeholder">Changement de nom pour les nouveaux objectifs.</string>
<string name="paste_from_clipboard">Coller depuis le presse-papiers</string>
<string name="language_description">Pour l\'interface de l\'App</string> <string name="language_description">Pour l\'interface de l\'App</string>
<string name="theme_description">Sombre, Clair ou thème Système</string> <string name="theme_description">Sombre, Clair ou thème Système</string>
<string name="automatically_load_images_gifs_description">Charger automatiquement les images et les GIFs</string> <string name="automatically_load_images_gifs_description">Charger automatiquement les images et les GIFs</string>
@ -468,6 +471,7 @@
<string name="copy_the_note_id_to_the_clipboard">Copier l\'ID de la note dans le presse-papiers</string> <string name="copy_the_note_id_to_the_clipboard">Copier l\'ID de la note dans le presse-papiers</string>
<string name="created_at">Créé le</string> <string name="created_at">Créé le</string>
<string name="rules">Règles</string> <string name="rules">Règles</string>
<string name="login_with_external_signer">Se connecter avec Amber</string>
<string name="status_update">Mettez à jour votre statut</string> <string name="status_update">Mettez à jour votre statut</string>
<string name="lightning_wallets_not_found">Erreur d\'analyse du message d\'erreur</string> <string name="lightning_wallets_not_found">Erreur d\'analyse du message d\'erreur</string>
<string name="poll_zap_value_min_max_explainer">Les votes sont pondérés par le montant du zap. Vous pouvez définir un montant minimum pour éviter les spammeurs et un montant maximum pour éviter qu\'un grand nombre de zappeurs ne prenne le contrôle du sondage. Utilisez le même montant dans les deux champs pour vous assurer que chaque vote a la même valeur. Laissez le champ vide pour accepter n\'importe quel montant.</string> <string name="poll_zap_value_min_max_explainer">Les votes sont pondérés par le montant du zap. Vous pouvez définir un montant minimum pour éviter les spammeurs et un montant maximum pour éviter qu\'un grand nombre de zappeurs ne prenne le contrôle du sondage. Utilisez le même montant dans les deux champs pour vous assurer que chaque vote a la même valeur. Laissez le champ vide pour accepter n\'importe quel montant.</string>
@ -496,4 +500,10 @@
<string name="lightning_wallets_not_found2">Portefeuilles Lightning introuvables</string> <string name="lightning_wallets_not_found2">Portefeuilles Lightning introuvables</string>
<string name="paid">Payé</string> <string name="paid">Payé</string>
<string name="wallet_number">Portefeuille %1$s</string> <string name="wallet_number">Portefeuille %1$s</string>
<string name="error_opening_external_signer">Erreur lors de l\'ouverture de l\'application de signature</string>
<string name="sign_request_rejected">Demande de signature rejetée</string>
<string name="no_wallet_found_with_error">Aucun portefeuille trouvé pour payer une facture lightning (Erreur : %1$s). Veuillez installer un portefeuille Lightning pour utiliser les zaps</string>
<string name="no_wallet_found">Aucun portefeuille trouvé pour payer une facture lightning. Veuillez installer un portefeuille Lightning pour utiliser les zaps</string>
<string name="hidden_words">Mots Masqués</string>
<string name="hide_new_word_label">Masquer un nouveau mot ou une phrase</string>
</resources> </resources>