-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ABW-3692] Option to require biometrics check #1286
Changes from all commits
504c3e1
be8549f
6a333aa
66b60be
75dc1c8
9f534fd
fb50677
41db92b
33e260b
27d8c4f
9a12015
493531e
860de6a
f929af9
9a36d11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,28 @@ | ||
|
||
// MARK: - LocalAuthenticationClient | ||
|
||
/// A client for querying if passcode and biometrics are set up. | ||
public struct LocalAuthenticationClient: Sendable { | ||
/// The return value (`LocalAuthenticationConfig`) might be `nil` if app goes to background or stuff like that. | ||
public typealias QueryConfig = @Sendable () throws -> LocalAuthenticationConfig | ||
|
||
public var queryConfig: QueryConfig | ||
public var authenticateWithBiometrics: AuthenticateWithBiometrics | ||
public var setAuthenticatedSuccessfully: SetAuthenticatedSuccessfully | ||
public var authenticatedSuccessfully: AuthenticatedSuccessfully | ||
|
||
public init(queryConfig: @escaping QueryConfig) { | ||
public init( | ||
queryConfig: @escaping QueryConfig, | ||
authenticateWithBiometrics: @escaping AuthenticateWithBiometrics, | ||
setAuthenticatedSuccessfully: @escaping SetAuthenticatedSuccessfully, | ||
authenticatedSuccessfully: @escaping AuthenticatedSuccessfully | ||
) { | ||
self.queryConfig = queryConfig | ||
self.authenticateWithBiometrics = authenticateWithBiometrics | ||
self.setAuthenticatedSuccessfully = setAuthenticatedSuccessfully | ||
self.authenticatedSuccessfully = authenticatedSuccessfully | ||
} | ||
} | ||
|
||
extension LocalAuthenticationClient { | ||
/// The return value (`LocalAuthenticationConfig`) might be `nil` if app goes to background or stuff like that. | ||
public typealias QueryConfig = @Sendable () throws -> LocalAuthenticationConfig | ||
public typealias AuthenticateWithBiometrics = @Sendable () async throws -> Bool | ||
public typealias SetAuthenticatedSuccessfully = @Sendable () -> Void | ||
public typealias AuthenticatedSuccessfully = @Sendable () -> AnyAsyncSequence<Void> | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
|
||
// MARK: - ToggleView | ||
public struct ToggleView: SwiftUI.View { | ||
public let context: Context | ||
public let icon: ImageAsset? | ||
public let title: String | ||
public let subtitle: String | ||
public let minHeight: CGFloat | ||
public let isOn: Binding<Bool> | ||
|
||
public init( | ||
context: Context = .toggle, | ||
icon: ImageAsset? = nil, | ||
title: String, | ||
subtitle: String, | ||
minHeight: CGFloat = .largeButtonHeight, | ||
isOn: Binding<Bool> | ||
) { | ||
self.context = context | ||
self.icon = icon | ||
self.title = title | ||
self.subtitle = subtitle | ||
|
@@ -30,10 +33,27 @@ public struct ToggleView: SwiftUI.View { | |
.padding(.trailing, .medium3) | ||
} | ||
|
||
PlainListRowCore(context: .toggle, title: title, subtitle: subtitle) | ||
PlainListRowCore(context: context.plainListRowContext, title: title, subtitle: subtitle) | ||
} | ||
} | ||
) | ||
.frame(maxWidth: .infinity, minHeight: minHeight) | ||
} | ||
} | ||
|
||
// MARK: ToggleView.Context | ||
extension ToggleView { | ||
public enum Context { | ||
case settings | ||
case toggle | ||
} | ||
} | ||
|
||
extension ToggleView.Context { | ||
var plainListRowContext: PlainListRowCore.ViewState.Context { | ||
switch self { | ||
case .settings: .settings | ||
case .toggle: .toggle | ||
} | ||
} | ||
Comment on lines
+53
to
+57
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need this ?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For toggle views in Preferences, we need to use I explicitly defined There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh I see now, thanks for explanation |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "advancedLock.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The title font for the
toggle
context didn't match the design.