Fix qr code rendering

This commit is contained in:
Ilya Laktyushin
2019-10-28 23:10:27 +04:00
parent a960811eac
commit a271b90793
4 changed files with 67 additions and 34 deletions

View File

@@ -41,8 +41,8 @@ public final class ShareProxyServerActionSheetController: ActionSheetController
items.append(ActionSheetButtonItem(title: strings.SocksProxySetup_ShareQRCode, action: { [weak self] in
self?.dismissAnimated()
let _ = (qrCode(string: link, color: .black, backgroundColor: .white, icon: .proxy)
|> map { generator -> UIImage? in
let imageSize = CGSize(width: 512.0, height: 512.0)
|> 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))
return context?.generateImage()
}
@@ -128,8 +128,10 @@ private final class ProxyServerQRCodeItemNode: ActionSheetItemNode {
self.label.attributedText = NSAttributedString(string: strings.SocksProxySetup_ShareQRCodeInfo, font: ActionSheetTextNode.defaultFont, textColor: self.theme.secondaryTextColor, paragraphAlignment: .center)
self.imageNode = TransformImageNode()
self.imageNode.setSignal(qrCode(string: link, color: .black, backgroundColor: .white, icon: .proxy), attemptSynchronously: true)
self.imageNode.clipsToBounds = true
self.imageNode.setSignal(qrCode(string: link, color: .black, backgroundColor: .white, icon: .proxy) |> map { $0.1 }, attemptSynchronously: true)
self.imageNode.cornerRadius = 14.0
super.init(theme: theme)
self.addSubnode(self.label)