瀏覽代碼

Merge pull request #438 from deltachat/quickfix_QR_code_controller

tweak qr-code view and tabbar
björn petersen 5 年之前
父節點
當前提交
382d694529

二進制
deltachat-ios/Assets.xcassets/chat.imageset/chat.png


二進制
deltachat-ios/Assets.xcassets/chat.imageset/chat@2x.png


二進制
deltachat-ios/Assets.xcassets/chat.imageset/chat@3x.png


+ 3 - 3
deltachat-ios/Assets.xcassets/chat.imageset/Contents.json → deltachat-ios/Assets.xcassets/ic_chat.imageset/Contents.json

@@ -2,17 +2,17 @@
   "images" : [
     {
       "idiom" : "universal",
-      "filename" : "chat.png",
+      "filename" : "icn_dc_1x.png",
       "scale" : "1x"
     },
     {
       "idiom" : "universal",
-      "filename" : "chat@2x.png",
+      "filename" : "icn_dc_2x.png",
       "scale" : "2x"
     },
     {
       "idiom" : "universal",
-      "filename" : "chat@3x.png",
+      "filename" : "icn_dc_3x.png",
       "scale" : "3x"
     }
   ],

二進制
deltachat-ios/Assets.xcassets/ic_chat.imageset/icn_dc_1x.png


二進制
deltachat-ios/Assets.xcassets/ic_chat.imageset/icn_dc_2x.png


二進制
deltachat-ios/Assets.xcassets/ic_chat.imageset/icn_dc_3x.png


+ 6 - 38
deltachat-ios/Controller/QrViewController.swift

@@ -2,9 +2,8 @@ import Foundation
 import UIKit
 
 class QrViewController: UITableViewController, QrCodeReaderDelegate {
-    private let rowContact = 0
-    private let rowQRCode = 1
-    private let rowScanQR = 2
+    private let rowQRCode = 0
+    private let rowScanQR = 1
 
     weak var coordinator: QrViewCoordinator?
     let qrCodeReaderController = QrCodeReaderController()
@@ -33,19 +32,10 @@ class QrViewController: UITableViewController, QrCodeReaderDelegate {
         qrCodeReaderController.delegate = self
         tableView.separatorStyle = .none
     }
-
-    override func viewDidAppear(_ animated: Bool) {
-        let indexPath = IndexPath(row: rowContact, section: 0)
-        tableView.beginUpdates()
-        tableView.reloadRows(at: [indexPath], with: UITableView.RowAnimation.none)
-        tableView.endUpdates()
-    }
     
     override func tableView(_: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
         let row = indexPath.row
         switch row {
-        case rowContact:
-            return createContactCell()
         case rowQRCode:
             return createQRCodeCell()
         case rowScanQR:
@@ -60,17 +50,15 @@ class QrViewController: UITableViewController, QrCodeReaderDelegate {
     }
 
     override func tableView(_: UITableView, numberOfRowsInSection section: Int) -> Int {
-        return 3
+        return 2
     }
 
     override func tableView(_: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
         switch indexPath.row {
-        case rowContact:
-            return 72
         case rowQRCode:
-            return 225
+            return 325
         case rowScanQR:
-            return 40
+            return 48
         default:
             return 10
         }
@@ -211,26 +199,6 @@ class QrViewController: UITableViewController, 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
-            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()
@@ -289,7 +257,7 @@ class QrViewController: UITableViewController, QrCodeReaderDelegate {
     }
 
     private func createQRCodeView() -> UIView {
-        let width: CGFloat = 130
+        let width: CGFloat = 230
         let frame = CGRect(origin: .zero, size: .init(width: width, height: width))
         let imageView = QRCodeView(frame: frame)
         if let qrCode = dcContext.getSecurejoinQr(chatId: 0) {

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

@@ -34,7 +34,7 @@ class AppCoordinator: NSObject, Coordinator {
     private lazy var qrController: UIViewController = {
         let controller = QrViewController(dcContext: dcContext)
         let nav = DcNavigationController(rootViewController: controller)
-        let settingsImage = UIImage(named: "report_card")
+        let settingsImage = UIImage(named: "qr_code")
         nav.tabBarItem = UITabBarItem(title: String.localized("qr_code"), image: settingsImage, tag: qrTab)
         let coordinator = QrViewCoordinator(navigationController: nav)
         self.childCoordinators.append(coordinator)
@@ -45,7 +45,7 @@ class AppCoordinator: NSObject, Coordinator {
     private lazy var chatListController: UIViewController = {
         let controller = ChatListController(dcContext: dcContext, showArchive: false)
         let nav = DcNavigationController(rootViewController: controller)
-        let settingsImage = UIImage(named: "chat")
+        let settingsImage = UIImage(named: "ic_chat")
         nav.tabBarItem = UITabBarItem(title: String.localized("pref_chats"), image: settingsImage, tag: chatsTab)
         let coordinator = ChatListCoordinator(dcContext: dcContext, navigationController: nav)
         self.childCoordinators.append(coordinator)