Various Improvements

This commit is contained in:
Ilya Laktyushin
2021-12-15 00:08:44 +04:00
parent 471994bbc7
commit 7849157a16
15 changed files with 280 additions and 92 deletions

View File

@@ -13,8 +13,8 @@ import AnimatedStickerNode
import TelegramAnimatedStickerNode
import PresentationDataUtils
private func shareQrCode(context: AccountContext, link: String, view: UIView) {
let _ = (qrCode(string: link, color: .black, backgroundColor: .white, icon: .custom(UIImage(bundleImageName: "Chat/Links/QrLogo")))
private func shareQrCode(context: AccountContext, link: String, ecl: String, view: UIView) {
let _ = (qrCode(string: link, color: .black, backgroundColor: .white, icon: .custom(UIImage(bundleImageName: "Chat/Links/QrLogo")), ecl: ecl)
|> map { _, generator -> UIImage? in
let imageSize = CGSize(width: 768.0, height: 768.0)
let context = generator(TransformImageArguments(corners: ImageCorners(), imageSize: imageSize, boundingSize: imageSize, intrinsicInsets: UIEdgeInsets(), scale: 1.0))
@@ -47,6 +47,15 @@ public final class QrCodeScreen: ViewController {
return invite.link
}
}
var ecl: String {
switch self {
case .peer:
return "Q"
case .invite:
return "Q"
}
}
}
private var controllerNode: Node {
@@ -293,11 +302,11 @@ public final class QrCodeScreen: ViewController {
self.cancelButton.addTarget(self, action: #selector(self.cancelButtonPressed), forControlEvents: .touchUpInside)
self.buttonNode.pressed = { [weak self] in
if let strongSelf = self{
shareQrCode(context: strongSelf.context, link: subject.link, view: strongSelf.view)
shareQrCode(context: strongSelf.context, link: subject.link, ecl: subject.ecl, view: strongSelf.view)
}
}
self.qrImageNode.setSignal(qrCode(string: subject.link, color: .black, backgroundColor: .white, icon: .cutout) |> beforeNext { [weak self] size, _ in
self.qrImageNode.setSignal(qrCode(string: subject.link, color: .black, backgroundColor: .white, icon: .cutout, ecl: subject.ecl) |> beforeNext { [weak self] size, _ in
guard let strongSelf = self else {
return
}