瀏覽代碼

replaced textcell by section footer

nayooti 5 年之前
父節點
當前提交
135b248a0d

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

@@ -119,7 +119,6 @@
 		7AE0A5491FC42F65005ECB4B /* NewChatViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE0A5481FC42F65005ECB4B /* NewChatViewController.swift */; };
 		8B6D425BC604F7C43B65D436 /* Pods_deltachat_ios.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6241BE1534A653E79AD5D01D /* Pods_deltachat_ios.framework */; };
 		AE0D26FD1FB1FE88002FAFCE /* ChatListController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE0D26FC1FB1FE88002FAFCE /* ChatListController.swift */; };
-		AE13E5E32449AAC600FCD5D4 /* TextCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE13E5E22449AAC600FCD5D4 /* TextCell.swift */; };
 		AE18F294228C602A0007B1BE /* SecuritySettingsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE18F293228C602A0007B1BE /* SecuritySettingsController.swift */; };
 		AE19887523EB264000B4CD5F /* HelpViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE19887423EB264000B4CD5F /* HelpViewController.swift */; };
 		AE1988A523EB2FBA00B4CD5F /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE1988A423EB2FBA00B4CD5F /* Errors.swift */; };
@@ -369,7 +368,6 @@
 		8DE110C607A0E4485C43B5FA /* Pods-deltachat-ios.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-deltachat-ios.debug.xcconfig"; path = "Pods/Target Support Files/Pods-deltachat-ios/Pods-deltachat-ios.debug.xcconfig"; sourceTree = "<group>"; };
 		A8615D4600859851E53CAA9C /* Pods-deltachat-ios.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-deltachat-ios.release.xcconfig"; path = "Pods/Target Support Files/Pods-deltachat-ios/Pods-deltachat-ios.release.xcconfig"; sourceTree = "<group>"; };
 		AE0D26FC1FB1FE88002FAFCE /* ChatListController.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = ChatListController.swift; sourceTree = "<group>"; tabWidth = 4; };
-		AE13E5E22449AAC600FCD5D4 /* TextCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextCell.swift; sourceTree = "<group>"; };
 		AE18F293228C602A0007B1BE /* SecuritySettingsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecuritySettingsController.swift; sourceTree = "<group>"; };
 		AE19887423EB264000B4CD5F /* HelpViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HelpViewController.swift; sourceTree = "<group>"; };
 		AE1988A423EB2FBA00B4CD5F /* Errors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Errors.swift; sourceTree = "<group>"; };
@@ -740,7 +738,6 @@
 			isa = PBXGroup;
 			children = (
 				AE406EEF240FF8FF005F7022 /* ProfileCell.swift */,
-				AE13E5E22449AAC600FCD5D4 /* TextCell.swift */,
 			);
 			path = Cell;
 			sourceTree = "<group>";
@@ -1234,7 +1231,6 @@
 				AEE6EC412282DF5700EDC689 /* MailboxViewController.swift in Sources */,
 				AEE6EC482283045D00EDC689 /* EditSettingsController.swift in Sources */,
 				305961DF2346125100C80F33 /* MessageCellDelegate.swift in Sources */,
-				AE13E5E32449AAC600FCD5D4 /* TextCell.swift in Sources */,
 				302B84CE2397F6CD001C261F /* URL+Extension.swift in Sources */,
 				305961CC2346125100C80F33 /* UIView+Extensions.swift in Sources */,
 				7A9FB1441FB061E2001FEA36 /* AppDelegate.swift in Sources */,

+ 9 - 11
deltachat-ios/Controller/ProfileInfoViewController.swift

@@ -17,13 +17,6 @@ class ProfileInfoViewController: UITableViewController {
         )
     }()
 
-    private lazy var headerCell: TextCell = {
-        let cell = TextCell(style: .default, reuseIdentifier: nil)
-        let email = dcContext.addr ?? ""
-        cell.content = String.localizedStringWithFormat(NSLocalizedString("qraccount_success_enter_name", comment: ""), email)
-        return cell
-    }()
-
     private lazy var emailCell: TextFieldCell = {
         let cell = TextFieldCell(description: "Meine Email Adresse", placeholder: "Meine Email")
         cell.setText(text: dcContext.addr)
@@ -46,7 +39,7 @@ class ProfileInfoViewController: UITableViewController {
         return cell
     }()
 
-    private lazy var cells = [headerCell, avatarCell, nameCell]
+    private lazy var cells = [nameCell, avatarCell]
 
     init(context: DcContext) {
         self.dcContext = context
@@ -77,15 +70,20 @@ class ProfileInfoViewController: UITableViewController {
     override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
 
         let cell = cells[indexPath.row]
-        if let textCell = cell as? TextCell {
-            return textCell.intrinsicCellHeight
-        }
         if cell is AvatarSelectionCell {
             return AvatarSelectionCell.cellHeight
         }
         return Constants.defaultCellHeight
     }
 
+    override func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? {
+        let email = dcContext.addr ?? ""
+        let footerTitle = String.localizedStringWithFormat(
+            NSLocalizedString("qraccount_success_enter_name",comment: ""), email
+        )
+        return footerTitle
+    }
+
     // MARK: - updates
     private func updateAvatarCell() {
         if let avatarImage = dcContext.getSelfAvatarImage() {

+ 12 - 0
deltachat-ios/Coordinator/AppCoordinator.swift

@@ -180,6 +180,18 @@ extension AppCoordinator: WelcomeCoordinator {
 
     func handleQRAccountCreationSuccess() {
         self.presentTabBarController()
+        showTab(index: 1)
+        presentProfileInfoController()
+    }
+
+    private func presentProfileInfoController() {
+        let profileInfoController = ProfileInfoViewController(context: dcContext)
+        let profileInfoNav = UINavigationController(rootViewController: profileInfoController)
+        profileInfoNav.modalPresentationStyle = .fullScreen
+        let coordinator = EditSettingsCoordinator(dcContext: dcContext, navigationController: profileInfoNav)
+        profileInfoController.coordinator = coordinator
+        childCoordinators.append(coordinator)
+        tabBarController.present(profileInfoNav, animated: false, completion: nil)
     }
 
     @objc private func cancelButtonPressed(_ sender: UIBarButtonItem) {

+ 0 - 42
deltachat-ios/View/Cell/TextCell.swift

@@ -1,42 +0,0 @@
-import UIKit
-
-/*
- cell that displays text and grows in size
-*/
-
-class TextCell: UITableViewCell {
-
-    var content: String? {
-        set {
-            textLabel?.text = newValue
-        }
-        get {
-            return textLabel?.text
-        }
-    }
-
-    var intrinsicCellHeight: CGFloat {
-        return intrinsicContentSize.height
-    }
-
-    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
-        super.init(style: style, reuseIdentifier: reuseIdentifier)
-        setupSubviews()
-        textLabel?.numberOfLines = 0
-    }
-
-    required init?(coder: NSCoder) {
-        fatalError("init(coder:) has not been implemented")
-    }
-
-    private func setupSubviews() {
-        guard let textLabel = self.textLabel else {
-            return
-        }
-        textLabel.translatesAutoresizingMaskIntoConstraints = false
-        textLabel.leadingAnchor.constraint(equalTo: contentView.layoutMarginsGuide.leadingAnchor, constant: 0).isActive = true
-        textLabel.topAnchor.constraint(equalTo: contentView.layoutMarginsGuide.topAnchor, constant: 0).isActive = true
-        textLabel.trailingAnchor.constraint(equalTo: contentView.layoutMarginsGuide.trailingAnchor, constant: 0).isActive = true
-        textLabel.bottomAnchor.constraint(equalTo: contentView.layoutMarginsGuide.bottomAnchor, constant: 0).isActive = true
-    }
-}