Download this file
| 1 | import RastrilloApple |
| 2 | import SwiftUI |
| 3 | |
| 4 | /// Both platforms use the kit's full onboarding, with pairing as an explicit route. |
| 5 | public struct EquipoSignInView: View { |
| 6 | let app: EquipoAppModel |
| 7 | public init(model: EquipoAppModel) { app = model } |
| 8 | public var body: some View { |
| 9 | if app.showingPairing { |
| 10 | PairingView(model: app) |
| 11 | .safeAreaInset(edge: .bottom) { |
| 12 | Button(String(localized: "oficina.sign_in", bundle: .module)) { |
| 13 | Task { await app.useOficinaID() } |
| 14 | }.padding() |
| 15 | } |
| 16 | } else { |
| 17 | EquipoOnboarding(app: app, model: app.oficina.model) |
| 18 | } |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | private struct EquipoOnboarding: View { |
| 23 | let app: EquipoAppModel |
| 24 | @ObservedObject var model: OficinaIDModel |
| 25 | var body: some View { |
| 26 | Group { |
| 27 | if case .signedIn = model.step { |
| 28 | VStack(spacing: 16) { |
| 29 | if let error = app.oficina.error { |
| 30 | Text(error) |
| 31 | Button(String(localized: "oficina.retry", bundle: .module)) { |
| 32 | Task { await app.oficina.synchronize() } |
| 33 | } |
| 34 | } else { |
| 35 | ProgressView(String(localized: "oficina.connecting", bundle: .module)) |
| 36 | } |
| 37 | Button(OficinaIDText.text("otherWays")) { app.otherWays() } |
| 38 | Button(OficinaIDText.text("signOut", model.identity?.label ?? ""), role: .destructive) { |
| 39 | app.oficina.signOut() |
| 40 | } |
| 41 | }.padding(24) |
| 42 | } else { |
| 43 | OficinaOnboardingView(model: model, otherWays: { app.otherWays() }) |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | |