Ditch old QR code modal

This commit is contained in:
Niels Andriesse 2019-12-05 15:28:53 +11:00
parent 1978c67a4f
commit 8cd53106b8
2 changed files with 0 additions and 55 deletions

View File

@ -569,7 +569,6 @@
B82584A02315024B001B41CB /* LokiRSSFeedPoller.swift in Sources */ = {isa = PBXBuildFile; fileRef = B825849F2315024B001B41CB /* LokiRSSFeedPoller.swift */; };
B846365B22B7418B00AF1514 /* Identicon+ObjC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B846365A22B7418B00AF1514 /* Identicon+ObjC.swift */; };
B84664F5235022F30083A1CD /* MentionUtilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = B84664F4235022F30083A1CD /* MentionUtilities.swift */; };
B86BD08123399883000F5AE3 /* QRCodeModal.swift in Sources */ = {isa = PBXBuildFile; fileRef = B86BD08023399883000F5AE3 /* QRCodeModal.swift */; };
B86BD08423399ACF000F5AE3 /* Modal.swift in Sources */ = {isa = PBXBuildFile; fileRef = B86BD08323399ACF000F5AE3 /* Modal.swift */; };
B86BD08623399CEF000F5AE3 /* SeedModal.swift in Sources */ = {isa = PBXBuildFile; fileRef = B86BD08523399CEF000F5AE3 /* SeedModal.swift */; };
B885D5F4233491AB00EE0D8E /* DeviceLinkingModal.swift in Sources */ = {isa = PBXBuildFile; fileRef = B885D5F3233491AB00EE0D8E /* DeviceLinkingModal.swift */; };
@ -1400,7 +1399,6 @@
B825849F2315024B001B41CB /* LokiRSSFeedPoller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LokiRSSFeedPoller.swift; sourceTree = "<group>"; };
B846365A22B7418B00AF1514 /* Identicon+ObjC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Identicon+ObjC.swift"; sourceTree = "<group>"; };
B84664F4235022F30083A1CD /* MentionUtilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MentionUtilities.swift; sourceTree = "<group>"; };
B86BD08023399883000F5AE3 /* QRCodeModal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRCodeModal.swift; sourceTree = "<group>"; };
B86BD08323399ACF000F5AE3 /* Modal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Modal.swift; sourceTree = "<group>"; };
B86BD08523399CEF000F5AE3 /* SeedModal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SeedModal.swift; sourceTree = "<group>"; };
B885D5F3233491AB00EE0D8E /* DeviceLinkingModal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceLinkingModal.swift; sourceTree = "<group>"; };
@ -2689,7 +2687,6 @@
children = (
B8BFFF392355426100102A27 /* Messaging */,
B86BD0872339A1ED000F5AE3 /* Onboarding */,
B86BD08223399ABF000F5AE3 /* Settings */,
B86BD0882339A253000F5AE3 /* Utilities */,
B8CCF63A2397572B0091D419 /* Redesign */,
);
@ -2707,14 +2704,6 @@
path = Loki;
sourceTree = "<group>";
};
B86BD08223399ABF000F5AE3 /* Settings */ = {
isa = PBXGroup;
children = (
B86BD08023399883000F5AE3 /* QRCodeModal.swift */,
);
path = Settings;
sourceTree = "<group>";
};
B86BD0872339A1ED000F5AE3 /* Onboarding */ = {
isa = PBXGroup;
children = (
@ -3855,7 +3844,6 @@
348570A820F67575004FF32B /* OWSMessageHeaderView.m in Sources */,
450DF2091E0DD2C6003D14BE /* UserNotificationsAdaptee.swift in Sources */,
34B6A907218B5241007C4606 /* TypingIndicatorCell.swift in Sources */,
B86BD08123399883000F5AE3 /* QRCodeModal.swift in Sources */,
4CFD151D22415AA400F2450F /* CallVideoHintView.swift in Sources */,
34D1F0AB1F867BFC0066283D /* OWSContactOffersCell.m in Sources */,
B8BB82B92394911B00BA5194 /* Separator.swift in Sources */,

View File

@ -1,43 +0,0 @@
@objc(LKQRCodeModal)
final class QRCodeModal : Modal {
override func populateContentView() {
// Label
let label = UILabel()
label.font = UIFont.ows_dynamicTypeSubheadlineClamped
label.text = NSLocalizedString("This is your QR code. Other people can scan it to start a secure conversation with you.", comment: "")
label.numberOfLines = 0
label.textAlignment = .center
label.lineBreakMode = .byWordWrapping
label.textColor = UIColor.ows_white
// Image view
let imageView = UIImageView()
let hexEncodedPublicKey: String
if let masterDeviceHexEncodedPublicKey = UserDefaults.standard.string(forKey: "masterDeviceHexEncodedPublicKey") {
hexEncodedPublicKey = masterDeviceHexEncodedPublicKey
} else {
hexEncodedPublicKey = OWSIdentityManager.shared().identityKeyPair()!.hexEncodedPublicKey
}
let data = hexEncodedPublicKey.data(using: .utf8)
let filter = CIFilter(name: "CIQRCodeGenerator")!
filter.setValue(data, forKey: "inputMessage")
let qrCodeAsCIImage = filter.outputImage!
let scaledQRCodeAsCIImage = qrCodeAsCIImage.transformed(by: CGAffineTransform(scaleX: 4.8, y: 4.8))
let qrCode = UIImage(ciImage: scaledQRCodeAsCIImage)
imageView.image = qrCode
// Cancel button
let buttonHeight = cancelButton.titleLabel!.font.pointSize * 48 / 17
cancelButton.set(.height, to: buttonHeight)
// Stack view
let stackView = UIStackView(arrangedSubviews: [ UIView.spacer(withHeight: 2), label, UIView.spacer(withHeight: 2), imageView, cancelButton ])
stackView.axis = .vertical
stackView.spacing = 16
stackView.alignment = .center
contentView.addSubview(stackView)
stackView.pin(.leading, to: .leading, of: contentView, withInset: 16)
stackView.pin(.top, to: .top, of: contentView, withInset: 16)
contentView.pin(.trailing, to: .trailing, of: stackView, withInset: 16)
contentView.pin(.bottom, to: .bottom, of: stackView, withInset: 16)
}
}