Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions Bitkit/Components/Button/PrimaryButtonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ struct PrimaryButtonView: View {

private var backgroundGradient: some View {
if let background {
if isPressed {
return AnyView(ButtonGradient(isPressed: isPressed))
}

return background
}

Expand Down
13 changes: 3 additions & 10 deletions Bitkit/Components/SheetIntro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,25 +85,18 @@ struct SheetIntro: View {
private var buttonStack: some View {
if let cancelText, let onCancel {
HStack(alignment: .center, spacing: 16) {
CustomButton(
title: cancelText,
variant: .secondary
) {
CustomButton(title: cancelText, variant: .secondary) {
onCancel()
}
.accessibilityIdentifier("\(baseTestID)Cancel")

CustomButton(
title: continueText
) {
CustomButton(title: continueText) {
onContinue()
}
.accessibilityIdentifier(continueButtonTestID)
}
} else {
CustomButton(
title: continueText
) {
CustomButton(title: continueText) {
onContinue()
}
.accessibilityIdentifier(continueButtonTestID)
Expand Down
2 changes: 1 addition & 1 deletion Bitkit/ViewModels/ActivityListViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class ActivityListViewModel: ObservableObject {
func syncState() async {
do {
// Get latest activities first as that's displayed on the home view
let limitLatest: UInt32 = UIScreen.main.isSmall ? 2 : 3
let limitLatest: UInt32 = 4
// Fetch extra to account for potential filtering of replaced transactions
let latest = try await coreService.activity.get(filter: .all, limit: limitLatest * 3)
let filtered = await filterOutReplacedSentTransactions(latest)
Expand Down
2 changes: 1 addition & 1 deletion Bitkit/Views/Shop/ShopDiscover.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ struct ShopDiscover: View {
NavigationBar(title: t("other__shop__discover__nav_title"))
.padding(.horizontal, 16)

SegmentedControl(selectedTab: $selectedTab, tabs: ShopTab.allCases, activeColor: .yellowAccent)
SegmentedControl(selectedTab: $selectedTab, tabs: ShopTab.allCases)
.padding(.horizontal, 16)

Group {
Expand Down
23 changes: 21 additions & 2 deletions Bitkit/Views/Wallets/Activity/ActivityLatest.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import BitkitCore
import SwiftUI

struct ActivityLatest: View {
@EnvironmentObject private var activity: ActivityListViewModel
@EnvironmentObject private var app: AppViewModel
@EnvironmentObject private var feeEstimatesManager: FeeEstimatesManager
@EnvironmentObject private var navigation: NavigationViewModel
@EnvironmentObject private var settings: SettingsViewModel
@EnvironmentObject private var wallet: WalletViewModel

private var shouldShowBanner: Bool {
Expand All @@ -30,6 +33,21 @@ struct ActivityLatest: View {
return BlockTimeHelpers.getDurationForBlocks(blocksRemaining)
}

/// Three or four vertical slots (by screen size) shared by: transfer banner, widgets onboarding
/// and activity items; only the item count shrinks so the total stays within the cap.
private var maxActivityItemsOnHome: Int {
let slotCapacity = UIScreen.main.isSmall ? 3 : 4
var nonItemSlots = 0
if shouldShowBanner { nonItemSlots += 1 }
if settings.showWidgets, !app.hasDismissedWidgetsOnboardingHint { nonItemSlots += 1 }
return max(0, slotCapacity - nonItemSlots)
}

private var displayedActivities: [Activity]? {
guard let items = activity.latestActivities, !items.isEmpty else { return nil }
return Array(items.prefix(maxActivityItemsOnHome))
}

var body: some View {
VStack(spacing: 0) {
if shouldShowBanner {
Expand All @@ -38,9 +56,9 @@ struct ActivityLatest: View {
.transition(.opacity)
}

if let items = activity.latestActivities {
if let rows = displayedActivities {
LazyVStack(alignment: .leading, spacing: 16) {
ForEach(Array(zip(items.indices, items)), id: \.1) { index, item in
ForEach(Array(zip(rows.indices, rows)), id: \.1) { index, item in
NavigationLink(value: Route.activityDetail(item)) {
ActivityRow(item: item, feeEstimates: feeEstimatesManager.estimates)
}
Expand All @@ -55,6 +73,7 @@ struct ActivityLatest: View {
}
}
.animation(.spring(response: 0.4, dampingFraction: 0.8), value: shouldShowBanner)
.animation(.spring(response: 0.4, dampingFraction: 0.8), value: maxActivityItemsOnHome)
.task {
await feeEstimatesManager.getEstimates(refresh: false)
}
Expand Down
10 changes: 5 additions & 5 deletions Bitkit/Views/Wallets/Receive/ReceiveQr.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ struct ReceiveQr: View {
// Show unified tab when we have a Lightning invoice (even if channels not yet usable)
if !wallet.bolt11.isEmpty {
return [
TabItem(.savings, activeColor: .brandAccent),
TabItem(.unified, activeColor: .textPrimary),
TabItem(.spending, activeColor: .purpleAccent),
TabItem(.savings),
TabItem(.unified),
TabItem(.spending),
]
} else {
return [
TabItem(.savings, activeColor: .textPrimary),
TabItem(.spending, activeColor: .purpleAccent),
TabItem(.savings),
TabItem(.spending),
]
}
}
Expand Down
9 changes: 5 additions & 4 deletions Bitkit/Views/Wallets/Send/SendConfirmationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,24 +127,25 @@ struct SendConfirmationView: View {
.rotationEffect(.degrees(swipeProgress * 14))
}

Spacer(minLength: 16)

if !UIScreen.main.isSmall || !showDetails {
CustomButton(
title: showDetails ? t("common__hide_details") : t("common__show_details"),
size: .small,
icon: Image(showDetails ? "eye-slash" : app.selectedWalletToPayFrom == .lightning ? "bolt-hollow" : "speed-normal")
.resizable()
.frame(width: 16, height: 16)
.foregroundColor(accentColor)
.foregroundColor(accentColor),
background: Color(hex: 0x151515)
) {
showDetails.toggle()
}
.frame(maxWidth: .infinity, alignment: .center)
.padding(.top, 16)
.padding(.bottom, 62)
.accessibilityIdentifier("SendConfirmToggleDetails")
}

Spacer(minLength: 16)

SwipeButton(title: t("wallet__send_swipe"), accentColor: accentColor, swipeProgress: $swipeProgress) {
// Validate payment and show warnings if needed
let warnings = await validatePayment()
Expand Down
Loading