polish qrcode theme color

pull/891/head
Ryan Zhao 1 year ago
parent 0632514d45
commit 44c8f21628

@ -1 +1 @@
Subproject commit e3ccf29db08aaf0b9bb6bbe72ae5967cd183a78d
Subproject commit 577feacbfe4a523c5dc743335e187bf11062120c

@ -13,8 +13,9 @@ struct RecoveryPasswordView: View {
private let mnemonic: String
private let flow: Onboarding.Flow
static let cornerRadius: CGFloat = 13
static private let cornerRadius: CGFloat = 13
static private let backgroundCornerRadius: CGFloat = 17
static private let buttonWidth: CGFloat = 120
public init(flow: Onboarding.Flow) throws {
self.mnemonic = try Identity.mnemonic()
@ -71,11 +72,13 @@ struct RecoveryPasswordView: View {
.font(.system(size: Values.smallFontSize))
.foregroundColor(themeColor: .textPrimary)
.padding(.bottom, Values.mediumSpacing)
.fixedSize(horizontal: false, vertical: true)
Text("recovery_password_explanation_2".localized())
.font(.system(size: Values.smallFontSize))
.foregroundColor(themeColor: .textPrimary)
.padding(.bottom, Values.mediumSpacing)
.fixedSize(horizontal: false, vertical: true)
if self.showQRCode {
QRCodeView(
@ -95,7 +98,7 @@ struct RecoveryPasswordView: View {
.font(.system(size: Values.verySmallFontSize))
.foregroundColor(themeColor: .textPrimary)
.frame(
maxWidth: 120,
maxWidth: Self.buttonWidth,
maxHeight: Values.mediumSmallButtonHeight,
alignment: .center
)
@ -142,8 +145,8 @@ struct RecoveryPasswordView: View {
.font(.system(size: Values.verySmallFontSize))
.foregroundColor(themeColor: .textPrimary)
.frame(
maxWidth: .infinity,
maxHeight: Values.mediumSmallButtonHeight,
maxWidth: Self.buttonWidth,
minHeight: Values.mediumSmallButtonHeight,
alignment: .center
)
.overlay(
@ -163,8 +166,8 @@ struct RecoveryPasswordView: View {
.font(.system(size: Values.verySmallFontSize))
.foregroundColor(themeColor: .textPrimary)
.frame(
maxWidth: .infinity,
maxHeight: Values.mediumSmallButtonHeight,
maxWidth: Self.buttonWidth,
minHeight: Values.mediumSmallButtonHeight,
alignment: .center
)
.overlay(

@ -51,18 +51,35 @@ struct QRCodeView: View {
let hasBackground: Bool
let hasLogo: Bool
let themeStyle: UIUserInterfaceStyle
var backgroundThemeColor: ThemeValue {
switch themeStyle {
case .light:
return .backgroundSecondary
default:
return .textPrimary
}
}
var qrCodeThemeColor: ThemeValue {
switch themeStyle {
case .light:
return .textPrimary
default:
return .backgroundPrimary
}
}
static private var cornerRadius: CGFloat = 10
static private var logoSize: CGFloat = 66
var body: some View {
ZStack(alignment: .center) {
RoundedRectangle(cornerRadius: Self.cornerRadius)
.fill(themeColor: .textPrimary)
.fill(themeColor: backgroundThemeColor)
Image(uiImage: QRCode.generate(for: string, hasBackground: hasBackground))
.resizable()
.renderingMode(.template)
.foregroundColor(themeColor: .backgroundPrimary)
.foregroundColor(themeColor: qrCodeThemeColor)
.scaledToFit()
.frame(
maxWidth: .infinity,
@ -73,12 +90,12 @@ struct QRCodeView: View {
if hasLogo {
ZStack(alignment: .center) {
Rectangle()
.fill(themeColor: .textPrimary)
.fill(themeColor: backgroundThemeColor)
Image("SessionShieldFilled")
.resizable()
.renderingMode(.template)
.foregroundColor(themeColor: .backgroundPrimary)
.foregroundColor(themeColor: qrCodeThemeColor)
.scaledToFit()
.frame(
maxWidth: .infinity,
@ -87,8 +104,8 @@ struct QRCodeView: View {
.padding(.all, 4)
}
.frame(
width: 66,
height: 66
width: Self.logoSize,
height: Self.logoSize
)
}
}

Loading…
Cancel
Save