Share Extension: account picker first, hidden folders follow the app's filter + unlock
The app now publishes every uploadable account, the active one, the three lock settings and each account's own hidden-files filter (ShareAccountSync). The sheet lists accounts first when there are several, asks for unlock to use a non-active account (login lock + account-switching lock), and shows hidden folders per the account's app setting behind the hidden-files unlock. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
0cda4a1241
commit
a37524e959
@@ -0,0 +1,19 @@
|
||||
import LocalAuthentication
|
||||
|
||||
/// Face ID / Touch ID with the device passcode as the fallback - the same
|
||||
/// policy the app's lock uses (`local_auth` with `biometricOnly: false`), so
|
||||
/// the share sheet asks for exactly what the app would.
|
||||
enum DeviceAuth {
|
||||
/// True only if the user actually authenticated; a cancel, a failure, or a
|
||||
/// device with nothing to authenticate with all count as "not unlocked".
|
||||
static func authenticate(reason: String) async -> Bool {
|
||||
let context = LAContext()
|
||||
var error: NSError?
|
||||
guard context.canEvaluatePolicy(.deviceOwnerAuthentication, error: &error) else { return false }
|
||||
return await withCheckedContinuation { continuation in
|
||||
context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: reason) { success, _ in
|
||||
continuation.resume(returning: success)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user