Skip to content

Commit 0414e92

Browse files
author
Achyut Kumar M
committed
add BiometricToggleView to project
1 parent aaca37e commit 0414e92

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

GoInfoGame/GoInfoGame.xcodeproj/project.pbxproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@
234234
FAE258522D3A780F00D2BB12 /* FloatingActionButtonStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAE258512D3A780F00D2BB12 /* FloatingActionButtonStack.swift */; };
235235
FAE481A22DD5EF3800149A48 /* PasswordAuthenticationPopupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAE481A12DD5EF2C00149A48 /* PasswordAuthenticationPopupView.swift */; };
236236
FAE481A42DD5F97800149A48 /* PasswordAuthenticationViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAE481A32DD5F96E00149A48 /* PasswordAuthenticationViewModel.swift */; };
237+
FAE481A62DDB22DB00149A48 /* BiometricToggleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAE481A52DDB22D400149A48 /* BiometricToggleView.swift */; };
237238
FAEE21DB2DCA1963002F9BEC /* UndoButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAEE21DA2DCA1963002F9BEC /* UndoButton.swift */; };
238239
FAF44FBD2B3084EC004FE664 /* OnboardingView1.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAF44FBC2B3084EC004FE664 /* OnboardingView1.swift */; };
239240
FAF44FBF2B3084FB004FE664 /* OnboardingView2.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAF44FBE2B3084FB004FE664 /* OnboardingView2.swift */; };
@@ -567,6 +568,7 @@
567568
FAE258512D3A780F00D2BB12 /* FloatingActionButtonStack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FloatingActionButtonStack.swift; sourceTree = "<group>"; };
568569
FAE481A12DD5EF2C00149A48 /* PasswordAuthenticationPopupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasswordAuthenticationPopupView.swift; sourceTree = "<group>"; };
569570
FAE481A32DD5F96E00149A48 /* PasswordAuthenticationViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasswordAuthenticationViewModel.swift; sourceTree = "<group>"; };
571+
FAE481A52DDB22D400149A48 /* BiometricToggleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BiometricToggleView.swift; sourceTree = "<group>"; };
570572
FAEE21DA2DCA1963002F9BEC /* UndoButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UndoButton.swift; sourceTree = "<group>"; };
571573
FAF44FBC2B3084EC004FE664 /* OnboardingView1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingView1.swift; sourceTree = "<group>"; };
572574
FAF44FBE2B3084FB004FE664 /* OnboardingView2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingView2.swift; sourceTree = "<group>"; };
@@ -1527,6 +1529,7 @@
15271529
FA633CB52DD48C3F00324404 /* SessionManager.swift */,
15281530
FA633CB32DD4842D00324404 /* BiometricAuthManager.swift */,
15291531
FAE481A12DD5EF2C00149A48 /* PasswordAuthenticationPopupView.swift */,
1532+
FAE481A52DDB22D400149A48 /* BiometricToggleView.swift */,
15301533
FAE481A32DD5F96E00149A48 /* PasswordAuthenticationViewModel.swift */,
15311534
FAFDA2002C6D338400ECEAE9 /* ViewModel */,
15321535
FAFDA1FD2C6D335300ECEAE9 /* Model */,
@@ -1879,10 +1882,14 @@
18791882
inputFileListPaths = (
18801883
"${PODS_ROOT}/Target Support Files/Pods-GoInfoGame/Pods-GoInfoGame-frameworks-${CONFIGURATION}-input-files.xcfilelist",
18811884
);
1885+
inputPaths = (
1886+
);
18821887
name = "[CP] Embed Pods Frameworks";
18831888
outputFileListPaths = (
18841889
"${PODS_ROOT}/Target Support Files/Pods-GoInfoGame/Pods-GoInfoGame-frameworks-${CONFIGURATION}-output-files.xcfilelist",
18851890
);
1891+
outputPaths = (
1892+
);
18861893
runOnlyForDeploymentPostprocessing = 0;
18871894
shellPath = /bin/sh;
18881895
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-GoInfoGame/Pods-GoInfoGame-frameworks.sh\"\n";
@@ -1962,10 +1969,14 @@
19621969
inputFileListPaths = (
19631970
"${PODS_ROOT}/Target Support Files/Pods-GoInfoGame-GoInfoGameUITests/Pods-GoInfoGame-GoInfoGameUITests-frameworks-${CONFIGURATION}-input-files.xcfilelist",
19641971
);
1972+
inputPaths = (
1973+
);
19651974
name = "[CP] Embed Pods Frameworks";
19661975
outputFileListPaths = (
19671976
"${PODS_ROOT}/Target Support Files/Pods-GoInfoGame-GoInfoGameUITests/Pods-GoInfoGame-GoInfoGameUITests-frameworks-${CONFIGURATION}-output-files.xcfilelist",
19681977
);
1978+
outputPaths = (
1979+
);
19691980
runOnlyForDeploymentPostprocessing = 0;
19701981
shellPath = /bin/sh;
19711982
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-GoInfoGame-GoInfoGameUITests/Pods-GoInfoGame-GoInfoGameUITests-frameworks.sh\"\n";
@@ -2236,6 +2247,7 @@
22362247
B0CCB98C2B8626AE00AA73DE /* ProfileView.swift in Sources */,
22372248
FAF44FBD2B3084EC004FE664 /* OnboardingView1.swift in Sources */,
22382249
973FC01D2B4FEE1B00878269 /* YesNoView.swift in Sources */,
2250+
FAE481A62DDB22DB00149A48 /* BiometricToggleView.swift in Sources */,
22392251
);
22402252
runOnlyForDeploymentPostprocessing = 0;
22412253
};
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//
2+
// BiometricToggleView.swift
3+
// GoInfoGame
4+
//
5+
// Created by Achyut Kumar M on 19/05/25.
6+
//
7+
8+
import SwiftUI
9+
import LocalAuthentication
10+
11+
struct BiometricToggleView: View {
12+
@Binding var isEnabled: Bool
13+
let onToggleOn: () -> Void
14+
15+
private var biometricToggleText: String {
16+
let context = LAContext()
17+
_ = context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil)
18+
return context.biometryType == .faceID ? "Use Face ID for Login" :
19+
context.biometryType == .touchID ? "Use Touch ID for Login" :
20+
"Use Biometric Login"
21+
}
22+
23+
var body: some View {
24+
Toggle(isOn: Binding(
25+
get: { isEnabled },
26+
set: { newValue in
27+
let wasOff = !isEnabled
28+
isEnabled = newValue
29+
if newValue && wasOff {
30+
// User turned it on manually
31+
onToggleOn()
32+
}
33+
}
34+
)) {
35+
Text(biometricToggleText)
36+
}
37+
}
38+
}
39+

0 commit comments

Comments
 (0)