Răsfoiți Sursa

Merge pull request #255 from deltachat/rename_my_profile

rename global "my profile" to "qr scan/show"
björn petersen 5 ani în urmă
părinte
comite
095579080b

+ 4 - 8
deltachat-ios.xcodeproj/project.pbxproj

@@ -7,7 +7,7 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
-		30149D9322F21129003C12B5 /* NewProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30149D9222F21129003C12B5 /* NewProfileViewController.swift */; };
+		30149D9322F21129003C12B5 /* QrViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30149D9222F21129003C12B5 /* QrViewController.swift */; };
 		3022E6BE22E8768800763272 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3022E6C022E8768800763272 /* InfoPlist.strings */; };
 		3060119C22DDE24000C1CE6F /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3060119E22DDE24000C1CE6F /* Localizable.strings */; };
 		306011B622E5E7FB00C1CE6F /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 306011B422E5E7FB00C1CE6F /* Localizable.stringsdict */; };
@@ -30,7 +30,6 @@
 		78E45E4C21D404AE00D4B15E /* CustomMessageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78E45E4B21D404AE00D4B15E /* CustomMessageCell.swift */; };
 		78ED838321D5379000243125 /* TextFieldCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78ED838221D5379000243125 /* TextFieldCell.swift */; };
 		78ED838D21D577D000243125 /* events.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78ED838C21D577D000243125 /* events.swift */; };
-		78ED838F21D5927A00243125 /* ProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78ED838E21D5927A00243125 /* ProfileViewController.swift */; };
 		78ED839421D5AF8A00243125 /* QrCodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78ED839321D5AF8A00243125 /* QrCodeView.swift */; };
 		7A0052C81FBE6CB40048C3BF /* NewContactController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0052C71FBE6CB40048C3BF /* NewContactController.swift */; };
 		7A451D941FB1B1DB00177250 /* wrapper.c in Sources */ = {isa = PBXBuildFile; fileRef = 7A451D921FB1B1DB00177250 /* wrapper.c */; };
@@ -85,7 +84,7 @@
 /* Begin PBXFileReference section */
 		21EE28844E7A690D73BF5285 /* Pods-deltachat-iosTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-deltachat-iosTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-deltachat-iosTests/Pods-deltachat-iosTests.debug.xcconfig"; sourceTree = "<group>"; };
 		2F7009234DB9408201A6CDCB /* Pods_deltachat_iosTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_deltachat_iosTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
-		30149D9222F21129003C12B5 /* NewProfileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewProfileViewController.swift; sourceTree = "<group>"; };
+		30149D9222F21129003C12B5 /* QrViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QrViewController.swift; sourceTree = "<group>"; };
 		3022E6BF22E8768800763272 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
 		3022E6C122E8768C00763272 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/InfoPlist.strings; sourceTree = "<group>"; };
 		3022E6C222E8768E00763272 /* sq */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sq; path = sq.lproj/InfoPlist.strings; sourceTree = "<group>"; };
@@ -167,7 +166,6 @@
 		78E45E4B21D404AE00D4B15E /* CustomMessageCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomMessageCell.swift; sourceTree = "<group>"; };
 		78ED838221D5379000243125 /* TextFieldCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldCell.swift; sourceTree = "<group>"; };
 		78ED838C21D577D000243125 /* events.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = events.swift; sourceTree = "<group>"; };
-		78ED838E21D5927A00243125 /* ProfileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileViewController.swift; sourceTree = "<group>"; };
 		78ED839321D5AF8A00243125 /* QrCodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QrCodeView.swift; sourceTree = "<group>"; };
 		7A0052C71FBE6CB40048C3BF /* NewContactController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewContactController.swift; sourceTree = "<group>"; };
 		7A451D921FB1B1DB00177250 /* wrapper.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wrapper.c; sourceTree = "<group>"; };
@@ -357,8 +355,7 @@
 				7092474020B3869500AF8799 /* ContactDetailViewController.swift */,
 				7AE0A5481FC42F65005ECB4B /* NewChatViewController.swift */,
 				AE0D26FC1FB1FE88002FAFCE /* ChatListController.swift */,
-				78ED838E21D5927A00243125 /* ProfileViewController.swift */,
-				30149D9222F21129003C12B5 /* NewProfileViewController.swift */,
+				30149D9222F21129003C12B5 /* QrViewController.swift */,
 				78E45E3921D3CFBC00D4B15E /* SettingsController.swift */,
 				7070FB9A2101ECBB000DC258 /* GroupNameController.swift */,
 				AE851ACF227DF50900ED86F0 /* GroupChatDetailViewController.swift */,
@@ -732,13 +729,12 @@
 				78ED838321D5379000243125 /* TextFieldCell.swift in Sources */,
 				78E45E3C21D3D03700D4B15E /* TextFieldTableViewCell.swift in Sources */,
 				AE0D26FD1FB1FE88002FAFCE /* ChatListController.swift in Sources */,
-				30149D9322F21129003C12B5 /* NewProfileViewController.swift in Sources */,
+				30149D9322F21129003C12B5 /* QrViewController.swift in Sources */,
 				AEE56D80225504DB007DC082 /* Extensions.swift in Sources */,
 				7A0052C81FBE6CB40048C3BF /* NewContactController.swift in Sources */,
 				AEE56D762253431E007DC082 /* AccountSetupController.swift in Sources */,
 				AEACE2DD1FB323CA00DCDD78 /* ChatViewController.swift in Sources */,
 				AEE6EC412282DF5700EDC689 /* MailboxViewController.swift in Sources */,
-				78ED838F21D5927A00243125 /* ProfileViewController.swift in Sources */,
 				AEE6EC482283045D00EDC689 /* EditSettingsController.swift in Sources */,
 				7A9FB1441FB061E2001FEA36 /* AppDelegate.swift in Sources */,
 				AEE56D7D2253ADB4007DC082 /* HudHandler.swift in Sources */,

+ 0 - 164
deltachat-ios/Controller/ProfileViewController.swift

@@ -1,164 +0,0 @@
-import UIKit
-
-class ProfileViewController: UITableViewController {
-    var dcContext: DcContext
-    weak var coordinator: ProfileCoordinator?
-
-    var contact: DcContact? {
-        // This is nil if we do not have an account setup yet
-        if !DcConfig.configured {
-            return nil
-        }
-        return DcContact(id: Int(DC_CONTACT_ID_SELF))
-    }
-
-    var fingerprint: String? {
-        if !DcConfig.configured {
-            return nil
-        }
-
-        if let cString = dc_get_securejoin_qr(mailboxPointer, 0) {
-            let swiftString = String(cString: cString)
-            free(cString)
-            return swiftString
-        }
-
-        return nil
-    }
-
-    init(dcContext: DcContext) {
-        self.dcContext = dcContext
-        super.init(style: .plain)
-    }
-
-    required init?(coder _: NSCoder) {
-        fatalError("init(coder:) has not been implemented")
-    }
-
-    override func viewDidLoad() {
-        super.viewDidLoad()
-        title = String.localized("pref_profile_info_headline")
-    }
-
-    override func viewWillAppear(_: Bool) {
-        navigationController?.navigationBar.prefersLargeTitles = false
-        tableView.reloadData()
-    }
-
-    func displayNewChat(contactId: Int) {
-        let chatId = dc_create_chat_by_contact_id(mailboxPointer, UInt32(contactId))
-        let chatVC = ChatViewController(dcContext: dcContext, chatId: Int(chatId))
-
-        chatVC.hidesBottomBarWhenPushed = true
-        navigationController?.pushViewController(chatVC, animated: true)
-    }
-
-    override func didReceiveMemoryWarning() {
-        super.didReceiveMemoryWarning()
-        // Dispose of any resources that can be recreated.
-    }
-
-    // MARK: - Table view data source
-
-    override func numberOfSections(in _: UITableView) -> Int {
-        return 2
-    }
-
-    override func tableView(_: UITableView, numberOfRowsInSection section: Int) -> Int {
-        if section == 0 {
-            return 2
-        }
-
-        return 0
-    }
-
-    override func tableView(_: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
-        let row = indexPath.row
-
-        let cell = UITableViewCell(style: .default, reuseIdentifier: nil)
-        if indexPath.section == 0 {
-            if row == 0 {
-                if let fingerprint = self.fingerprint {
-                    //FIXME: this formatting is not correct for r-t-l languages
-                    //keeping it simple for now as it is not clear if we will show the FP this way
-                    cell.textLabel?.text = String.localized("qrscan_fingerprint_label") + ": \(fingerprint)"
-                    cell.textLabel?.textAlignment = .center
-                }
-            }
-            if row == 1 {
-                if let fingerprint = self.fingerprint {
-                    let width: CGFloat = 130
-
-                    let frame = CGRect(origin: .zero, size: .init(width: width, height: width))
-                    let imageView = QRCodeView(frame: frame)
-                    imageView.generateCode(
-                        fingerprint,
-                        foregroundColor: .darkText,
-                        backgroundColor: .white
-                    )
-                    imageView.translatesAutoresizingMaskIntoConstraints = false
-                    // imageView.center = cell.center
-                    cell.addSubview(imageView)
-
-                    imageView.centerXAnchor.constraint(equalTo: cell.centerXAnchor).isActive = true
-                    imageView.centerYAnchor.constraint(equalTo: cell.centerYAnchor).isActive = true
-                    imageView.widthAnchor.constraint(equalToConstant: width).isActive = true
-                    imageView.heightAnchor.constraint(equalToConstant: width).isActive = true
-                }
-            }
-        }
-
-        if indexPath.section == 1 {
-            if row == 0 {}
-        }
-
-        return cell
-    }
-
-    override func tableView(_: UITableView, didSelectRowAt _: IndexPath) {}
-
-    override func tableView(_: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
-        if section == 0 {
-            return 80
-        }
-
-        return 20
-    }
-
-    override func tableView(_: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
-        if indexPath.row == 1 {
-            return 150
-        }
-
-        return 46
-    }
-
-    override func tableView(_: UITableView, viewForHeaderInSection section: Int) -> UIView? {
-        let bg = UIColor(red: 248 / 255, green: 248 / 255, blue: 255 / 255, alpha: 1.0)
-        if section == 0 {
-            let contactCell = ContactCell()
-            if let contact = self.contact {
-                let name = DcConfig.displayname ?? contact.displayName
-                contactCell.backgroundColor = bg
-                contactCell.nameLabel.text = name
-                contactCell.emailLabel.text = contact.email
-                contactCell.darkMode = false
-                contactCell.selectionStyle = .none
-                if let img = contact.profileImage {
-                    contactCell.setImage(img)
-                } else {
-                    contactCell.setBackupImage(name: name, color: contact.color)
-                }
-                contactCell.setVerified(isVerified: contact.isVerified)
-            } else {
-                contactCell.nameLabel.text = String.localized("no_account_setup")
-            }
-            return contactCell
-        }
-
-        let vw = UIView()
-        vw.backgroundColor = bg
-
-        return vw
-    }
-}

+ 111 - 134
deltachat-ios/Controller/NewProfileViewController.swift → deltachat-ios/Controller/QrViewController.swift

@@ -1,22 +1,22 @@
 import Foundation
 import UIKit
 
-class NewProfileViewController: UIViewController, QrCodeReaderDelegate {
+class QrViewController: UITableViewController, QrCodeReaderDelegate {
+    private let rowContact = 0
+    private let rowQRCode = 1
+    private let rowScanQR = 2
 
-    weak var coordinator: ProfileCoordinator?
+    weak var coordinator: QrViewCoordinator?
     let qrCodeReaderController = QrCodeReaderController()
     var secureJoinObserver: Any?
     var dcContext: DcContext
-
-    var contactCell: UIView?
-    var infoLabel: UIView?
-    var qrCode: UIView?
-    var qrCodeScanner: UIView?
-
-    var contactCellConstraints: [NSLayoutConstraint] = []
-    var infoLabelConstraints: [NSLayoutConstraint] = []
-    var qrCodeConstraints: [NSLayoutConstraint] = []
-    var qrCodeScannerConstraints: [NSLayoutConstraint] = []
+    var contact: DcContact? {
+        // This is nil if we do not have an account setup yet
+        if !DcConfig.configured {
+            return nil
+        }
+        return DcContact(id: Int(DC_CONTACT_ID_SELF))
+    }
 
     init(dcContext: DcContext) {
         self.dcContext = dcContext
@@ -27,6 +27,54 @@ class NewProfileViewController: UIViewController, QrCodeReaderDelegate {
         fatalError("init(coder:) has not been implemented")
     }
 
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        title = String.localized("qr_code_title")
+        qrCodeReaderController.delegate = self
+        tableView.separatorStyle = .none
+    }
+
+    override func tableView(_: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+        let row = indexPath.row
+        switch row {
+        case rowContact:
+            return createContactCell()
+        case rowQRCode:
+            return createQRCodeCell()
+        case rowScanQR:
+            return createQRCodeScanCell()
+        default:
+            return UITableViewCell(style: .default, reuseIdentifier: nil)
+        }
+    }
+
+    override func viewWillAppear(_: Bool) {
+        if #available(iOS 11.0, *) {
+            navigationController?.navigationBar.prefersLargeTitles = true
+        }
+    }
+
+    override func numberOfSections(in _: UITableView) -> Int {
+        return 1
+    }
+
+    override func tableView(_: UITableView, numberOfRowsInSection section: Int) -> Int {
+        return 3
+    }
+
+    override func tableView(_: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
+        switch indexPath.row {
+        case rowContact:
+            return 72
+        case rowQRCode:
+            return 225
+        case rowScanQR:
+            return 40
+        default:
+            return 10
+        }
+    }
+
     private lazy var progressAlert: UIAlertController = {
         let alert = UIAlertController(title: String.localized("one_moment"), message: "TESTMESSAGE", preferredStyle: .alert)
 
@@ -59,102 +107,6 @@ class NewProfileViewController: UIViewController, QrCodeReaderDelegate {
         }))
     }
 
-    var contact: DcContact? {
-        // This is nil if we do not have an account setup yet
-        if !DcConfig.configured {
-            return nil
-        }
-        return DcContact(id: Int(DC_CONTACT_ID_SELF))
-    }
-
-    override func loadView() {
-        let view = UIView()
-        view.backgroundColor = UIColor.white
-        self.view = view
-    }
-
-    override func viewDidLoad() {
-        super.viewDidLoad()
-        title = String.localized("pref_profile_info_headline")
-        qrCodeReaderController.delegate = self
-        self.edgesForExtendedLayout = []
-
-        initViews()
-
-        if UIDevice.current.orientation.isLandscape {
-            setupLandscapeConstraints()
-        } else {
-            setupPortraitConstraints()
-        }
-
-    }
-
-    private func initViews() {
-        contactCell = createContactCell()
-        infoLabel = createInfoLabel()
-        qrCode = createQRCodeView()
-        qrCodeScanner = createQRCodeScannerButton()
-        self.view.addSubview(contactCell!)
-        self.view.addSubview(qrCode!)
-        self.view.addSubview(infoLabel!)
-        self.view.addSubview(qrCodeScanner!)
-    }
-
-    private func applyConstraints() {
-        self.view.addConstraints(contactCellConstraints)
-        self.view.addConstraints(qrCodeConstraints)
-        self.view.addConstraints(infoLabelConstraints)
-        self.view.addConstraints(qrCodeScannerConstraints)
-    }
-
-    private func removeConstraints() {
-        self.view.removeConstraints(contactCellConstraints)
-        self.view.removeConstraints(qrCodeConstraints)
-        self.view.removeConstraints(infoLabelConstraints)
-        self.view.removeConstraints(qrCodeScannerConstraints)
-    }
-
-    func setupPortraitConstraints() {
-        removeConstraints()
-        contactCellConstraints = [contactCell!.constraintAlignTopTo(self.view),
-                                  contactCell!.constraintAlignLeadingTo(self.view),
-                                  contactCell!.constraintAlignTrailingTo(self.view)]
-        qrCodeScannerConstraints = [qrCodeScanner!.constraintAlignBottomTo(self.view, paddingBottom: 25),
-                                    qrCodeScanner!.constraintCenterXTo(self.view)]
-        qrCodeConstraints = [qrCode!.constraintCenterYTo(self.view),
-                             qrCode!.constraintCenterYTo(self.view, paddingY: -25),
-                             qrCode!.constraintCenterXTo(self.view)]
-        infoLabelConstraints = [infoLabel!.constraintToBottomOf(qrCode!, paddingTop: 25),
-                                infoLabel!.constraintAlignLeadingTo(self.view, paddingLeading: 8),
-                                infoLabel!.constraintAlignTrailingTo(self.view, paddingTrailing: 8)]
-        applyConstraints()
-    }
-
-    func setupLandscapeConstraints() {
-        removeConstraints()
-        contactCellConstraints = [contactCell!.constraintAlignTopTo(self.view),
-                                  contactCell!.constraintAlignLeadingTo(self.view),
-                                  contactCell!.constraintAlignTrailingTo(self.view)]
-        qrCodeScannerConstraints = [qrCodeScanner!.constraintToTrailingOf(qrCode!, paddingLeading: 50),
-                                    qrCodeScanner!.constraintAlignTrailingTo(self.view, paddingTrailing: 50),
-                                    qrCodeScanner!.constraintAlignBottomTo(qrCode!)]
-        qrCodeConstraints = [qrCode!.constraintToBottomOf(contactCell!, paddingTop: 25),
-                             qrCode!.constraintAlignLeadingTo(self.view, paddingLeading: 50)]
-        infoLabelConstraints = [infoLabel!.constraintToBottomOf(contactCell!, paddingTop: 25),
-                                infoLabel!.constraintToTrailingOf(qrCode!, paddingLeading: 50),
-                                infoLabel!.constraintAlignTrailingTo(self.view, paddingTrailing: 50)]
-        applyConstraints()
-    }
-
-    override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
-        super.viewWillTransition(to: size, with: coordinator)
-        if UIDevice.current.orientation.isLandscape {
-            setupLandscapeConstraints()
-        } else {
-            setupPortraitConstraints()
-        }
-    }
-
     private func addSecureJoinProgressListener() {
         let nc = NotificationCenter.default
         secureJoinObserver = nc.addObserver(
@@ -238,6 +190,57 @@ class NewProfileViewController: UIViewController, QrCodeReaderDelegate {
         present(alert, animated: true, completion: nil)
     }
 
+    private func createContactCell() -> UITableViewCell {
+        let cell = ContactCell(style: .default, reuseIdentifier: "contactCell")
+        let bg = UIColor(red: 248 / 255, green: 248 / 255, blue: 255 / 255, alpha: 1.0)
+
+        if let contact = self.contact {
+            let name = DcConfig.displayname ?? contact.displayName
+            cell.backgroundColor = bg
+            cell.nameLabel.text = name
+            cell.emailLabel.text = contact.email
+            cell.darkMode = false
+            if let img = contact.profileImage {
+                cell.setImage(img)
+            } else {
+                cell.setBackupImage(name: name, color: contact.color)
+            }
+        } else {
+            cell.nameLabel.text = String.localized("no_account_setup")
+        }
+        return cell
+    }
+
+    private func createQRCodeCell() -> UITableViewCell {
+        let cell = UITableViewCell(style: .default, reuseIdentifier: "qrCodeCell")
+        let qrCode = createQRCodeView()
+        let infolabel = createInfoLabel()
+
+        cell.contentView.addSubview(qrCode)
+        cell.contentView.addSubview(infolabel)
+        cell.selectionStyle = .none
+
+        let qrCodeConstraints = [qrCode.constraintAlignTopTo(cell.contentView, paddingTop: 25),
+                                 qrCode.constraintCenterXTo(cell.contentView)]
+        let infoLabelConstraints = [infolabel.constraintToBottomOf(qrCode, paddingTop: 25),
+                                    infolabel.constraintAlignLeadingTo(cell.contentView, paddingLeading: 8),
+                                    infolabel.constraintAlignTrailingTo(cell.contentView, paddingTrailing: 8)]
+        cell.contentView.addConstraints(qrCodeConstraints)
+        cell.contentView.addConstraints(infoLabelConstraints)
+        return cell
+    }
+
+    private func createQRCodeScanCell() -> UITableViewCell {
+        let cell = UITableViewCell(style: .default, reuseIdentifier: "scanQR")
+        let scanButton = createQRCodeScannerButton()
+        cell.contentView.addSubview(scanButton)
+        cell.selectionStyle = .none
+        let scanButtonConstraints = [scanButton.constraintCenterXTo(cell.contentView),
+                                     scanButton.constraintCenterYTo(cell.contentView)]
+        cell.contentView.addConstraints(scanButtonConstraints)
+        return cell
+    }
+
     private func createInfoLabel() -> UIView {
         let label = UILabel.init()
         label.translatesAutoresizingMaskIntoConstraints = false
@@ -282,32 +285,6 @@ class NewProfileViewController: UIViewController, QrCodeReaderDelegate {
         return imageView
     }
 
-    private func createContactCell() -> UIView {
-        let bg = UIColor(red: 248 / 255, green: 248 / 255, blue: 255 / 255, alpha: 1.0)
-
-        let profileView = ProfileView(frame: CGRect())
-        if let contact = self.contact {
-            let name = DcConfig.displayname ?? contact.displayName
-            profileView.setBackgroundColor(bg)
-            profileView.nameLabel.text = name
-            profileView.emailLabel.text = contact.email
-            profileView.darkMode = false
-            if let img = contact.profileImage {
-                profileView.setImage(img)
-            } else {
-                profileView.setBackupImage(name: name, color: contact.color)
-            }
-        } else {
-            profileView.nameLabel.text = String.localized("no_account_setup")
-        }
-
-        return profileView
-    }
-
-    override func viewWillAppear(_: Bool) {
-        navigationController?.navigationBar.prefersLargeTitles = true
-    }
-
     func displayNewChat(contactId: Int) {
         let chatId = dc_create_chat_by_contact_id(mailboxPointer, UInt32(contactId))
         let chatVC = ChatViewController(dcContext: dcContext, chatId: Int(chatId))

+ 8 - 8
deltachat-ios/Coordinator/AppCoordinator.swift

@@ -7,7 +7,7 @@ class AppCoordinator: NSObject, Coordinator {
     private let window: UIWindow
     private let dcContext: DcContext
     private let mailboxTab = 0
-    private let profileTab = 1
+    private let qrTab = 1
     private let chatsTab = 2
     private let settingsTab = 3
 
@@ -19,7 +19,7 @@ class AppCoordinator: NSObject, Coordinator {
 
     private lazy var tabBarController: UITabBarController = {
         let tabBarController = UITabBarController()
-        tabBarController.viewControllers = [mailboxController, profileController, chatListController, settingsController]
+        tabBarController.viewControllers = [mailboxController, qrController, chatListController, settingsController]
         // put viewControllers here
         tabBarController.delegate = self
         tabBarController.tabBar.tintColor = DcColors.primary
@@ -40,12 +40,12 @@ class AppCoordinator: NSObject, Coordinator {
         return nav
     }()
 
-    private lazy var profileController: UIViewController = {
-        let controller = NewProfileViewController(dcContext: dcContext)
+    private lazy var qrController: UIViewController = {
+        let controller = QrViewController(dcContext: dcContext)
         let nav = DcNavigationController(rootViewController: controller)
         let settingsImage = UIImage(named: "report_card")
-        nav.tabBarItem = UITabBarItem(title: String.localized("pref_profile_info_headline"), image: settingsImage, tag: profileTab)
-        let coordinator = ProfileCoordinator(navigationController: nav)
+        nav.tabBarItem = UITabBarItem(title: String.localized("qr_code_title"), image: settingsImage, tag: qrTab)
+        let coordinator = QrViewCoordinator(navigationController: nav)
         self.childCoordinators.append(coordinator)
         controller.coordinator = coordinator
         return nav
@@ -118,7 +118,7 @@ extension AppCoordinator: UITabBarControllerDelegate {
             switch tabBarController.selectedIndex {
             case chatsTab, settingsTab:
                 dcNav.navigationBar.prefersLargeTitles = true
-            case mailboxTab, profileTab:
+            case mailboxTab, qrTab:
                 dcNav.navigationBar.prefersLargeTitles = false
             default:
                 // should never get here
@@ -144,7 +144,7 @@ class MailboxCoordinator: ChatViewCoordinator {
     }
 }
 
-class ProfileCoordinator: Coordinator {
+class QrViewCoordinator: Coordinator {
     var navigationController: UINavigationController
     init(navigationController: UINavigationController) {
         self.navigationController = navigationController

+ 1 - 0
deltachat-ios/en.lproj/Localizable.strings

@@ -650,3 +650,4 @@
 "automatic" = "Automatic";
 "complete" = "Complete";
 "info" = "Info";
+"qr_code_title" = "QR scan/show";

+ 1 - 0
tools/untranslated.xml

@@ -22,6 +22,7 @@
     <string name="automatic">Automatic</string>
     <string name="complete">Complete</string>
     <string name="info">Info</string>
+    <string name="qr_code_title">QR scan/show</string>
     <!-- info plist keys need to pre prefixed with INFOPLIST., spaces need to be replaced with dots and dashes need to replaced with underscores -->
     <string name="INFOPLIST.Privacy._.Camera.Usage.Description">Allowing access to the camera lets you take photos and videos.</string>
     <string name="INFOPLIST.Privacy._.Contacts.Usage.Description">Allowing access to your address book lets you chat with contacts from your device.</string>