Download this file
| 1 | import RastrilloApple |
| 2 | import SwiftUI |
| 3 | |
| 4 | /// A failed re-mint leaves the conversation mounted, with a way to retry. |
| 5 | public struct EquipoOficinaNotice: View { |
| 6 | private let app: EquipoAppModel |
| 7 | @ObservedObject private var model: OficinaIDModel |
| 8 | public init(model: EquipoAppModel) { app = model; self.model = model.oficina.model } |
| 9 | var message: String? { |
| 10 | if let error = app.oficina.error ?? model.error { return error } |
| 11 | if case .unavailable = model.step { return OficinaIDText.text("unavailable.title") } |
| 12 | return nil |
| 13 | } |
| 14 | public var body: some View { |
| 15 | if let error = message { |
| 16 | VStack(alignment: .leading, spacing: 8) { |
| 17 | OficinaErrorLine(error) |
| 18 | Button(String(localized: "oficina.retry", bundle: .module)) { |
| 19 | Task { |
| 20 | await app.oficina.renewIfNeeded() |
| 21 | await app.session?.refresh() |
| 22 | } |
| 23 | }.disabled(model.busy || app.oficina.busy) |
| 24 | } |
| 25 | .padding(12) |
| 26 | .frame(maxWidth: .infinity, alignment: .leading) |
| 27 | .background(.background) |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | |