Skip to content

Commit

Permalink
Always use black and white colors for the QR code (#2248)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/1201493110486074/1205142491450702/f

Description:
This is to increase compatibility with Android devices.
  • Loading branch information
ayoy authored Dec 7, 2023
1 parent adde136 commit da640ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit da640ad

Please sign in to comment.