Skip to content

Commit eedf311

Browse files
authored
Merge pull request #176 from synonymdev/fix/various-fixes
fix: various fixes
2 parents 0462514 + 5005440 commit eedf311

File tree

10 files changed

+49
-92
lines changed

10 files changed

+49
-92
lines changed

Bitkit/AppScene.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ struct AppScene: View {
8080
.environmentObject(suggestionsManager)
8181
.environmentObject(tagManager)
8282
.onAppear {
83-
if !settings.requirePinOnLaunch {
83+
if !settings.pinEnabled {
8484
isPinVerified = true
8585
}
8686

@@ -132,7 +132,7 @@ struct AppScene: View {
132132
// Wallet exists and has been restored from backup. isRestoringWallet is set to false inside below component
133133
WalletRestoreSuccess()
134134
} else {
135-
if !isPinVerified && settings.pinEnabled && (settings.requirePinOnLaunch || settings.requirePinWhenIdle) {
135+
if !isPinVerified && settings.pinEnabled {
136136
AuthCheck {
137137
isPinVerified = true
138138
}
@@ -256,8 +256,8 @@ struct AppScene: View {
256256
}
257257

258258
private func handleScenePhaseChange(_: ScenePhase) {
259-
// If 'pinOnIdle' is enabled, lock the app when the app goes to the background
260-
if scenePhase == .background && settings.pinEnabled && settings.requirePinWhenIdle {
259+
// If PIN is enabled, lock the app when the app goes to the background
260+
if scenePhase == .background && settings.pinEnabled {
261261
isPinVerified = false
262262
}
263263
}

Bitkit/Components/Button/PrimaryButtonView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct PrimaryButtonView: View {
3333
.background(backgroundGradient)
3434
.cornerRadius(64)
3535
.shadow(color: shadowColor, radius: 0, x: 0, y: -1)
36-
.opacity(isDisabled ? 0.3 : 1.0)
36+
.opacity(isDisabled ? 0.32 : 1.0)
3737
.contentShape(Rectangle())
3838
}
3939

@@ -42,7 +42,7 @@ struct PrimaryButtonView: View {
4242
return AnyView(Color.gray6)
4343
}
4444
if isDisabled {
45-
return AnyView(Color.gray4)
45+
return AnyView(Color.clear)
4646
}
4747

4848
return AnyView(ButtonGradient(isPressed: isPressed))

Bitkit/Components/EmptyStateView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ struct EmptyStateView: View {
5959
.aspectRatio(contentMode: .fit)
6060
.foregroundColor(.textSecondary)
6161
.frame(width: 16, height: 16)
62+
.frame(width: 44, height: 44) // Increase hit area
6263
}
63-
.frame(width: 44, height: 44)
6464
.offset(x: 16, y: -16)
6565

6666
Spacer()

Bitkit/Components/Header.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ struct Header: View {
4343
.resizable()
4444
.foregroundColor(.textPrimary)
4545
.frame(width: 24, height: 24)
46+
.frame(width: 32, height: 32)
4647
}
47-
.frame(width: 32, height: 32)
4848
}
4949
}
5050
.frame(height: 48)

Bitkit/ViewModels/ActivityListViewModel.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,14 @@ class ActivityListViewModel: ObservableObject {
137137
selectedTags.removeAll()
138138
}
139139

140+
func resetFilters() {
141+
searchText = ""
142+
startDate = nil
143+
endDate = nil
144+
selectedTags.removeAll()
145+
selectedTab = .all
146+
}
147+
140148
private func updateFilteredActivities() async {
141149
do {
142150
// Convert dates to timestamps if they exist, ensuring start date is start of day and end date is end of day

Bitkit/ViewModels/Extensions/SettingsViewModel+PIN.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ extension SettingsViewModel {
6464
func resetPinSettings() {
6565
pinEnabled = false
6666
pinFailedAttempts = 0
67-
requirePinOnLaunch = true
68-
requirePinWhenIdle = false
6967
requirePinForPayments = false
7068
useBiometrics = false
7169
Logger.debug("PIN settings reset after app wipe", context: "SettingsViewModel")
@@ -80,8 +78,6 @@ extension SettingsViewModel {
8078

8179
if resetSettings {
8280
// Reset all PIN-related settings when PIN is disabled
83-
requirePinOnLaunch = true
84-
requirePinWhenIdle = false
8581
requirePinForPayments = false
8682
useBiometrics = false
8783
}

Bitkit/ViewModels/SettingsViewModel.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,14 @@ class SettingsViewModel: ObservableObject {
5858
@AppStorage("hideBalanceOnOpen") var hideBalanceOnOpen: Bool = false
5959
@AppStorage("readClipboard") var readClipboard: Bool = false
6060
@AppStorage("warnWhenSendingOver100") var warnWhenSendingOver100: Bool = false
61-
@AppStorage("requirePinOnLaunch") var requirePinOnLaunch: Bool = true
62-
@AppStorage("requirePinWhenIdle") var requirePinWhenIdle: Bool = false
63-
@AppStorage("requirePinForPayments") var requirePinForPayments: Bool = false
64-
@AppStorage("useBiometrics") var useBiometrics: Bool = false
6561
@AppStorage("enableQuickpay") var enableQuickpay: Bool = false
6662
@AppStorage("quickpayAmount") var quickpayAmount: Double = 5
6763

6864
// PIN Management
6965
@Published internal(set) var pinEnabled: Bool = false
7066
@AppStorage("pinFailedAttempts") var pinFailedAttempts: Int = 0
67+
@AppStorage("requirePinForPayments") var requirePinForPayments: Bool = false
68+
@AppStorage("useBiometrics") var useBiometrics: Bool = false
7169

7270
// Electrum Server Settings
7371
@Published var electrumHost: String = ""

Bitkit/Views/Settings/SecurityPrivacySettingsView.swift

Lines changed: 16 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ struct SecurityPrivacySettingsView: View {
66
@EnvironmentObject var sheets: SheetViewModel
77
@EnvironmentObject var settings: SettingsViewModel
88

9-
@State private var showPinCheckForLaunch = false
10-
@State private var showPinCheckForIdle = false
119
@State private var showPinCheckForPayments = false
1210
@State private var showingBiometricError = false
1311
@State private var biometricErrorMessage = ""
@@ -33,6 +31,7 @@ struct SecurityPrivacySettingsView: View {
3331
VStack(alignment: .leading, spacing: 0) {
3432
NavigationBar(title: t("settings__security__title"))
3533
.padding(.bottom, 16)
34+
.padding(.horizontal, 16)
3635

3736
ScrollView(showsIndicators: false) {
3837
VStack(alignment: .leading, spacing: 0) {
@@ -83,32 +82,6 @@ struct SecurityPrivacySettingsView: View {
8382
)
8483
}
8584

86-
Button {
87-
showPinCheckForLaunch = true
88-
} label: {
89-
SettingsListLabel(
90-
title: t("settings__security__pin_launch"),
91-
rightIcon: nil,
92-
toggle: Binding(
93-
get: { settings.requirePinOnLaunch },
94-
set: { _ in showPinCheckForLaunch = true }
95-
)
96-
)
97-
}
98-
99-
Button {
100-
showPinCheckForIdle = true
101-
} label: {
102-
SettingsListLabel(
103-
title: t("settings__security__pin_idle"),
104-
rightIcon: nil,
105-
toggle: Binding(
106-
get: { settings.requirePinWhenIdle },
107-
set: { _ in showPinCheckForIdle = true }
108-
)
109-
)
110-
}
111-
11285
Button {
11386
showPinCheckForPayments = true
11487
} label: {
@@ -122,50 +95,29 @@ struct SecurityPrivacySettingsView: View {
12295
)
12396
}
12497

125-
// Biometrics toggle with custom handling
126-
SettingsListLabel(
127-
title: t(
128-
"settings__security__use_bio",
129-
variables: ["biometryTypeName": biometryTypeName]
130-
),
131-
toggle: Binding(
132-
get: { settings.useBiometrics },
133-
set: { newValue in
134-
handleBiometricToggle(newValue)
135-
}
98+
if isBiometricAvailable {
99+
// Biometrics toggle with custom handling
100+
SettingsListLabel(
101+
title: t("settings__security__use_bio", variables: ["biometryTypeName": biometryTypeName]),
102+
toggle: Binding(
103+
get: { settings.useBiometrics },
104+
set: { newValue in
105+
handleBiometricToggle(newValue)
106+
}
107+
)
136108
)
137-
)
138109

139-
// Footer text for Biometrics
140-
BodySText(t("settings__security__footer", variables: ["biometryTypeName": biometryTypeName]))
141-
.padding(.top, 16)
110+
// Footer text for Biometrics
111+
BodySText(t("settings__security__footer", variables: ["biometryTypeName": biometryTypeName]))
112+
.padding(.top, 16)
113+
}
142114
}
143115
}
116+
.padding(.horizontal, 16)
144117
.bottomSafeAreaPadding()
145118
}
146119
}
147120
.navigationBarHidden(true)
148-
.padding(.horizontal, 16)
149-
.navigationDestination(isPresented: $showPinCheckForLaunch) {
150-
PinCheckView(
151-
title: t("security__pin_enter"),
152-
explanation: "",
153-
onCancel: {},
154-
onPinVerified: { _ in
155-
settings.requirePinOnLaunch.toggle()
156-
}
157-
)
158-
}
159-
.navigationDestination(isPresented: $showPinCheckForIdle) {
160-
PinCheckView(
161-
title: t("security__pin_enter"),
162-
explanation: "",
163-
onCancel: {},
164-
onPinVerified: { _ in
165-
settings.requirePinWhenIdle.toggle()
166-
}
167-
)
168-
}
169121
.navigationDestination(isPresented: $showPinCheckForPayments) {
170122
PinCheckView(
171123
title: t("security__pin_enter"),
@@ -189,12 +141,6 @@ struct SecurityPrivacySettingsView: View {
189141
}
190142

191143
private func handleBiometricToggle(_ newValue: Bool) {
192-
if !isBiometricAvailable {
193-
// Biometrics not available - show setup sheet
194-
sheets.showSheet(.security, data: SecurityConfig(showLaterButton: false))
195-
return
196-
}
197-
198144
if newValue {
199145
// User wants to enable biometrics - request authentication
200146
requestBiometricPermission { success in

Bitkit/Views/SplashView.swift

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
import SwiftUI
22

3+
// Custom splash screen overlay - provides smooth fade transition from launch screen
4+
// while wallet data loads. Fades out after 0.2s and removes after 0.4s.
5+
36
struct SplashView: View {
47
var body: some View {
5-
Image("Splash")
6-
.resizable()
7-
.scaledToFill()
8-
.offset(x: -4, y: -6)
9-
.scaleEffect(0.99)
10-
.ignoresSafeArea()
8+
GeometryReader { geometry in
9+
Image("Splash")
10+
.resizable()
11+
.scaledToFill()
12+
.frame(width: geometry.size.width, height: geometry.size.height)
13+
.clipped()
14+
}
15+
.ignoresSafeArea()
1116
}
1217
}
1318

Bitkit/Views/Wallets/Activity/AllActivityView.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ struct AllActivityView: View {
6767
}
6868
)
6969
}
70+
.scrollDismissesKeyboard(.interactively)
7071
.refreshable {
7172
do {
7273
try await wallet.sync()
@@ -80,6 +81,9 @@ struct AllActivityView: View {
8081
.navigationBarHidden(true)
8182
.padding(.horizontal, 16)
8283
.bottomSafeAreaPadding()
84+
.onAppear {
85+
activity.resetFilters()
86+
}
8387
}
8488
}
8589

0 commit comments

Comments
 (0)