Skip to content

Commit 891cd77

Browse files
committed
Merge branch 'master' into mainnet
2 parents f79d1d0 + f97c573 commit 891cd77

File tree

24 files changed

+70
-135
lines changed

24 files changed

+70
-135
lines changed

phoenix-android/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ android {
2626
applicationId = "fr.acinq.phoenix.mainnet"
2727
minSdk = 26
2828
targetSdk = 34
29-
versionCode = 101
30-
versionName = "2.5.1"
29+
versionCode = 102
30+
versionName = gitCommitHash()
3131
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
3232
}
3333

phoenix-android/src/main/kotlin/fr/acinq/phoenix/android/components/scanner/ScannerView.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import android.net.Uri
2424
import android.provider.Settings
2525
import androidx.camera.core.CameraSelector
2626
import androidx.camera.core.resolutionselector.ResolutionSelector
27-
import androidx.camera.core.resolutionselector.ResolutionStrategy
2827
import androidx.camera.view.CameraController
2928
import androidx.camera.view.LifecycleCameraController
3029
import androidx.camera.view.PreviewView
@@ -108,7 +107,6 @@ fun BoxScope.ScannerView(
108107
cameraController.cameraSelector = CameraSelector.DEFAULT_BACK_CAMERA
109108
cameraController.setEnabledUseCases(CameraController.IMAGE_ANALYSIS)
110109
cameraController.imageAnalysisResolutionSelector = ResolutionSelector.Builder()
111-
.setResolutionStrategy(ResolutionStrategy(ZxingQrCodeAnalyzer.DEFAULT_RESOLUTION, ResolutionStrategy.FALLBACK_RULE_CLOSEST_HIGHER))
112110
.setAllowedResolutionMode(ResolutionSelector.PREFER_HIGHER_RESOLUTION_OVER_CAPTURE_RATE)
113111
.build()
114112
cameraController.setImageAnalysisAnalyzer(analyserExecutor, ZxingQrCodeAnalyzer { result ->

phoenix-android/src/main/kotlin/fr/acinq/phoenix/android/home/HomePayments.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ fun ColumnScope.PaymentsList(
4646
onPaymentClick: (UUID) -> Unit,
4747
onPaymentsHistoryClick: () -> Unit,
4848
payments: List<WalletPaymentInfo>,
49-
allPaymentsCount: Long,
5049
) {
5150
Column(modifier = modifier.weight(1f, fill = true), horizontalAlignment = Alignment.CenterHorizontally) {
5251
if (payments.isEmpty()) {
@@ -59,7 +58,6 @@ fun ColumnScope.PaymentsList(
5958
)
6059
} else {
6160
LatestPaymentsList(
62-
allPaymentsCount = allPaymentsCount,
6361
payments = payments,
6462
onPaymentClick = onPaymentClick,
6563
onPaymentsHistoryClick = onPaymentsHistoryClick,
@@ -71,7 +69,6 @@ fun ColumnScope.PaymentsList(
7169

7270
@Composable
7371
private fun ColumnScope.LatestPaymentsList(
74-
allPaymentsCount: Long,
7572
payments: List<WalletPaymentInfo>,
7673
onPaymentClick: (UUID) -> Unit,
7774
onPaymentsHistoryClick: () -> Unit,
@@ -95,7 +92,7 @@ private fun ColumnScope.LatestPaymentsList(
9592
items(payments) {
9693
PaymentLine(it, null, onPaymentClick, isAmountRedacted)
9794
}
98-
if (payments.isNotEmpty() && allPaymentsCount > PaymentsViewModel.paymentsCountInHome) {
95+
if (payments.isNotEmpty()) {
9996
item {
10097
Spacer(Modifier.height(16.dp))
10198
morePaymentsButton()

phoenix-android/src/main/kotlin/fr/acinq/phoenix/android/home/HomeView.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ fun HomeView(
9595
)
9696
}
9797

98-
val allPaymentsCount by business.paymentsManager.paymentsCount.collectAsState()
9998
val payments by paymentsViewModel.homePaymentsFlow.collectAsState()
10099
val swapInBalance = business.balanceManager.swapInWalletBalance.collectAsState()
101100
val finalWallet = business.peerManager.finalWallet.collectAsState()
@@ -244,7 +243,6 @@ fun HomeView(
244243
onPaymentClick = onPaymentClick,
245244
onPaymentsHistoryClick = onPaymentsHistoryClick,
246245
payments = payments,
247-
allPaymentsCount = allPaymentsCount
248246
)
249247
BottomBar(Modifier, onSettingsClick, onReceiveClick, onSendClick)
250248
}

phoenix-android/src/main/kotlin/fr/acinq/phoenix/android/payments/history/PaymentsHistoryView.kt

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import androidx.compose.foundation.layout.PaddingValues
2222
import androidx.compose.foundation.layout.Spacer
2323
import androidx.compose.foundation.layout.fillMaxWidth
2424
import androidx.compose.foundation.layout.height
25+
import androidx.compose.foundation.layout.padding
2526
import androidx.compose.foundation.lazy.LazyColumn
2627
import androidx.compose.foundation.lazy.itemsIndexed
2728
import androidx.compose.foundation.lazy.rememberLazyListState
@@ -34,6 +35,7 @@ import androidx.compose.runtime.collectAsState
3435
import androidx.compose.runtime.getValue
3536
import androidx.compose.runtime.remember
3637
import androidx.compose.runtime.snapshotFlow
38+
import androidx.compose.ui.Alignment
3739
import androidx.compose.ui.Modifier
3840
import androidx.compose.ui.res.stringResource
3941
import androidx.compose.ui.unit.dp
@@ -46,6 +48,7 @@ import fr.acinq.phoenix.android.components.CardHeader
4648
import fr.acinq.phoenix.android.components.DefaultScreenHeader
4749
import fr.acinq.phoenix.android.components.DefaultScreenLayout
4850
import fr.acinq.phoenix.android.components.ItemCard
51+
import fr.acinq.phoenix.android.components.TextWithIcon
4952
import fr.acinq.phoenix.android.utils.logger
5053
import kotlinx.coroutines.flow.distinctUntilChanged
5154
import kotlinx.coroutines.flow.filterNotNull
@@ -99,8 +102,8 @@ fun PaymentsHistoryView(
99102
onPaymentClick: (UUID) -> Unit,
100103
onCsvExportClick: () -> Unit,
101104
) {
105+
val log = logger("PaymentsHistory")
102106
val listState = rememberLazyListState()
103-
val allPaymentsCount by business.paymentsManager.paymentsCount.collectAsState()
104107
val paymentsPage by paymentsViewModel.paymentsPage.collectAsState()
105108
val payments by paymentsViewModel.paymentsFlow.collectAsState()
106109

@@ -120,15 +123,13 @@ fun PaymentsHistoryView(
120123
}
121124
}
122125

123-
val log = logger("PaymentsHistory")
124-
125126
DefaultScreenLayout(
126127
isScrollable = false,
127128
backgroundColor = MaterialTheme.colors.background
128129
) {
129130
DefaultScreenHeader(
130131
content = {
131-
Text(text = stringResource(id = R.string.payments_history_title, allPaymentsCount))
132+
Text(text = stringResource(id = R.string.payments_history_title))
132133
Spacer(Modifier.weight(1f))
133134
Button(
134135
text = stringResource(id = R.string.payments_history_export_button),
@@ -164,6 +165,16 @@ fun PaymentsHistoryView(
164165
}
165166
}
166167

168+
if (groupedPayments.isEmpty()) {
169+
TextWithIcon(
170+
text = stringResource(R.string.payments_history_empty),
171+
textStyle = MaterialTheme.typography.caption,
172+
icon = R.drawable.ic_sleep,
173+
iconTint = MaterialTheme.typography.caption.color,
174+
modifier = Modifier.padding(top = 60.dp).align(Alignment.CenterHorizontally)
175+
)
176+
}
177+
167178
LazyColumn(
168179
state = listState,
169180
contentPadding = PaddingValues(bottom = 60.dp)

phoenix-android/src/main/kotlin/fr/acinq/phoenix/android/settings/walletinfo/SwapInAddressesViewModel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class SwapInAddressesViewModel(private val peerManager: PeerManager) : ViewModel
5454
-1 // legacy address goes to the bottom
5555
}
5656
}
57+
if (newAddresses.isEmpty()) return@collect
5758
val (legacy, taprootList) = newAddresses.last() to newAddresses.dropLast(1)
5859
log.info("swap-in taproot addresses update: ${taprootAddresses.size} -> ${taprootList.size}")
5960
taprootAddresses.clear()

phoenix-android/src/main/res/values-b+es+419/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@
590590

591591
<!-- payments history -->
592592

593-
<string name="payments_history_title">Pagos locales (%1$d)</string>
593+
<string name="payments_history_title">Pagos locales</string>
594594
<string name="payments_history_export_button">Exportar</string>
595595
<string name="payments_history_today">Hoy</string>
596596
<string name="payments_history_yesterday">Ayer</string>

phoenix-android/src/main/res/values-cs/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@
606606

607607
<!-- payments history -->
608608

609-
<string name="payments_history_title">Místní platby (%1$d)</string>
609+
<string name="payments_history_title">Místní platby</string>
610610
<string name="payments_history_export_button">Exportovat</string>
611611
<string name="payments_history_today">Dnes</string>
612612
<string name="payments_history_yesterday">Včera</string>

phoenix-android/src/main/res/values-de/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@
614614

615615
<!-- payments history -->
616616

617-
<string name="payments_history_title">Zahlungen (%1$d)</string>
617+
<string name="payments_history_title">Zahlungen</string>
618618
<string name="payments_history_export_button">Exportieren</string>
619619
<string name="payments_history_today">Heute</string>
620620
<string name="payments_history_yesterday">Gestern</string>

phoenix-android/src/main/res/values-fr/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@
651651

652652
<!-- payments history -->
653653

654-
<string name="payments_history_title">Paiements locaux (%1$d)</string>
654+
<string name="payments_history_title">Paiements locaux</string>
655655
<string name="payments_history_export_button">Exporter</string>
656656
<string name="payments_history_today">Aujourd\'hui</string>
657657
<string name="payments_history_yesterday">Hier</string>

phoenix-android/src/main/res/values-pt-rBR/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@
587587

588588
<!-- payments history -->
589589

590-
<string name="payments_history_title">Pagamentos locais (%1$d)</string>
590+
<string name="payments_history_title">Pagamentos locais</string>
591591
<string name="payments_history_export_button">Exportar</string>
592592
<string name="payments_history_today">Hoje</string>
593593
<string name="payments_history_yesterday">Ontem</string>

phoenix-android/src/main/res/values-sk/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@
653653

654654
<!-- payments history -->
655655

656-
<string name="payments_history_title">Lokálne platby (%1$d)</string>
656+
<string name="payments_history_title">Lokálne platby</string>
657657
<string name="payments_history_export_button">Exportovať</string>
658658
<string name="payments_history_today">Dnes</string>
659659
<string name="payments_history_yesterday">Včera</string>

phoenix-android/src/main/res/values-sw/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@
675675

676676
<!-- Payments history -->
677677

678-
<string name="payments_history_title">Malipo ya ndani (%1$d)</string>
678+
<string name="payments_history_title">Malipo ya ndani</string>
679679
<string name="payments_history_export_button">Hamisha</string>
680680
<string name="payments_history_today">Leo</string>
681681
<string name="payments_history_yesterday">Jana</string>

phoenix-android/src/main/res/values-vi/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@
609609

610610
<!-- payments history -->
611611

612-
<string name="payments_history_title">Thanh toán địa phương (%1$d)</string>
612+
<string name="payments_history_title">Thanh toán địa phương</string>
613613
<string name="payments_history_export_button">Truy xuất</string>
614614
<string name="payments_history_today">Ngày hôm nay</string>
615615
<string name="payments_history_yesterday">Ngày hôm qua</string>

phoenix-android/src/main/res/values/strings.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,8 +761,9 @@
761761

762762
<!-- payments history -->
763763

764-
<string name="payments_history_title">Local payments (%1$d)</string>
764+
<string name="payments_history_title">Local payments</string>
765765
<string name="payments_history_export_button">Export</string>
766+
<string name="payments_history_empty">No payments yet…</string>
766767
<string name="payments_history_today">Today</string>
767768
<string name="payments_history_yesterday">Yesterday</string>
768769
<string name="payments_history_thisweek">Earlier this week</string>

phoenix-ios/phoenix-ios/kotlin/KotlinPublishers+Phoenix.swift

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -352,26 +352,10 @@ extension PhoenixShared.NotificationsManager {
352352
extension PaymentsManager {
353353

354354
fileprivate struct _Key {
355-
static var paymentsCountPublisher = 0
356355
static var lastCompletedPaymentPublisher = 0
357356
static var lastIncomingPaymentPublisher = 0
358357
}
359358

360-
func paymentsCountPublisher() -> AnyPublisher<Int64, Never> {
361-
362-
self.getSetAssociatedObject(storageKey: &_Key.paymentsCountPublisher) {
363-
364-
// Transforming from Kotlin:
365-
// `paymentsCount: StateFlow<Long>`
366-
//
367-
KotlinCurrentValueSubject<KotlinLong>(
368-
self.paymentsCount
369-
)
370-
.compactMap { $0?.int64Value }
371-
.eraseToAnyPublisher()
372-
}
373-
}
374-
375359
func lastCompletedPaymentPublisher() -> AnyPublisher<Lightning_kmpWalletPayment, Never> {
376360

377361
self.getSetAssociatedObject(storageKey: &_Key.lastCompletedPaymentPublisher) {

phoenix-ios/phoenix-ios/views/main/HomeView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ struct HomeView : MVIView {
776776
let balance = model.balance?.msat ?? 0
777777
let incomingBalance = swapInWallet.totalBalance.sat
778778

779-
if balance > 0 || incomingBalance > 0 || model.paymentsCount > 0 {
779+
if balance > 0 || incomingBalance > 0 {
780780
if Prefs.shared.isNewWallet {
781781
Prefs.shared.isNewWallet = false
782782
}

phoenix-ios/phoenix-ios/views/transactions/TransactionsView.swift

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ struct TransactionsView: View {
2323

2424
private let paymentsPageFetcher = Biz.getPaymentsPageFetcher(name: "TransactionsView")
2525

26-
let paymentsCountPublisher = Biz.business.paymentsManager.paymentsCountPublisher()
27-
@State var paymentsCount: Int64 = 0
28-
2926
let paymentsPagePublisher: AnyPublisher<PaymentsPage, Never>
3027
@State var paymentsPage = PaymentsPage(offset: 0, count: 0, rows: [])
3128
@State var cachedRows: [WalletPaymentInfo] = []
@@ -87,9 +84,6 @@ struct TransactionsView: View {
8784
.onAppear {
8885
onAppear()
8986
}
90-
.onReceive(paymentsCountPublisher) {
91-
paymentsCountChanged($0)
92-
}
9387
.onReceive(paymentsPagePublisher) {
9488
paymentsPageChanged($0)
9589
}
@@ -284,12 +278,6 @@ struct TransactionsView: View {
284278
}
285279
}
286280

287-
func paymentsCountChanged(_ count: Int64) {
288-
log.trace("paymentsCountChanged() => \(count)")
289-
290-
paymentsCount = count
291-
}
292-
293281
func paymentsPageChanged(_ page: PaymentsPage) {
294282
log.trace("paymentsPageChanged() => \(page.rows.count)")
295283

0 commit comments

Comments
 (0)