فهرست منبع

added actionCell type - with centered label in system blue - added restore function to account setup controller

Bastian van de Wetering 6 سال پیش
والد
کامیت
457e17cee0

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

@@ -67,7 +67,7 @@
 		78E45E3021D1774200D4B15E /* dc_move.c in Sources */ = {isa = PBXBuildFile; fileRef = 78E45E2E21D1774200D4B15E /* dc_move.c */; };
 		78E45E3021D1774200D4B15E /* dc_move.c in Sources */ = {isa = PBXBuildFile; fileRef = 78E45E2E21D1774200D4B15E /* dc_move.c */; };
 		78E45E3321D3CBC000D4B15E /* AppTabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78E45E3221D3CBC000D4B15E /* AppTabBarController.swift */; };
 		78E45E3321D3CBC000D4B15E /* AppTabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78E45E3221D3CBC000D4B15E /* AppTabBarController.swift */; };
 		78E45E3A21D3CFBC00D4B15E /* SettingsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78E45E3921D3CFBC00D4B15E /* SettingsController.swift */; };
 		78E45E3A21D3CFBC00D4B15E /* SettingsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78E45E3921D3CFBC00D4B15E /* SettingsController.swift */; };
-		78E45E3C21D3D03700D4B15E /* TableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78E45E3B21D3D03700D4B15E /* TableViewCell.swift */; };
+		78E45E3C21D3D03700D4B15E /* TextFieldTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78E45E3B21D3D03700D4B15E /* TextFieldTableViewCell.swift */; };
 		78E45E3E21D3D28C00D4B15E /* NavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78E45E3D21D3D28C00D4B15E /* NavigationController.swift */; };
 		78E45E3E21D3D28C00D4B15E /* NavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78E45E3D21D3D28C00D4B15E /* NavigationController.swift */; };
 		78E45E4021D3D70700D4B15E /* ContactListController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78E45E3F21D3D70700D4B15E /* ContactListController.swift */; };
 		78E45E4021D3D70700D4B15E /* ContactListController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78E45E3F21D3D70700D4B15E /* ContactListController.swift */; };
 		78E45E4221D3DB4000D4B15E /* UIViewController+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78E45E4121D3DB4000D4B15E /* UIViewController+Extension.swift */; };
 		78E45E4221D3DB4000D4B15E /* UIViewController+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78E45E4121D3DB4000D4B15E /* UIViewController+Extension.swift */; };
@@ -89,6 +89,8 @@
 		7AE0A5491FC42F65005ECB4B /* NewChatViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE0A5481FC42F65005ECB4B /* NewChatViewController.swift */; };
 		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 */; };
 		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 */; };
 		AE0D26FD1FB1FE88002FAFCE /* ChatListController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE0D26FC1FB1FE88002FAFCE /* ChatListController.swift */; };
+		AE38B31822672DFC00EC37A1 /* ActionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE38B31722672DFC00EC37A1 /* ActionCell.swift */; };
+		AE38B31A2267328200EC37A1 /* Colors.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE38B3192267328200EC37A1 /* Colors.swift */; };
 		AEACE2DD1FB323CA00DCDD78 /* ChatViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEACE2DC1FB323CA00DCDD78 /* ChatViewController.swift */; };
 		AEACE2DD1FB323CA00DCDD78 /* ChatViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEACE2DC1FB323CA00DCDD78 /* ChatViewController.swift */; };
 		AEACE2DF1FB3246400DCDD78 /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEACE2DE1FB3246400DCDD78 /* Message.swift */; };
 		AEACE2DF1FB3246400DCDD78 /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEACE2DE1FB3246400DCDD78 /* Message.swift */; };
 		AEACE2E31FB32B5C00DCDD78 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEACE2E21FB32B5C00DCDD78 /* Constants.swift */; };
 		AEACE2E31FB32B5C00DCDD78 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEACE2E21FB32B5C00DCDD78 /* Constants.swift */; };
@@ -199,7 +201,7 @@
 		78E45E2E21D1774200D4B15E /* dc_move.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = dc_move.c; path = "deltachat-ios/libraries/deltachat-core/src/dc_move.c"; sourceTree = "<group>"; };
 		78E45E2E21D1774200D4B15E /* dc_move.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = dc_move.c; path = "deltachat-ios/libraries/deltachat-core/src/dc_move.c"; sourceTree = "<group>"; };
 		78E45E3221D3CBC000D4B15E /* AppTabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppTabBarController.swift; sourceTree = "<group>"; };
 		78E45E3221D3CBC000D4B15E /* AppTabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppTabBarController.swift; sourceTree = "<group>"; };
 		78E45E3921D3CFBC00D4B15E /* SettingsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsController.swift; sourceTree = "<group>"; };
 		78E45E3921D3CFBC00D4B15E /* SettingsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsController.swift; sourceTree = "<group>"; };
-		78E45E3B21D3D03700D4B15E /* TableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewCell.swift; sourceTree = "<group>"; };
+		78E45E3B21D3D03700D4B15E /* TextFieldTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldTableViewCell.swift; sourceTree = "<group>"; };
 		78E45E3D21D3D28C00D4B15E /* NavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationController.swift; sourceTree = "<group>"; };
 		78E45E3D21D3D28C00D4B15E /* NavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationController.swift; sourceTree = "<group>"; };
 		78E45E3F21D3D70700D4B15E /* ContactListController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactListController.swift; sourceTree = "<group>"; };
 		78E45E3F21D3D70700D4B15E /* ContactListController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactListController.swift; sourceTree = "<group>"; };
 		78E45E4121D3DB4000D4B15E /* UIViewController+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Extension.swift"; sourceTree = "<group>"; };
 		78E45E4121D3DB4000D4B15E /* UIViewController+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Extension.swift"; sourceTree = "<group>"; };
@@ -263,6 +265,8 @@
 		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>"; };
 		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>"; };
 		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; lastKnownFileType = sourcecode.swift; path = ChatListController.swift; sourceTree = "<group>"; };
 		AE0D26FC1FB1FE88002FAFCE /* ChatListController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatListController.swift; sourceTree = "<group>"; };
+		AE38B31722672DFC00EC37A1 /* ActionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionCell.swift; sourceTree = "<group>"; };
+		AE38B3192267328200EC37A1 /* Colors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Colors.swift; sourceTree = "<group>"; };
 		AEA9CC2F22522DA20061D113 /* librpgp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = librpgp.h; sourceTree = "<group>"; };
 		AEA9CC2F22522DA20061D113 /* librpgp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = librpgp.h; sourceTree = "<group>"; };
 		AEACE2DC1FB323CA00DCDD78 /* ChatViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatViewController.swift; sourceTree = "<group>"; };
 		AEACE2DC1FB323CA00DCDD78 /* ChatViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatViewController.swift; sourceTree = "<group>"; };
 		AEACE2DE1FB3246400DCDD78 /* Message.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Message.swift; sourceTree = "<group>"; };
 		AEACE2DE1FB3246400DCDD78 /* Message.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Message.swift; sourceTree = "<group>"; };
@@ -416,7 +420,9 @@
 				7A9FB4F81FB084E6001FEA36 /* Frameworks */,
 				7A9FB4F81FB084E6001FEA36 /* Frameworks */,
 				7DB2DC4CCB84D323E5130F99 /* Pods */,
 				7DB2DC4CCB84D323E5130F99 /* Pods */,
 			);
 			);
+			indentWidth = 2;
 			sourceTree = "<group>";
 			sourceTree = "<group>";
+			tabWidth = 2;
 		};
 		};
 		7A9FB1411FB061E2001FEA36 /* Products */ = {
 		7A9FB1411FB061E2001FEA36 /* Products */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
@@ -462,10 +468,12 @@
 				AEACE2E21FB32B5C00DCDD78 /* Constants.swift */,
 				AEACE2E21FB32B5C00DCDD78 /* Constants.swift */,
 				78ED839321D5AF8A00243125 /* QrCodeView.swift */,
 				78ED839321D5AF8A00243125 /* QrCodeView.swift */,
 				AEACE2E41FB32E1900DCDD78 /* Utils.swift */,
 				AEACE2E41FB32E1900DCDD78 /* Utils.swift */,
-				78E45E3B21D3D03700D4B15E /* TableViewCell.swift */,
+				78E45E3B21D3D03700D4B15E /* TextFieldTableViewCell.swift */,
 				78ED838221D5379000243125 /* TextFieldCell.swift */,
 				78ED838221D5379000243125 /* TextFieldCell.swift */,
 				AEE56D752253431E007DC082 /* AccountSetupController.swift */,
 				AEE56D752253431E007DC082 /* AccountSetupController.swift */,
 				AEE56D7C2253ADB4007DC082 /* HudHandler.swift */,
 				AEE56D7C2253ADB4007DC082 /* HudHandler.swift */,
+				AE38B31722672DFC00EC37A1 /* ActionCell.swift */,
+				AE38B3192267328200EC37A1 /* Colors.swift */,
 			);
 			);
 			path = "deltachat-ios";
 			path = "deltachat-ios";
 			sourceTree = "<group>";
 			sourceTree = "<group>";
@@ -806,7 +814,7 @@
 				7AE0A5491FC42F65005ECB4B /* NewChatViewController.swift in Sources */,
 				7AE0A5491FC42F65005ECB4B /* NewChatViewController.swift in Sources */,
 				78E45E3A21D3CFBC00D4B15E /* SettingsController.swift in Sources */,
 				78E45E3A21D3CFBC00D4B15E /* SettingsController.swift in Sources */,
 				78ED838321D5379000243125 /* TextFieldCell.swift in Sources */,
 				78ED838321D5379000243125 /* TextFieldCell.swift in Sources */,
-				78E45E3C21D3D03700D4B15E /* TableViewCell.swift in Sources */,
+				78E45E3C21D3D03700D4B15E /* TextFieldTableViewCell.swift in Sources */,
 				7070FB7220FF345F000DC258 /* dc_key.c in Sources */,
 				7070FB7220FF345F000DC258 /* dc_key.c in Sources */,
 				7070FB7420FF345F000DC258 /* dc_e2ee.c in Sources */,
 				7070FB7420FF345F000DC258 /* dc_e2ee.c in Sources */,
 				AE0D26FD1FB1FE88002FAFCE /* ChatListController.swift in Sources */,
 				AE0D26FD1FB1FE88002FAFCE /* ChatListController.swift in Sources */,
@@ -833,6 +841,7 @@
 				789E879D21D6DF86003ED1C5 /* ProgressHud.swift in Sources */,
 				789E879D21D6DF86003ED1C5 /* ProgressHud.swift in Sources */,
 				7070FB8C20FF4118000DC258 /* dc_contact.c in Sources */,
 				7070FB8C20FF4118000DC258 /* dc_contact.c in Sources */,
 				78E45E4C21D404AE00D4B15E /* CustomCell.swift in Sources */,
 				78E45E4C21D404AE00D4B15E /* CustomCell.swift in Sources */,
+				AE38B31A2267328200EC37A1 /* Colors.swift in Sources */,
 				7070FB7020FF345F000DC258 /* dc_lot.c in Sources */,
 				7070FB7020FF345F000DC258 /* dc_lot.c in Sources */,
 				789E879621D6CB58003ED1C5 /* QrCodeReaderController.swift in Sources */,
 				789E879621D6CB58003ED1C5 /* QrCodeReaderController.swift in Sources */,
 				7070FB5F20FF345F000DC258 /* dc_tools.c in Sources */,
 				7070FB5F20FF345F000DC258 /* dc_tools.c in Sources */,
@@ -846,6 +855,7 @@
 				7070FB5E20FF345F000DC258 /* dc_token.c in Sources */,
 				7070FB5E20FF345F000DC258 /* dc_token.c in Sources */,
 				7070FB6C20FF345F000DC258 /* dc_keyring.c in Sources */,
 				7070FB6C20FF345F000DC258 /* dc_keyring.c in Sources */,
 				7A451DB01FB1F84900177250 /* AppCoordinator.swift in Sources */,
 				7A451DB01FB1F84900177250 /* AppCoordinator.swift in Sources */,
+				AE38B31822672DFC00EC37A1 /* ActionCell.swift in Sources */,
 				785BE16821E247F1003BE98C /* MessageInfoViewController.swift in Sources */,
 				785BE16821E247F1003BE98C /* MessageInfoViewController.swift in Sources */,
 				AEACE2E31FB32B5C00DCDD78 /* Constants.swift in Sources */,
 				AEACE2E31FB32B5C00DCDD78 /* Constants.swift in Sources */,
 			);
 			);

+ 61 - 30
deltachat-ios/AccountSetupController.swift

@@ -35,24 +35,12 @@ class AccountSetupController: UITableViewController {
     return cell
     return cell
   }()
   }()
 
 
-  /*
-   Advanced Cells:
-   IMAP Server, IMAP User, IMAP Port, IMAP Security, SMTP Server, SMTP User, SMTP Port, SMTP Password, SMTP Security
-   */
-  /*
-   lazy var imapServerCell = TextFieldCell(description: "IMAP Server", placeholder: MRConfig.mailServer ?? MRConfig.configuredMailServer)
-   lazy var imapUserCell = TextFieldCell(description: "IMAP User", placeholder: MRConfig.mailUser ?? MRConfig.configuredMailUser)
-   lazy var imapPortCell = TextFieldCell(description: "IMAP Port", placeholder: MRConfig.mailPort ?? MRConfig.configuredMailPort)
-   lazy var imapSecurityCell = TextFieldCell(description: "IMAP Security", placeholder: "to do")
-
-   lazy var smtpServerCell = TextFieldCell(description: "SMTP Server", placeholder: MRConfig.sendServer ?? MRConfig.configuredSendServer)
-   lazy var smtpUserCell = TextFieldCell(description: "SMTP User", placeholder: MRConfig.sendUser ?? MRConfig.configuredSendUser)
-   lazy var smtpPortCell = TextFieldCell(description: "SMTP Port", placeholder: MRConfig.sendPort ?? MRConfig.configuredSendPort)
-   lazy var smtpPasswordCell = TextFieldCell(description: "SMTP Password", placeholder: "*************")
-   lazy var smtpSecurityCell = TextFieldCell(description: "SMTP Security", placeholder: "to do")
-   */
+	private lazy var restoreCell: ActionCell = {
+		let cell = ActionCell(title: "Restore from backup")
+		cell.accessibilityIdentifier = "restoreCell"
+		return cell
+	}()
 
 
-  // TODO: consider adding delegates and tags by loop - leave for now like this
   lazy var imapServerCell: TextFieldCell = {
   lazy var imapServerCell: TextFieldCell = {
     let cell = TextFieldCell(description: "IMAP Server", placeholder: MRConfig.mailServer ?? MRConfig.configuredMailServer, delegate: self)
     let cell = TextFieldCell(description: "IMAP Server", placeholder: MRConfig.mailServer ?? MRConfig.configuredMailServer, delegate: self)
     cell.accessibilityIdentifier = "IMAPServerCell"
     cell.accessibilityIdentifier = "IMAPServerCell"
@@ -124,6 +112,7 @@ class AccountSetupController: UITableViewController {
   let loginButton: UIBarButtonItem = UIBarButtonItem(title: "Login", style: .done, target: self, action: #selector(loginButtonPressed))
   let loginButton: UIBarButtonItem = UIBarButtonItem(title: "Login", style: .done, target: self, action: #selector(loginButtonPressed))
 
 
   private lazy var basicSectionCells: [UITableViewCell] = [emailCell, passwordCell]
   private lazy var basicSectionCells: [UITableViewCell] = [emailCell, passwordCell]
+	private lazy var restoreCells: [UITableViewCell] = [restoreCell]
   private lazy var advancedSectionCells: [UITableViewCell] = [
   private lazy var advancedSectionCells: [UITableViewCell] = [
     imapServerCell,
     imapServerCell,
     imapUserCell,
     imapUserCell,
@@ -149,7 +138,7 @@ class AccountSetupController: UITableViewController {
   override func viewDidLoad() {
   override func viewDidLoad() {
     super.viewDidLoad()
     super.viewDidLoad()
     title = "Login to your server"
     title = "Login to your server"
-    navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Close", style: .plain, target: self, action: #selector(closeButtonPressed))
+    // navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Close", style: .plain, target: self, action: #selector(closeButtonPressed))
     navigationItem.rightBarButtonItem = loginButton
     navigationItem.rightBarButtonItem = loginButton
   }
   }
 
 
@@ -176,20 +165,22 @@ class AccountSetupController: UITableViewController {
 
 
   override func numberOfSections(in _: UITableView) -> Int {
   override func numberOfSections(in _: UITableView) -> Int {
     // #warning Incomplete implementation, return the number of sections
     // #warning Incomplete implementation, return the number of sections
-    return 2
+    return 3
   }
   }
 
 
   override func tableView(_: UITableView, numberOfRowsInSection section: Int) -> Int {
   override func tableView(_: UITableView, numberOfRowsInSection section: Int) -> Int {
     // #warning Incomplete implementation, return the number of rows
     // #warning Incomplete implementation, return the number of rows
     if section == 0 {
     if section == 0 {
-      return basicSectionCells.count
+			return basicSectionCells.count
+		} else if section == 1 {
+			return restoreCells.count
     } else {
     } else {
       return advancedSectionShowing ? advancedSectionCells.count : 0
       return advancedSectionShowing ? advancedSectionCells.count : 0
     }
     }
   }
   }
 
 
   override func tableView(_: UITableView, titleForHeaderInSection section: Int) -> String? {
   override func tableView(_: UITableView, titleForHeaderInSection section: Int) -> String? {
-    if section == 1 {
+    if section == 2 {
       return "Advanced"
       return "Advanced"
     } else {
     } else {
       return nil
       return nil
@@ -197,7 +188,7 @@ class AccountSetupController: UITableViewController {
   }
   }
 
 
   override func tableView(_: UITableView, viewForHeaderInSection section: Int) -> UIView? {
   override func tableView(_: UITableView, viewForHeaderInSection section: Int) -> UIView? {
-    if section == 1 {
+    if section == 2 {
       // Advanced Header
       // Advanced Header
       let advancedView = AdvancedSectionHeader()
       let advancedView = AdvancedSectionHeader()
       advancedView.handleTap = toggleAdvancedSection
       advancedView.handleTap = toggleAdvancedSection
@@ -216,9 +207,12 @@ class AccountSetupController: UITableViewController {
   override func tableView(_: UITableView, titleForFooterInSection section: Int) -> String? {
   override func tableView(_: UITableView, titleForFooterInSection section: Int) -> String? {
     if section == 0 {
     if section == 0 {
       return "There are no Delta Chat servers, your data stays on your device!"
       return "There are no Delta Chat servers, your data stays on your device!"
-    } else {
+    } else if section == 2{
       return "For known email providers additional settings are setup automatically. Sometimes IMAP needs to be enabled in the web frontend. Consult your email provider or friends for help"
       return "For known email providers additional settings are setup automatically. Sometimes IMAP needs to be enabled in the web frontend. Consult your email provider or friends for help"
-    }
+		} else {
+			return nil
+		}
+
   }
   }
 
 
   override func tableView(_: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
   override func tableView(_: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
@@ -228,6 +222,8 @@ class AccountSetupController: UITableViewController {
     if section == 0 {
     if section == 0 {
       // basicSection
       // basicSection
       return basicSectionCells[row]
       return basicSectionCells[row]
+		} else if section == 1 {
+			return restoreCells[row]
     } else {
     } else {
       // advancedSection
       // advancedSection
       return advancedSectionCells[row]
       return advancedSectionCells[row]
@@ -235,21 +231,27 @@ class AccountSetupController: UITableViewController {
   }
   }
 
 
   override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
   override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
-    // handle tap on password -> show eventuall oAuthDialogue
-    if let cell = tableView.cellForRow(at: indexPath) as? TextFieldCell {
-      if cell.accessibilityIdentifier == "passwordCell" {
-        if let emailAdress = cell.getText() {
+
+		guard let tappedCell = tableView.cellForRow(at: indexPath) else { return }
+		// handle tap on password -> show oAuthDialogue
+    if let textFieldCell = tappedCell as? TextFieldCell {
+      if textFieldCell.accessibilityIdentifier == "passwordCell" {
+        if let emailAdress = textFieldCell.getText() {
           _ = showOAuthAlertIfNeeded(emailAddress: emailAdress, handleCancel: nil)
           _ = showOAuthAlertIfNeeded(emailAddress: emailAdress, handleCancel: nil)
         }
         }
       }
       }
     }
     }
+
+		if tappedCell.accessibilityIdentifier == "restoreCell" {
+				self.restoreBackup()
+		}
   }
   }
 
 
   private func toggleAdvancedSection(button: UILabel) {
   private func toggleAdvancedSection(button: UILabel) {
     let willShow = !advancedSectionShowing
     let willShow = !advancedSectionShowing
 
 
     // extract indexPaths from advancedCells
     // extract indexPaths from advancedCells
-    let advancedIndexPaths: [IndexPath] = advancedSectionCells.indices.map { IndexPath(row: $0, section: 1) }
+    let advancedIndexPaths: [IndexPath] = advancedSectionCells.indices.map { IndexPath(row: $0, section: 2) }
 
 
     // advancedSectionCells.indices.map({indexPaths.append(IndexPath(row: $0, section: 1))}
     // advancedSectionCells.indices.map({indexPaths.append(IndexPath(row: $0, section: 1))}
 
 
@@ -284,7 +286,7 @@ class AccountSetupController: UITableViewController {
   private func login(emailAddress: String, password: String, skipAdvanceSetup: Bool = false) {
   private func login(emailAddress: String, password: String, skipAdvanceSetup: Bool = false) {
     MRConfig.addr = emailAddress
     MRConfig.addr = emailAddress
     MRConfig.mailPw = password
     MRConfig.mailPw = password
-    if skipAdvanceSetup {
+    if !skipAdvanceSetup {
       evaluluateAdvancedSetup() // this will set MRConfig related to advanced fields
       evaluluateAdvancedSetup() // this will set MRConfig related to advanced fields
     }
     }
     dc_configure(mailboxPointer)
     dc_configure(mailboxPointer)
@@ -415,6 +417,35 @@ class AccountSetupController: UITableViewController {
     }
     }
   }
   }
 
 
+	private func restoreBackup() {
+		logger.info("restoring backup")
+		if MRConfig.configured {
+			return
+		}
+		let documents = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)
+		if !documents.isEmpty {
+			logger.info("looking for backup in: \(documents[0])")
+
+			if let file = dc_imex_has_backup(mailboxPointer, documents[0]) {
+				logger.info("restoring backup: \(String(cString: file))")
+
+				hudHandler.showBackupHud("Restoring Backup")
+				dc_imex(mailboxPointer, DC_IMEX_IMPORT_BACKUP, file, nil)
+
+				return
+			}
+
+			let alert = UIAlertController(title: "Can not restore", message: "No Backup found", preferredStyle: .alert)
+			alert.addAction(UIAlertAction(title: "OK", style: .cancel, handler: { _ in
+
+			}))
+			present(alert, animated: true, completion: nil)
+			return
+		}
+
+		logger.error("no documents directory found")
+	}
+
   private func handleLoginSuccess() {
   private func handleLoginSuccess() {
     // used when login hud successfully went trough
     // used when login hud successfully went trough
     dismiss(animated: true, completion: nil)
     dismiss(animated: true, completion: nil)

+ 61 - 0
deltachat-ios/ActionCell.swift

@@ -0,0 +1,61 @@
+//
+//  ActionCell.swift
+//  deltachat-ios
+//
+//  Created by Bastian van de Wetering on 17.04.19.
+//  Copyright © 2019 Jonas Reinsch. All rights reserved.
+//
+
+import UIKit
+
+
+// a cell with a centered label in system blue
+
+class ActionCell: UITableViewCell {
+
+	var actionTitle: String? {
+		didSet {
+			actionLabel.text = actionTitle
+		}
+	}
+
+	private lazy var actionLabel:UILabel = {
+		let label = UILabel()
+		label.text = actionTitle
+		label.textColor = UIColor.systemBlue
+		return label
+	}()
+
+	// use this constructor if cell won't be reused
+	init(title: String) {
+		actionTitle = title
+		super.init(style: .default, reuseIdentifier: nil)
+		setupSubviews()
+	}
+
+	override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
+		super.init(style: style, reuseIdentifier: reuseIdentifier)
+		setupSubviews()
+	}
+
+	required init?(coder aDecoder: NSCoder) {
+		fatalError("init(coder:) has not been implemented")
+	}
+
+	override func awakeFromNib() {
+			super.awakeFromNib()
+			// Initialization code
+	}
+
+	override func setSelected(_ selected: Bool, animated: Bool) {
+			// no selection style ...
+	}
+
+	private func setupSubviews() {
+		contentView.addSubview(actionLabel)
+		actionLabel.translatesAutoresizingMaskIntoConstraints = false
+		actionLabel.centerXAnchor.constraint(equalTo: contentView.centerXAnchor, constant: 0).isActive = true
+		actionLabel.centerYAnchor.constraint(equalTo: contentView.centerYAnchor, constant: 0).isActive = true
+	}
+
+}

+ 15 - 0
deltachat-ios/Colors.swift

@@ -0,0 +1,15 @@
+//
+//  Colors.swift
+//  deltachat-ios
+//
+//  Created by Bastian van de Wetering on 17.04.19.
+//  Copyright © 2019 Jonas Reinsch. All rights reserved.
+//
+
+import UIKit
+
+extension UIColor {
+	static var systemBlue: UIColor {
+		return UIButton(type: .system).tintColor
+	}
+}

+ 1 - 5
deltachat-ios/Extensions/Extensions.swift

@@ -14,11 +14,7 @@ extension String {
   }
   }
 }
 }
 
 
-extension UIColor {
-  static var systemBlue: UIColor {
-    return UIButton(type: .system).tintColor
-  }
-}
+
 
 
 extension URL {
 extension URL {
   public var queryParameters: [String: String]? {
   public var queryParameters: [String: String]? {

+ 0 - 0
deltachat-ios/TableViewCell.swift → deltachat-ios/TextFieldTableViewCell.swift