Reportage/Views/LockView.swift (1606B)
1import SwiftUI
2
3
4
5struct CoverView: View {
6 let lock: AppLock
7
8 var body: some View {
9 if lock.isLocked {
10 LockView(lock: lock)
11 } else {
12 Rectangle()
13 .fill(.ultraThickMaterial)
14 .ignoresSafeArea()
15 }
16 }
17}
18
19
20struct LockView: View {
21 let lock: AppLock
22
23 var body: some View {
24 VStack(spacing: Theme.promptGap) {
25 Spacer()
26 Text("Reportage\(Text(".").foregroundStyle(Theme.mark))", comment: "The app's name on the lock screen, with a coloured full stop")
27 .screenTitle()
28 .accessibilityLabel(Text("Reportage"))
29 Spacer()
30 Button {
31 Task { await lock.unlock() }
32 } label: {
33 Text("Unlock with \(Text(lock.methodName))", comment: "Unlocks the app; the method is Face ID, Touch ID or Passcode")
34 .font(.body.weight(.semibold))
35 .foregroundStyle(Theme.onAccent)
36 .frame(maxWidth: .infinity, minHeight: 52)
37 .background(Theme.accent, in: .capsule)
38 }
39 .buttonStyle(.plain)
40 .padding(.horizontal, Theme.margin)
41 .padding(.vertical, 12)
42 }
43 .frame(maxWidth: .infinity, maxHeight: .infinity)
44 .background(Theme.paper)
45 .foregroundStyle(Theme.ink)
46 }
47}