From ebf36c62517bb408ffcdd7b67bf607a375f39958 Mon Sep 17 00:00:00 2001 From: Ryan ZHAO <> Date: Mon, 29 Jan 2024 15:24:38 +1100 Subject: [PATCH] minor update on buttons and QR code to look better on iPad --- .../InviteAFriendScreen.swift | 5 +- Session/Settings/RecoveryPasswordScreen.swift | 6 +- Session/Utilities/QRCode.swift | 73 ++++++++++--------- 3 files changed, 45 insertions(+), 39 deletions(-) diff --git a/Session/Home/New Conversation/InviteAFriendScreen.swift b/Session/Home/New Conversation/InviteAFriendScreen.swift index 45ad027e2..b3f9c50ac 100644 --- a/Session/Home/New Conversation/InviteAFriendScreen.swift +++ b/Session/Home/New Conversation/InviteAFriendScreen.swift @@ -12,7 +12,6 @@ struct InviteAFriendScreen: View { private let accountId: String = getUserHexEncodedPublicKey() static private let cornerRadius: CGFloat = 13 - static private let buttonWidth: CGFloat = 160 var body: some View { ZStack(alignment: .center) { @@ -58,7 +57,7 @@ struct InviteAFriendScreen: View { .font(.system(size: Values.mediumFontSize)) .foregroundColor(themeColor: .textPrimary) .frame( - maxWidth: Self.buttonWidth, + maxWidth: .infinity, minHeight: Values.mediumButtonHeight, alignment: .center ) @@ -80,7 +79,7 @@ struct InviteAFriendScreen: View { .font(.system(size: Values.mediumFontSize)) .foregroundColor(themeColor: .textPrimary) .frame( - maxWidth: Self.buttonWidth, + maxWidth: .infinity, minHeight: Values.mediumButtonHeight, alignment: .center ) diff --git a/Session/Settings/RecoveryPasswordScreen.swift b/Session/Settings/RecoveryPasswordScreen.swift index 322a08c59..e9f1df318 100644 --- a/Session/Settings/RecoveryPasswordScreen.swift +++ b/Session/Settings/RecoveryPasswordScreen.swift @@ -14,7 +14,7 @@ struct RecoveryPasswordScreen: View { static private let cornerRadius: CGFloat = 13 static private let backgroundCornerRadius: CGFloat = 17 - static private let buttonWidth: CGFloat = 130 + static private let buttonWidth: CGFloat = UIDevice.current.isIPad ? Values.iPadButtonWidth : 130 public init() throws { self.mnemonic = try Identity.mnemonic() @@ -136,7 +136,7 @@ struct RecoveryPasswordScreen: View { .font(.system(size: Values.verySmallFontSize)) .foregroundColor(themeColor: .textPrimary) .frame( - maxWidth: Self.buttonWidth, + maxWidth: .infinity, minHeight: Values.mediumSmallButtonHeight, alignment: .center ) @@ -157,7 +157,7 @@ struct RecoveryPasswordScreen: View { .font(.system(size: Values.verySmallFontSize)) .foregroundColor(themeColor: .textPrimary) .frame( - maxWidth: Self.buttonWidth, + maxWidth: .infinity, minHeight: Values.mediumSmallButtonHeight, alignment: .center ) diff --git a/Session/Utilities/QRCode.swift b/Session/Utilities/QRCode.swift index f29413837..eec5d452c 100644 --- a/Session/Utilities/QRCode.swift +++ b/Session/Utilities/QRCode.swift @@ -73,41 +73,48 @@ struct QRCodeView: View { var body: some View { ZStack(alignment: .center) { - RoundedRectangle(cornerRadius: Self.cornerRadius) - .fill(themeColor: backgroundThemeColor) - - Image(uiImage: QRCode.generate(for: string, hasBackground: hasBackground)) - .resizable() - .renderingMode(.template) - .foregroundColor(themeColor: qrCodeThemeColor) - .scaledToFit() - .frame( - maxWidth: .infinity, - maxHeight: .infinity - ) - .padding(.vertical, Values.smallSpacing) - - if let logo = logo { - ZStack(alignment: .center) { - Rectangle() - .fill(themeColor: backgroundThemeColor) - - Image(logo) - .resizable() - .renderingMode(.template) - .foregroundColor(themeColor: qrCodeThemeColor) - .scaledToFit() - .frame( - maxWidth: .infinity, - maxHeight: .infinity - ) - .padding(.all, 4) + ZStack(alignment: .center) { + RoundedRectangle(cornerRadius: Self.cornerRadius) + .fill(themeColor: backgroundThemeColor) + + Image(uiImage: QRCode.generate(for: string, hasBackground: hasBackground)) + .resizable() + .renderingMode(.template) + .foregroundColor(themeColor: qrCodeThemeColor) + .scaledToFit() + .frame( + maxWidth: .infinity, + maxHeight: .infinity + ) + .padding(.vertical, Values.smallSpacing) + + if let logo = logo { + ZStack(alignment: .center) { + Rectangle() + .fill(themeColor: backgroundThemeColor) + + Image(logo) + .resizable() + .renderingMode(.template) + .foregroundColor(themeColor: qrCodeThemeColor) + .scaledToFit() + .frame( + maxWidth: .infinity, + maxHeight: .infinity + ) + .padding(.all, 4) + } + .frame( + width: Self.logoSize, + height: Self.logoSize + ) } - .frame( - width: Self.logoSize, - height: Self.logoSize - ) } + .frame( + maxWidth: 400, + maxHeight: 400 + ) } + .frame(maxWidth: .infinity) } }