From b5d187c52f2ed3cddec4ae449a9aba9a8d48b9fc Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Thu, 6 Jan 2022 15:56:03 +0100 Subject: [PATCH] Add help link for adding Invidious account --- Shared/Settings/AccountForm.swift | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Shared/Settings/AccountForm.swift b/Shared/Settings/AccountForm.swift index 6b0dca3a..9e1a0158 100644 --- a/Shared/Settings/AccountForm.swift +++ b/Shared/Settings/AccountForm.swift @@ -16,6 +16,7 @@ struct AccountForm: View { @State private var validationDebounce = Debounce() @Environment(\.colorScheme) private var colorScheme + @Environment(\.openURL) private var openURL @Environment(\.presentationMode) private var presentationMode var body: some View { @@ -62,6 +63,10 @@ struct AccountForm: View { #if os(macOS) .padding(.horizontal) #endif + + #if os(iOS) + helpButton + #endif } #else formFields @@ -71,6 +76,22 @@ struct AccountForm: View { .onChange(of: password) { _ in validate() } } + var helpButton: some View { + Group { + if instance.app == .invidious { + Button { + openURL(URL(string: "https://github.com/yattee/yattee/wiki/Adding-Invidious-instance-and-account")!) + } label: { + Label("How to add Invidious account?", systemImage: "questionmark.circle") + #if os(macOS) + .help("How to add Invidious account?") + .labelStyle(.iconOnly) + #endif + } + } + } + } + var formFields: some View { Group { if !instance.app.accountsUsePassword { @@ -105,6 +126,10 @@ struct AccountForm: View { Spacer() + #if os(macOS) + helpButton + #endif + Button("Save", action: submitForm) .disabled(!isValid) #if !os(tvOS)