ソースを参照

add the same desciption below the QR code as in Android

cyberta 6 年 前
コミット
723a528207
1 ファイル変更19 行追加2 行削除
  1. 19 2
      deltachat-ios/Controller/NewProfileViewController.swift

+ 19 - 2
deltachat-ios/Controller/NewProfileViewController.swift

@@ -41,11 +41,13 @@ class NewProfileViewController: UIViewController, QrCodeReaderDelegate {
 		self.edgesForExtendedLayout = []
 
 		let contactCell = createContactCell()
+		let infoLabel = createInfoLabel()
 		let qrCode = createQRCodeView()
 		let qrCodeScanner = createQRCodeScannerButton()
 	
 		self.view.addSubview(contactCell)
 		self.view.addSubview(qrCode)
+		self.view.addSubview(infoLabel)
 		self.view.addSubview(qrCodeScanner)
 
 		self.view.addConstraint(contactCell.constraintAlignTopTo(self.view))
@@ -53,7 +55,10 @@ class NewProfileViewController: UIViewController, QrCodeReaderDelegate {
 		self.view.addConstraint(contactCell.constraintAlignTrailingTo(self.view))
 		self.view.addConstraint(qrCode.constraintCenterYTo(self.view))
 		self.view.addConstraint(qrCode.constraintCenterXTo(self.view))
-		self.view.addConstraint(qrCodeScanner.constraintToBottomOf(qrCode, paddingTop: 25))
+		self.view.addConstraint(infoLabel.constraintToBottomOf(qrCode, paddingTop: 25))
+		self.view.addConstraint(infoLabel.constraintAlignLeadingTo(self.view, paddingLeading: 8))
+		self.view.addConstraint(infoLabel.constraintAlignTrailingTo(self.view, paddingTrailing: 8))
+		self.view.addConstraint(qrCodeScanner.constraintAlignBottomTo(self.view, paddingBottom: 25))
 		self.view.addConstraint(qrCodeScanner.constraintCenterXTo(self.view))
 	}
 
@@ -64,7 +69,19 @@ class NewProfileViewController: UIViewController, QrCodeReaderDelegate {
 			ctrl.viewControllers.removeLast()
 		}
 	}
-	
+
+	private func createInfoLabel() -> UIView {
+		let label = UILabel.init()
+		label.translatesAutoresizingMaskIntoConstraints = false
+		if let contact = contact {
+			label.text = String.localizedStringWithFormat(String.localized("qrshow_join_contact_hint"), contact.email)
+		}
+		label.lineBreakMode = .byWordWrapping
+		label.numberOfLines = 0
+		label.textAlignment = .center
+		label.font = UIFont.systemFont(ofSize: 14)
+		return label
+	}
 	private func createQRCodeScannerButton() -> UIView {
 		let btn = UIButton.init(type: UIButton.ButtonType.system)
 		btn.translatesAutoresizingMaskIntoConstraints = false