gemenon

[ACTIVE] The Safari of the Gemini ecosystem
git clone git://git.figbert.com/gemenon.git
Log | Files | Refs

commit 3afa8e002a3269ab6905c5fbc95ec4201913c73a
parent 734bec213c17c671ccf1cc4f58c20808be278800
Author: FIGBERT <figbert@figbert.com>
Date:   Fri, 30 Sep 2022 22:06:13 -0700

Add support for failure statuses

Diffstat:
MShared/CapsuleView.swift | 23+++++++++++++++++++++++
1 file changed, 23 insertions(+), 0 deletions(-)

diff --git a/Shared/CapsuleView.swift b/Shared/CapsuleView.swift @@ -21,6 +21,10 @@ struct CapsuleView: View { SuccessView() case .TemporaryRedirect, .PermanentRedirect: RedirectView() + case .TemporaryFailure, .ServerUnavailable, .CGIError, + .ProxyError, .SlowDown, .PermanentFailure, + .NotFound, .Gone, .ProxyRequestRefused, .BadRequest: + FailureView() default: Text(data.tab.response?.status.description ?? "boop") } @@ -153,6 +157,25 @@ struct RedirectView: View { } } +struct FailureView: View { + @EnvironmentObject var data: BrowserData + var body: some View { + VStack { + Text(data.tab.response?.status.description ?? "Error") + .font(.system(size: 35, weight: .bold)) + if case .FailureInfo(let info) = data.tab.response?.header { + Text(info) + .font(.system(size: 15)) + .foregroundColor(.gray) + } else if case .Seconds(let seconds) = data.tab.response?.header { + Text("Please wait \(seconds) seconds before requesting again") + .font(.system(size: 15)) + .foregroundColor(.gray) + } + } + } +} + struct CapsuleView_Previews: PreviewProvider { static var previews: some View { CapsuleView()