Fix some UI issues introduced by refactoring

This commit is contained in:
Mingshen Sun 2019-12-01 00:25:24 -08:00
parent efdc45ea89
commit cea1332b0d
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4
6 changed files with 9 additions and 5 deletions

View file

@ -710,6 +710,7 @@
A217ACE31E9BBBBD00A1A6CF /* GitConfigSettingTableViewController.swift */, A217ACE31E9BBBBD00A1A6CF /* GitConfigSettingTableViewController.swift */,
DCA049991E335CC800522E8F /* GitServerSettingTableViewController.swift */, DCA049991E335CC800522E8F /* GitServerSettingTableViewController.swift */,
DCC441531E916382008A90C4 /* GitSSHKeyArmorSettingTableViewController.swift */, DCC441531E916382008A90C4 /* GitSSHKeyArmorSettingTableViewController.swift */,
DC8963BF1E38EEB900828B09 /* SSHKeySettingTableViewController.swift */,
DC037CA51E4B883900609409 /* OpenSourceComponentsTableViewController.swift */, DC037CA51E4B883900609409 /* OpenSourceComponentsTableViewController.swift */,
DC4914981E434600007FF592 /* PasswordDetailTableViewController.swift */, DC4914981E434600007FF592 /* PasswordDetailTableViewController.swift */,
DCFB77A81E502FF6008DE471 /* PasswordEditorTableViewController.swift */, DCFB77A81E502FF6008DE471 /* PasswordEditorTableViewController.swift */,
@ -721,7 +722,6 @@
DCD3C65D1EFB9BB400CBE842 /* SettingsSplitViewController.swift */, DCD3C65D1EFB9BB400CBE842 /* SettingsSplitViewController.swift */,
DCAAF7441E2FA66800AB94BC /* SettingsTableViewController.swift */, DCAAF7441E2FA66800AB94BC /* SettingsTableViewController.swift */,
DC037CA91E4B8EAE00609409 /* SpecialThanksTableViewController.swift */, DC037CA91E4B8EAE00609409 /* SpecialThanksTableViewController.swift */,
DC8963BF1E38EEB900828B09 /* SSHKeySettingTableViewController.swift */,
); );
path = Controllers; path = Controllers;
sourceTree = "<group>"; sourceTree = "<group>";

View file

@ -66,6 +66,7 @@ class GitSSHKeyArmorSettingTableViewController: AutoCellHeightUITableViewControl
Utils.alert(title: "CannotSave".localize(), message: "CannotSaveSshKey".localize(), controller: self, completion: nil) Utils.alert(title: "CannotSave".localize(), message: "CannotSaveSshKey".localize(), controller: self, completion: nil)
} }
SharedDefaults[.gitSSHKeySource] = .armor SharedDefaults[.gitSSHKeySource] = .armor
SharedDefaults[.gitAuthenticationMethod] = .key
self.navigationController!.popViewController(animated: true) self.navigationController!.popViewController(animated: true)
} }

View file

@ -65,7 +65,6 @@ class GitServerSettingTableViewController: UITableViewController {
usernameTextField.text = self.gitUsername usernameTextField.text = self.gitUsername
branchNameTextField.text = self.gitBranchName branchNameTextField.text = self.gitBranchName
sshLabel = authSSHKeyCell.subviews[0].subviews[0] as? UILabel sshLabel = authSSHKeyCell.subviews[0].subviews[0] as? UILabel
updateAuthenticationMethodCheckView(for: .password)
authSSHKeyCell.accessoryType = .detailButton authSSHKeyCell.accessoryType = .detailButton
} }
@ -73,6 +72,7 @@ class GitServerSettingTableViewController: UITableViewController {
super.viewWillAppear(animated) super.viewWillAppear(animated)
// Grey out ssh option if ssh_key is not present. // Grey out ssh option if ssh_key is not present.
sshLabel?.isEnabled = AppKeychain.shared.contains(key: SshKey.PRIVATE.getKeychainKey()) sshLabel?.isEnabled = AppKeychain.shared.contains(key: SshKey.PRIVATE.getKeychainKey())
updateAuthenticationMethodCheckView(for: gitAuthenticationMethod)
} }
override func viewWillDisappear(_ animated: Bool) { override func viewWillDisappear(_ animated: Bool) {
@ -248,6 +248,8 @@ class GitServerSettingTableViewController: UITableViewController {
SVProgressHUD.showSuccess(withStatus: "Imported".localize()) SVProgressHUD.showSuccess(withStatus: "Imported".localize())
SVProgressHUD.dismiss(withDelay: 1) SVProgressHUD.dismiss(withDelay: 1)
self.sshLabel?.isEnabled = true self.sshLabel?.isEnabled = true
self.gitAuthenticationMethod = .key
self.updateAuthenticationMethodCheckView(for: self.gitAuthenticationMethod)
} catch { } catch {
Utils.alert(title: "Error".localize(), message: error.localizedDescription, controller: self) Utils.alert(title: "Error".localize(), message: error.localizedDescription, controller: self)
} }

View file

@ -29,6 +29,7 @@ class SSHKeySettingTableViewController: AutoCellHeightUITableViewController {
try Data(contentsOf: privateKeyURL).write(to: URL(fileURLWithPath: SshKey.PRIVATE.getFileSharingPath()), options: .atomic) try Data(contentsOf: privateKeyURL).write(to: URL(fileURLWithPath: SshKey.PRIVATE.getFileSharingPath()), options: .atomic)
try self.passwordStore.gitSSHKeyImportFromFileSharing() try self.passwordStore.gitSSHKeyImportFromFileSharing()
SharedDefaults[.gitSSHKeySource] = .file SharedDefaults[.gitSSHKeySource] = .file
SharedDefaults[.gitAuthenticationMethod] = .key
SVProgressHUD.showSuccess(withStatus: "Imported".localize()) SVProgressHUD.showSuccess(withStatus: "Imported".localize())
SVProgressHUD.dismiss(withDelay: 1) SVProgressHUD.dismiss(withDelay: 1)
} catch { } catch {

View file

@ -117,13 +117,13 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele
NotificationCenter.default.addObserver(self, selector: #selector(SettingsTableViewController.actOnPasswordStoreErasedNotification), name: .passwordStoreErased, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(SettingsTableViewController.actOnPasswordStoreErasedNotification), name: .passwordStoreErased, object: nil)
self.passwordRepositoryTableViewCell.detailTextLabel?.text = SharedDefaults[.gitURL].host self.passwordRepositoryTableViewCell.detailTextLabel?.text = SharedDefaults[.gitURL].host
setPGPKeyTableViewCellDetailText() setPGPKeyTableViewCellDetailText()
setPasswordRepositoryTableViewCellDetailText()
setPasscodeLockCell() setPasscodeLockCell()
} }
override func viewWillAppear(_ animated: Bool) { override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(true) super.viewWillAppear(true)
tabBarController!.delegate = self tabBarController!.delegate = self
setPasswordRepositoryTableViewCellDetailText()
} }
private func setPasscodeLockCell() { private func setPasscodeLockCell() {

View file

@ -198,15 +198,15 @@ public class PasswordStore {
} catch { } catch {
credential.delete() credential.delete()
SharedDefaults[.lastSyncedTime] = nil SharedDefaults[.lastSyncedTime] = nil
self.deleteCoreData(entityName: "PasswordEntity")
DispatchQueue.main.async { DispatchQueue.main.async {
self.deleteCoreData(entityName: "PasswordEntity")
NotificationCenter.default.post(name: .passwordStoreUpdated, object: nil) NotificationCenter.default.post(name: .passwordStoreUpdated, object: nil)
} }
throw(error) throw(error)
} }
SharedDefaults[.lastSyncedTime] = Date() SharedDefaults[.lastSyncedTime] = Date()
self.updatePasswordEntityCoreData()
DispatchQueue.main.async { DispatchQueue.main.async {
self.updatePasswordEntityCoreData()
NotificationCenter.default.post(name: .passwordStoreUpdated, object: nil) NotificationCenter.default.post(name: .passwordStoreUpdated, object: nil)
} }
} }