From da640adefb84def01711255f3615cf2455956765 Mon Sep 17 00:00:00 2001 From: Dominik Kapusta Date: Thu, 7 Dec 2023 21:25:05 +0100 Subject: [PATCH] Always use black and white colors for the QR code (#2248) Task/Issue URL: https://app.asana.com/0/1201493110486074/1205142491450702/f Description: This is to increase compatibility with Android devices. --- .../SyncUI/Views/Internal/QRCodeView.swift | 15 +++------------ .../SyncUI/Views/SaveRecoveryKeyView.swift | 2 +- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/LocalPackages/SyncUI/Sources/SyncUI/Views/Internal/QRCodeView.swift b/LocalPackages/SyncUI/Sources/SyncUI/Views/Internal/QRCodeView.swift index ca1939e9e4..48374484f6 100644 --- a/LocalPackages/SyncUI/Sources/SyncUI/Views/Internal/QRCodeView.swift +++ b/LocalPackages/SyncUI/Sources/SyncUI/Views/Internal/QRCodeView.swift @@ -22,23 +22,14 @@ import UIKit import SwiftUI struct QRCodeView: View { - - enum Style { - - case light, dark - - } - let context = CIContext() let string: String let size: CGFloat - let style: Style - init(string: String, size: CGFloat, style: Style = .light) { + init(string: String, size: CGFloat) { self.string = string self.size = size - self.style = style } var body: some View { @@ -69,8 +60,8 @@ struct QRCodeView: View { } let colorParameters: [String: Any] = [ - "inputColor0": CIColor(color: style == .light ? .white : .black), - "inputColor1": CIColor(color: style == .light ? .black : .white) + "inputColor0": CIColor(color: .black), + "inputColor1": CIColor(color: .white) ] let coloredImage = outputImage.applyingFilter("CIFalseColor", parameters: colorParameters) diff --git a/LocalPackages/SyncUI/Sources/SyncUI/Views/SaveRecoveryKeyView.swift b/LocalPackages/SyncUI/Sources/SyncUI/Views/SaveRecoveryKeyView.swift index d4a5bc3a5e..3fa628d10e 100644 --- a/LocalPackages/SyncUI/Sources/SyncUI/Views/SaveRecoveryKeyView.swift +++ b/LocalPackages/SyncUI/Sources/SyncUI/Views/SaveRecoveryKeyView.swift @@ -41,7 +41,7 @@ public struct SaveRecoveryKeyView: View { func recoveryInfo() -> some View { VStack(spacing: 26) { HStack(spacing: 16) { - QRCodeView(string: model.key, size: 64, style: .dark) + QRCodeView(string: model.key, size: 64) Text(model.key) .fontWeight(.light)