Skip to content
Merged
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
1 change: 1 addition & 0 deletions Bitkit/Components/Activity/ActivityBanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ struct ActivityBanner: View {
Text(bannerText)
.font(Fonts.black(size: 20))
.foregroundColor(.textPrimary)
.textCase(.uppercase)
.kerning(0)
.lineLimit(1)
}
Expand Down
11 changes: 4 additions & 7 deletions Bitkit/Components/Activity/ActivityList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct ActivityList: View {
switch groupItem {
case let .header(title):
CaptionMText(title)
.padding(.top, 16)
.frame(height: 34, alignment: .bottom)

case let .activity(item):
NavigationLink(value: Route.activityDetail(item)) {
Expand All @@ -43,12 +43,9 @@ struct ActivityList: View {

private func getActivities() -> [Activity] {
switch viewType {
case .all:
return activity.filteredActivities ?? []
case .lightning:
return activity.lightningActivities ?? []
case .onchain:
return activity.onchainActivities ?? []
case .all: return activity.filteredActivities ?? []
case .lightning: return activity.lightningActivities ?? []
case .onchain: return activity.onchainActivities ?? []
}
}
}
18 changes: 18 additions & 0 deletions Bitkit/Components/BlurView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import SwiftUI
import UIKit

struct BlurView: UIViewRepresentable {
func makeUIView(context: Context) -> UIVisualEffectView {
UIVisualEffectView(effect: UIBlurEffect(style: .systemChromeMaterialLight))
}

func updateUIView(_ uiView: UIVisualEffectView, context: Context) {
DispatchQueue.main.async {
if let backdropLayer = uiView.layer.sublayers?.first {
backdropLayer.filters?.removeAll(where: { filter in
Comment thread
pwltr marked this conversation as resolved.
String(describing: filter) != "gaussianBlur"
})
}
}
}
}
25 changes: 10 additions & 15 deletions Bitkit/Components/Button/SecondaryButtonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,32 @@ struct SecondaryButtonView: View {
.frame(maxWidth: size == .large ? .infinity : nil)
.frame(height: buttonHeight)
.padding(.horizontal, 16)
// TODO: Add background blur
.background(
RoundedRectangle(cornerRadius: 64)
.fill(isPressed ? Color.white10 : Color.white01)
.overlay(
RoundedRectangle(cornerRadius: 64)
.strokeBorder(borderColor, lineWidth: strokeWidth)
)
)
.background(isPressed ? Color.white10 : Color.clear)
.background(BlurView())
.overlay(RoundedRectangle(cornerRadius: 64).strokeBorder(borderColor, lineWidth: strokeWidth))
.cornerRadius(64)
.contentShape(Rectangle())
}

private var textColor: Color {
return isDisabled ? .white32 : .white80
isDisabled ? .white32 : .white80
}

private var borderColor: Color {
return isDisabled ? .clear : Color(hex: 0x3A3A3A)
isDisabled ? .clear : .gray4
}

private var buttonHeight: CGFloat {
switch size {
case .small: return 37
case .large: return 56
case .small: 37
case .large: 56
}
}

private var strokeWidth: CGFloat {
switch size {
case .small: return 1
case .large: return 2
case .small: 1
case .large: 2
}
}
}
6 changes: 6 additions & 0 deletions Bitkit/Components/NavigationBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,11 @@ struct NavigationBar: View {
}
}
.frame(height: 48)
.background(LinearGradient(
colors: [.black, .black.opacity(0)],
startPoint: .top,
endPoint: .bottom
))
.zIndex(.infinity)
}
}
5 changes: 3 additions & 2 deletions Bitkit/Components/SegmentedControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct SegmentedControl<T: Hashable & CustomStringConvertible>: View {
HStack(spacing: 8) {
ForEach(tabItems, id: \.tab) { tabItem in
Button(action: {
withAnimation(.spring(response: 0.35, dampingFraction: 0.8)) {
withAnimation(.easeInOut(duration: 0.2)) {
selectedTab = tabItem.tab
}
}) {
Expand All @@ -43,6 +43,7 @@ struct SegmentedControl<T: Hashable & CustomStringConvertible>: View {
Rectangle()
.frame(height: 2)
.foregroundColor(Color.white64)

if selectedTab == tabItem.tab {
Rectangle()
.frame(height: 2)
Expand All @@ -51,7 +52,7 @@ struct SegmentedControl<T: Hashable & CustomStringConvertible>: View {
}
}
}
.frame(maxWidth: .infinity)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottom)
.contentShape(Rectangle())
}
.buttonStyle(PlainButtonStyle())
Expand Down
2 changes: 1 addition & 1 deletion Bitkit/Components/ShopWebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct ShopWebView: UIViewRepresentable {
wkWebView.isOpaque = false
wkWebView.backgroundColor = UIColor(red: 0x14 / 255.0, green: 0x17 / 255.0, blue: 0x16 / 255.0, alpha: 1.0) // #141716
wkWebView.scrollView.backgroundColor = wkWebView.backgroundColor
wkWebView.layer.cornerRadius = 8
wkWebView.layer.cornerRadius = 18
wkWebView.clipsToBounds = true

webView?.wrappedValue = wkWebView
Expand Down
24 changes: 24 additions & 0 deletions Bitkit/Extensions/View+SafeArea.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
import SwiftUI
import UIKit

// MARK: - Layout constants (header, tab bar, spacing) used for content margins across wallet/home screens

enum ScreenLayout {
static let headerHeight: CGFloat = 48
static let headerSpacing: CGFloat = 16
static let tabBarHeight: CGFloat = 64
static let bottomSpacing: CGFloat = 32

/// Safe area top + header + spacing (e.g. HomeScreen, HomeWalletView, HomeWidgetsView)
static var topPaddingWithSafeArea: CGFloat {
windowSafeAreaInsets.top + headerHeight + headerSpacing
}

/// Header + spacing only, when view is already inside safe area (e.g. SavingsWalletScreen, SpendingWalletScreen)
static var topPaddingWithoutSafeArea: CGFloat {
headerHeight + headerSpacing
}

/// Safe area bottom + tab bar + spacing
static var bottomPaddingWithSafeArea: CGFloat {
windowSafeAreaInsets.bottom + tabBarHeight + bottomSpacing
}
}

private var hasBottomSafeArea: Bool {
windowSafeAreaInsets.bottom > 0
}
Expand Down
6 changes: 3 additions & 3 deletions Bitkit/MainNavView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ struct MainNavView: View {
.accentColor(.white)
.overlay {
TabBar()
.ignoresSafeArea(.keyboard)
DrawerView()
}
.onChange(of: scenePhase) { _, newPhase in
Expand Down Expand Up @@ -276,8 +277,8 @@ struct MainNavView: View {
case let .activityDetail(activity): ActivityItemView(item: activity)
case let .activityExplorer(activity): ActivityExplorerView(item: activity)
case .buyBitcoin: BuyBitcoinView()
case .savingsWallet: SavingsWalletView()
case .spendingWallet: SpendingWalletView()
case .savingsWallet: SavingsWalletScreen()
case .spendingWallet: SpendingWalletScreen()
case .scanner: ScannerScreen()

// Transfer
Expand Down Expand Up @@ -311,7 +312,6 @@ struct MainNavView: View {
case .shopIntro: ShopIntro()
case .shopDiscover: ShopDiscover()
case let .shopMain(page): ShopMain(page: page)
case .shopMap: ShopMap()

// Widgets
case .widgetsIntro: WidgetsIntroView()
Expand Down
1 change: 0 additions & 1 deletion Bitkit/ViewModels/NavigationViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ enum Route: Hashable {
case shopIntro
case shopDiscover
case shopMain(page: String)
case shopMap

// Widgets
case widgetsIntro
Expand Down
4 changes: 2 additions & 2 deletions Bitkit/ViewModels/WidgetsViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ struct PlaceholderWidget: View {
// MARK: - Widget Types

enum WidgetType: String, CaseIterable, Codable {
case suggestions
case price
case news
case blocks
case facts
case calculator
case weather
case calculator
case suggestions
}

// MARK: - WidgetsViewModel
Expand Down
14 changes: 2 additions & 12 deletions Bitkit/Views/Home/HomeWalletView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ struct HomeWalletView: View {
return activity.latestActivities?.isEmpty == false
}

/// Safe area + header + spacing
private var topPadding: CGFloat {
windowSafeAreaInsets.top + 48 + 16
}

/// Safe area + tab bar + spacing
private var bottomPadding: CGFloat {
windowSafeAreaInsets.bottom + 64 + 32
}

var body: some View {
VStack(spacing: 0) {
MoneyStack(
Expand Down Expand Up @@ -66,8 +56,8 @@ struct HomeWalletView: View {
WalletOnboardingView(type: .home)
}
}
.padding(.top, topPadding)
.padding(.bottom, bottomPadding)
.padding(.top, ScreenLayout.topPaddingWithSafeArea)
.padding(.bottom, ScreenLayout.bottomPaddingWithSafeArea)
.padding(.horizontal)
.animation(.spring(response: 0.3), value: hasActivity)
}
Expand Down
14 changes: 2 additions & 12 deletions Bitkit/Views/Home/HomeWidgetsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@ struct HomeWidgetsView: View {
}
}

/// Safe area + header + spacing
private var topPadding: CGFloat {
windowSafeAreaInsets.top + 48 + 16
}

/// Safe area + tab bar + spacing
private var bottomPadding: CGFloat {
windowSafeAreaInsets.bottom + 64 + 32
}

var body: some View {
ScrollView(showsIndicators: false) {
VStack(alignment: .leading, spacing: 0) {
Expand Down Expand Up @@ -55,8 +45,8 @@ struct HomeWidgetsView: View {
.accessibilityIdentifier("WidgetsAdd")
}
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
.padding(.top, topPadding)
.padding(.bottom, bottomPadding)
.padding(.top, ScreenLayout.topPaddingWithSafeArea)
.padding(.bottom, ScreenLayout.bottomPaddingWithSafeArea)
.padding(.horizontal)
}
}
Expand Down
14 changes: 2 additions & 12 deletions Bitkit/Views/HomeScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ struct HomeScreen: View {
scrollPosition ?? 0
}

/// Safe area + header + spacing
private var topPadding: CGFloat {
windowSafeAreaInsets.top + 48 + 16
}

/// Safe area + tab bar + spacing
private var bottomPadding: CGFloat {
windowSafeAreaInsets.bottom + 64 + 32
}

var body: some View {
ZStack(alignment: .top) {
Header(showWidgetEditButton: currentPage == 1, isEditingWidgets: $isEditingWidgets)
Expand Down Expand Up @@ -74,7 +64,7 @@ struct HomeScreen: View {
startPoint: .top,
endPoint: .bottom
)
.frame(height: topPadding)
.frame(height: ScreenLayout.topPaddingWithSafeArea)

Spacer()

Expand All @@ -83,7 +73,7 @@ struct HomeScreen: View {
startPoint: .top,
endPoint: .bottom
)
.frame(height: bottomPadding)
.frame(height: ScreenLayout.bottomPaddingWithSafeArea)
}
.ignoresSafeArea()
.allowsHitTesting(false)
Expand Down
5 changes: 2 additions & 3 deletions Bitkit/Views/Shop/ShopDiscover.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ struct ShopDiscover: View {
NavigationBar(title: t("other__shop__discover__nav_title"))
.padding(.horizontal, 16)

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

Group {
Expand All @@ -111,6 +109,7 @@ struct ShopDiscover: View {
case .map:
ShopWebView(url: Env.btcMapUrl)
.padding(.top, 16)
.padding(.horizontal, 16)
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
Expand Down
12 changes: 3 additions & 9 deletions Bitkit/Views/Shop/ShopMain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,10 @@ struct ShopMain: View {

var body: some View {
VStack(spacing: 0) {
NavigationBar(
title: t("other__shop__main__nav_title"),
showMenuButton: false
)
NavigationBar(title: t("other__shop__main__nav_title"))

ShopWebView(
url: uri,
onMessage: handleMessage
)
.padding(.top, 16)
ShopWebView(url: uri, onMessage: handleMessage)
.padding(.top, 16)
}
.navigationBarHidden(true)
.padding(.horizontal, 16)
Expand Down
25 changes: 0 additions & 25 deletions Bitkit/Views/Shop/ShopMap.swift

This file was deleted.

Loading
Loading