diff --git a/app/src/main/java/com/vitorpamplona/amethyst/service/ZapPaymentHandler.kt b/app/src/main/java/com/vitorpamplona/amethyst/service/ZapPaymentHandler.kt index a0e0790d4..b58fefc98 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/service/ZapPaymentHandler.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/service/ZapPaymentHandler.kt @@ -204,4 +204,4 @@ class ZapPaymentHandler(val account: Account) { onProgress = onProgress ) } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostViewModel.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostViewModel.kt index 1025f0a13..165ebb50b 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostViewModel.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostViewModel.kt @@ -436,10 +436,10 @@ open class NewPostViewModel() : ViewModel() { open fun updateZapForwardTo(it: TextFieldValue) { forwardZapToEditting = it if (it.selection.collapsed) { - val lastWord = it.text.substring(0, it.selection.end).substringAfterLast("\n").substringAfterLast(" ") + val lastWord = it.text userSuggestionAnchor = it.selection userSuggestionsMainMessage = UserSuggestionAnchor.FORWARD_ZAPS - if (lastWord.startsWith("@") && lastWord.length > 2) { + if (lastWord.length > 2) { NostrSearchEventOrUserDataSource.search(lastWord.removePrefix("@")) viewModelScope.launch(Dispatchers.IO) { userSuggestions = LocalCache.findUsersStartingWith(lastWord.removePrefix("@")) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/PollNote.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/PollNote.kt index 1184fa6b2..8e4612345 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/PollNote.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/PollNote.kt @@ -372,7 +372,6 @@ fun ZapVote( } }, onPayViaIntent = { - }, zapType = accountViewModel.account.defaultZapType ) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt index 7ee1a3027..ca6ada208 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt @@ -112,7 +112,6 @@ import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toImmutableList import kotlinx.collections.immutable.toImmutableMap -import kotlinx.collections.immutable.toPersistentList import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -1473,7 +1472,7 @@ fun ZapAmountChoicePopup( onError, onProgress, onPayViaIntent, - account.defaultZapType, + account.defaultZapType ) onDismiss() }, diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt index 17b3d4ecc..8743013a1 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt @@ -12,7 +12,6 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.platform.LocalLifecycleOwner import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight @@ -25,17 +24,13 @@ import androidx.compose.ui.unit.sp import androidx.compose.ui.window.Dialog import androidx.compose.ui.window.DialogProperties import androidx.core.content.ContextCompat -import androidx.lifecycle.Lifecycle -import androidx.lifecycle.LifecycleEventObserver import androidx.lifecycle.ViewModel import androidx.lifecycle.viewmodel.compose.viewModel import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.model.Note -import com.vitorpamplona.amethyst.service.NostrHomeDataSource import com.vitorpamplona.amethyst.service.ZapPaymentHandler import com.vitorpamplona.amethyst.ui.actions.CloseButton -import com.vitorpamplona.amethyst.ui.actions.PostButton import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.TextSpinner import com.vitorpamplona.amethyst.ui.theme.ButtonBorder @@ -291,7 +286,7 @@ fun ErrorMessageDialog( fun PayViaIntentDialog( payingInvoices: ImmutableList, accountViewModel: AccountViewModel, - onClose: () -> Unit, + onClose: () -> Unit ) { val context = LocalContext.current @@ -310,7 +305,7 @@ fun PayViaIntentDialog( ) { CloseButton(onPress = onClose) } - + Spacer(modifier = DoubleVertSpacer) payingInvoices.forEachIndexed { index, it -> @@ -321,7 +316,7 @@ fun PayViaIntentDialog( Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(vertical = Size10dp)) { if (it.user != null) { BaseUserPicture(it.user, Size55dp, accountViewModel = accountViewModel) - } else { + } else { DisplayBlankAuthor(size = Size55dp) } @@ -332,7 +327,7 @@ fun PayViaIntentDialog( UsernameDisplay(it.user, showPlayButton = false) } else { Text( - text = stringResource(id = R.string.wallet_number, index+1), + text = stringResource(id = R.string.wallet_number, index + 1), maxLines = 1, overflow = TextOverflow.Ellipsis, fontWeight = FontWeight.Bold, @@ -341,7 +336,7 @@ fun PayViaIntentDialog( } Row() { Text( - text = showAmount((it.amountMilliSats/1000.0f).toBigDecimal()), + text = showAmount((it.amountMilliSats / 1000.0f).toBigDecimal()), maxLines = 1, overflow = TextOverflow.Ellipsis, fontWeight = FontWeight.Bold, @@ -356,7 +351,6 @@ fun PayViaIntentDialog( fontSize = 18.sp ) } - } Spacer(modifier = DoubleHorzSpacer) @@ -392,9 +386,10 @@ fun PayButton(isActive: Boolean, modifier: Modifier = Modifier, onPost: () -> Un ), contentPadding = PaddingValues(0.dp) ) { - if (isActive) + if (isActive) { Text(text = stringResource(R.string.pay), color = Color.White) - else + } else { Text(text = stringResource(R.string.paid), color = Color.White) + } } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt index f3639cfa2..78659d04b 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt @@ -1,18 +1,14 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn import android.content.Context -import android.content.Intent -import android.net.Uri import androidx.compose.runtime.Immutable import androidx.compose.runtime.Stable -import androidx.core.content.ContextCompat import androidx.lifecycle.LiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.distinctUntilChanged import androidx.lifecycle.map import androidx.lifecycle.viewModelScope -import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.model.AccountState import com.vitorpamplona.amethyst.model.AddressableNote @@ -28,7 +24,6 @@ import com.vitorpamplona.amethyst.service.Nip11CachedRetriever import com.vitorpamplona.amethyst.service.Nip11Retriever import com.vitorpamplona.amethyst.service.OnlineChecker import com.vitorpamplona.amethyst.service.ZapPaymentHandler -import com.vitorpamplona.amethyst.service.lnurl.LightningAddressResolver import com.vitorpamplona.amethyst.ui.components.UrlPreviewState import com.vitorpamplona.amethyst.ui.note.ZapAmountCommentNotification import com.vitorpamplona.amethyst.ui.note.ZapraiserStatus @@ -38,22 +33,18 @@ import com.vitorpamplona.quartz.events.Event import com.vitorpamplona.quartz.events.GiftWrapEvent import com.vitorpamplona.quartz.events.LnZapEvent import com.vitorpamplona.quartz.events.LnZapRequestEvent -import com.vitorpamplona.quartz.events.PayInvoiceErrorResponse import com.vitorpamplona.quartz.events.ReportEvent import com.vitorpamplona.quartz.events.SealedGossipEvent import com.vitorpamplona.quartz.events.UserMetadata -import com.vitorpamplona.quartz.events.ZapSplitSetup import com.vitorpamplona.quartz.utils.TimeUtils import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.ImmutableSet import kotlinx.collections.immutable.persistentSetOf import kotlinx.collections.immutable.toImmutableSet import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.delay import kotlinx.coroutines.launch import java.math.BigDecimal import java.util.Locale -import kotlin.math.round @Stable class AccountViewModel(val account: Account) : ViewModel() { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6ee43e242..e794eb4e0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -574,7 +574,7 @@ Split and Forward Zaps Supporting clients will split and forward zaps to the users added here instead of yours Search and Add User - "@User" + Username or display name User %1$s does not have a lightning address set up to receive sats Percentage 25