From d0041e87a23a3de11717a4b20a06a333607b8b21 Mon Sep 17 00:00:00 2001 From: Satindar Dhillon Date: Tue, 31 May 2022 11:52:16 -0700 Subject: [PATCH] use geometry reader to resolve auth button layout type --- .../Sources/App/Views/WelcomeView.swift | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/Views/WelcomeView.swift b/apple/OmnivoreKit/Sources/App/Views/WelcomeView.swift index 16c8eb95d..f137f5009 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WelcomeView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WelcomeView.swift @@ -63,6 +63,7 @@ struct WelcomeView: View { AppleSignInButton { viewModel.handleAppleSignInCompletion(result: $0, authenticator: authenticator) } + // set maxwidth = 260 if AppKeys.sharedInstance?.iosClientGoogleId != nil { GoogleAuthButton { @@ -70,28 +71,29 @@ struct WelcomeView: View { } } } - return VStack(alignment: .center, spacing: 16) { - if horizontalSizeClass == .regular { - HStack { buttonGroup } - } else { - buttonGroup - } + return GeometryReader { geo in + VStack(alignment: .center, spacing: 16) { + if geo.size.width > 600 { + HStack { buttonGroup } + } else { + buttonGroup + } - if let loginError = viewModel.loginError { - LoginErrorMessageView(loginError: loginError) + if let loginError = viewModel.loginError { + LoginErrorMessageView(loginError: loginError) + } } - } + }.background(Color.red) } var compactContent: some View { - VStack(alignment: .leading) { + VStack(alignment: .leading, spacing: 50) { logoView - Spacer() + .padding(.bottom, 20) headlineView - Spacer() authProviderButtonStack - Spacer() footerView + Spacer() } .padding() }