Browse Source

Merge pull request #96 from deltachat/deleteAccount

deleting account now leads back to login page
nayooti 6 years ago
parent
commit
a215d03d21

+ 0 - 1
deltachat-ios/AppDelegate.swift

@@ -165,7 +165,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
 
   func close() {
     state = .stopped
-
     dc_close(mailboxPointer)
     mailboxPointer = nil
   }

+ 3 - 4
deltachat-ios/Controller/SettingsController.swift

@@ -197,7 +197,7 @@ internal final class SettingsViewController: QuickTableViewController {
 
 		let dbfile = appDelegate.dbfile()
 		let dburl = URL(fileURLWithPath: dbfile, isDirectory: false)
-		let alert = UIAlertController(title: "Delete Account", message: "Are you sure you wante to delete your account data?", preferredStyle: .alert)
+		let alert = UIAlertController(title: "Delete Account", message: "Are you sure you wante to delete your account data?", preferredStyle: .actionSheet)
 
 		alert.addAction(UIAlertAction(title: "Delete", style: .destructive, handler: { _ in
 			appDelegate.stop()
@@ -214,11 +214,10 @@ internal final class SettingsViewController: QuickTableViewController {
 			// refresh our view
 			self.setTable()
 			self.tableView.reloadData()
-
-			self.dismiss(animated: true, completion: nil)
+			self.dismiss(animated: false, completion: nil)
+			self.coordinator?.showLoginController()
 		}))
 		alert.addAction(UIAlertAction(title: "Cancel", style: .cancel))
-
 		present(alert, animated: true, completion: nil)
 	}
 

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

@@ -208,6 +208,15 @@ class SettingsCoordinator: Coordinator {
 		editController.activateField(option: option)
 		navigationController.pushViewController(editController, animated: true)
 	}
+
+	func showLoginController() {
+		let accountSetupVC = AccountSetupController()
+		let coordinator = AccountSetupCoordinator(navigationController: navigationController)
+		childCoordinators.append(coordinator)
+		accountSetupVC.coordinator = coordinator
+		let accountSetupNavigationController = NavigationController(rootViewController: accountSetupVC)
+		navigationController.present(accountSetupNavigationController, animated: true, completion: nil)
+	}
 }
 
 class AccountSetupCoordinator: Coordinator {