Browse Source

password *** and email be shown if logged in, also during oAuth-Login

Bastian van de Wetering 6 years ago
parent
commit
2544fc8aed
2 changed files with 13 additions and 5 deletions
  1. 6 0
      deltachat-ios/AccountSetupController.swift
  2. 7 5
      deltachat-ios/TextFieldCell.swift

+ 6 - 0
deltachat-ios/AccountSetupController.swift

@@ -24,6 +24,7 @@ class AccountSetupController: UITableViewController {
 		let cell = TextFieldCell.makeEmailCell(delegate: self)
 		cell.textField.tag = 0
 		cell.textField.accessibilityIdentifier = "emailTextField"	// will be used to eventually show oAuth-Dialogue when pressing return key
+		cell.setText(text: MRConfig.addr ?? nil)
 		return cell
 	}()
 
@@ -31,6 +32,7 @@ class AccountSetupController: UITableViewController {
 		let cell = TextFieldCell.makePasswordCell(delegate: self)
 		cell.textField.tag = 1
 		cell.accessibilityIdentifier = "passwordCell"	// will be used to eventually show oAuth-Dialogue when selecting
+		cell.setText(text: MRConfig.mailPw ?? nil)
 		return cell
 	}()
 
@@ -153,6 +155,8 @@ class AccountSetupController: UITableViewController {
 		super.viewDidAppear(animated)
 		addProgressHudEventListener()
 		//loginButton.isEnabled = false
+		print(emailCell.getText())
+		print("account setup appeared")
 	}
 
 	override func viewDidDisappear(_ animated: Bool) {
@@ -348,6 +352,7 @@ class AccountSetupController: UITableViewController {
 			return
 			
 		}
+		passwordCell.setText(text: token)
 		MRConfig.setAuthFlags(flags: Int(DC_LP_AUTH_OAUTH2))
 		login(emailAddress: emailAddress, password: token, skipAdvanceSetup: true)
 	}
@@ -427,6 +432,7 @@ class AccountSetupController: UITableViewController {
 	}
 
 	private func handleLoginSuccess() {
+		// used when login hud successfully went trough
 		self.dismiss(animated: true, completion: nil)
 	}
 }

+ 7 - 5
deltachat-ios/TextFieldCell.swift

@@ -67,12 +67,16 @@ class TextFieldCell: UITableViewCell {
 		} else {
 			return nil
 		}
-}
+	}
+
 
+	func setText(text: String?) {
+		self.textField.text = text
+	}
+	
 
 	static func makeEmailCell(delegate: UITextFieldDelegate? = nil) -> TextFieldCell {
         let cell = TextFieldCell(description: "Email", placeholder: "you@example.com")
-
         cell.textField.keyboardType = .emailAddress
         // switch off quicktype
         cell.textField.autocorrectionType = .no
@@ -83,11 +87,9 @@ class TextFieldCell: UITableViewCell {
 
     static func makePasswordCell(delegate: UITextFieldDelegate? = nil) -> TextFieldCell {
         let cell = TextFieldCell(description: "Password", placeholder: "your IMAP password")
-
         cell.textField.textContentType = UITextContentType.password
         cell.textField.isSecureTextEntry = true
-
-        return cell
+		return cell
     }
 
     static func makeNameCell(delegate: UITextFieldDelegate? = nil) -> TextFieldCell {