Skip to content

Commit aaca37e

Browse files
author
Achyut Kumar M
committed
rename
1 parent 5682768 commit aaca37e

File tree

2 files changed

+43
-26
lines changed

2 files changed

+43
-26
lines changed

GoInfoGame/GoInfoGame.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@
232232
FAD5C5162AFCBE720040C61A /* GoInfoGameUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAD5C5152AFCBE720040C61A /* GoInfoGameUITestsLaunchTests.swift */; };
233233
FAE2584F2D39819300D2BB12 /* ManageQuestsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAE2584E2D39819300D2BB12 /* ManageQuestsView.swift */; };
234234
FAE258522D3A780F00D2BB12 /* FloatingActionButtonStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAE258512D3A780F00D2BB12 /* FloatingActionButtonStack.swift */; };
235-
FAE481A22DD5EF3800149A48 /* PasswordAuthenticationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAE481A12DD5EF2C00149A48 /* PasswordAuthenticationView.swift */; };
235+
FAE481A22DD5EF3800149A48 /* PasswordAuthenticationPopupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAE481A12DD5EF2C00149A48 /* PasswordAuthenticationPopupView.swift */; };
236236
FAE481A42DD5F97800149A48 /* PasswordAuthenticationViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAE481A32DD5F96E00149A48 /* PasswordAuthenticationViewModel.swift */; };
237237
FAEE21DB2DCA1963002F9BEC /* UndoButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAEE21DA2DCA1963002F9BEC /* UndoButton.swift */; };
238238
FAF44FBD2B3084EC004FE664 /* OnboardingView1.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAF44FBC2B3084EC004FE664 /* OnboardingView1.swift */; };
@@ -565,7 +565,7 @@
565565
FAD5C5152AFCBE720040C61A /* GoInfoGameUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoInfoGameUITestsLaunchTests.swift; sourceTree = "<group>"; };
566566
FAE2584E2D39819300D2BB12 /* ManageQuestsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ManageQuestsView.swift; sourceTree = "<group>"; };
567567
FAE258512D3A780F00D2BB12 /* FloatingActionButtonStack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FloatingActionButtonStack.swift; sourceTree = "<group>"; };
568-
FAE481A12DD5EF2C00149A48 /* PasswordAuthenticationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasswordAuthenticationView.swift; sourceTree = "<group>"; };
568+
FAE481A12DD5EF2C00149A48 /* PasswordAuthenticationPopupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasswordAuthenticationPopupView.swift; sourceTree = "<group>"; };
569569
FAE481A32DD5F96E00149A48 /* PasswordAuthenticationViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasswordAuthenticationViewModel.swift; sourceTree = "<group>"; };
570570
FAEE21DA2DCA1963002F9BEC /* UndoButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UndoButton.swift; sourceTree = "<group>"; };
571571
FAF44FBC2B3084EC004FE664 /* OnboardingView1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingView1.swift; sourceTree = "<group>"; };
@@ -1526,7 +1526,7 @@
15261526
children = (
15271527
FA633CB52DD48C3F00324404 /* SessionManager.swift */,
15281528
FA633CB32DD4842D00324404 /* BiometricAuthManager.swift */,
1529-
FAE481A12DD5EF2C00149A48 /* PasswordAuthenticationView.swift */,
1529+
FAE481A12DD5EF2C00149A48 /* PasswordAuthenticationPopupView.swift */,
15301530
FAE481A32DD5F96E00149A48 /* PasswordAuthenticationViewModel.swift */,
15311531
FAFDA2002C6D338400ECEAE9 /* ViewModel */,
15321532
FAFDA1FD2C6D335300ECEAE9 /* Model */,
@@ -2188,7 +2188,7 @@
21882188
A4B83AF32B5F9385006684CA /* StoredWay.swift in Sources */,
21892189
FA18CAE52CC7D0DD008247F2 /* SequenceModel.swift in Sources */,
21902190
971F9FDF2B847349005397CC /* CrossingIslandForm.swift in Sources */,
2191-
FAE481A22DD5EF3800149A48 /* PasswordAuthenticationView.swift in Sources */,
2191+
FAE481A22DD5EF3800149A48 /* PasswordAuthenticationPopupView.swift in Sources */,
21922192
05DBBB5F2B1263FF00B6F110 /* DatabaseConnector.swift in Sources */,
21932193
FAF44FC12B30850A004FE664 /* OnboardingView3.swift in Sources */,
21942194
97439F7A2B87447400DA43E1 /* CrossingKerbHeight.swift in Sources */,

GoInfoGame/GoInfoGame/Login/PasswordAuthenticationView.swift renamed to GoInfoGame/GoInfoGame/Login/PasswordAuthenticationPopupView.swift

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// PasswordAuthenticationView.swift
2+
// PasswordAuthenticationPopupView.swift
33
// GoInfoGame
44
//
55
// Created by Achyut Kumar M on 15/05/25.
@@ -8,73 +8,90 @@
88
import SwiftUI
99
import LocalAuthentication
1010

11-
struct PasswordAuthenticationView: View {
11+
import SwiftUI
12+
13+
struct PasswordAuthenticationPopupView: View {
1214
let onSuccess: () -> Void
1315
let onCancel: () -> Void
14-
16+
1517
@StateObject private var viewModel = PasswordAuthenticationViewModel()
16-
18+
1719
var body: some View {
1820
ZStack {
19-
Color.black.opacity(0.4).ignoresSafeArea()
20-
21+
Color.black.opacity(0.4)
22+
.ignoresSafeArea()
23+
.onTapGesture {
24+
onCancel()
25+
}
26+
2127
VStack(spacing: 16) {
22-
Text("Enter Password")
28+
Text("Enable Biometric Login")
2329
.font(.headline)
24-
30+
2531
SecureField("Enter your password", text: $viewModel.password)
2632
.textContentType(.password)
2733
.padding()
2834
.background(Color(.systemGray6))
2935
.cornerRadius(8)
30-
36+
3137
if !viewModel.errorMessage.isEmpty {
3238
Text(viewModel.errorMessage)
3339
.foregroundColor(.red)
3440
.font(.caption)
3541
}
36-
42+
3743
Button("Continue") {
3844
handleContinue()
3945
}
40-
.padding()
4146
.frame(maxWidth: .infinity)
47+
.padding()
4248
.background(Color.blue)
4349
.foregroundColor(.white)
4450
.cornerRadius(8)
45-
46-
Button("Cancel") {
51+
52+
Button("Cancel") {
4753
onCancel()
4854
}
55+
.foregroundColor(.gray)
4956
.padding(.top, 4)
5057
}
5158
.padding()
5259
.background(Color.white)
5360
.cornerRadius(16)
54-
.padding(40)
55-
61+
.padding(.horizontal, 40)
62+
5663
if viewModel.isLoading {
5764
ProgressView("Logging in...")
5865
.frame(maxWidth: .infinity, maxHeight: .infinity)
5966
.background(Color.black.opacity(0.3).ignoresSafeArea())
6067
}
6168
}
6269
}
63-
70+
6471
private func handleContinue() {
6572
let environment = APIConfiguration.shared.environment
66-
let username = KeychainManager.load(.username, for: environment) ?? ""
67-
viewModel.performBiometricEnrollment(username: username, environment: environment) {
68-
69-
} onFailure: {
70-
73+
guard let username = KeychainManager.load(.username, for: environment) else {
74+
viewModel.errorMessage = "Username not found"
75+
return
7176
}
77+
78+
viewModel.performBiometricEnrollment(
79+
username: username,
80+
environment: environment,
81+
onSuccess: {
82+
onSuccess()
83+
},
84+
onFailure: {
85+
viewModel.errorMessage = "Failed to enroll"
86+
}
87+
)
7288
}
7389
}
7490

7591

92+
7693
#Preview {
77-
PasswordAuthenticationView(
94+
PasswordAuthenticationPopupView(
7895
onSuccess: {
7996
print("Biometric setup successful")
8097
},

0 commit comments

Comments
 (0)