Mark both unsynced files and unsynced folders
This commit is contained in:
parent
b9ef596bfb
commit
f136ebee48
2 changed files with 6 additions and 18 deletions
|
|
@ -263,18 +263,16 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
|
||||||
let cell = tableView.dequeueReusableCell(withIdentifier: "passwordTableViewCell", for: indexPath)
|
let cell = tableView.dequeueReusableCell(withIdentifier: "passwordTableViewCell", for: indexPath)
|
||||||
|
|
||||||
let entry = getPasswordEntry(by: indexPath)
|
let entry = getPasswordEntry(by: indexPath)
|
||||||
|
if entry.passwordEntity!.synced {
|
||||||
|
cell.textLabel?.text = entry.title
|
||||||
|
} else {
|
||||||
|
cell.textLabel?.text = "↻ \(entry.title)"
|
||||||
|
}
|
||||||
if !entry.isDir {
|
if !entry.isDir {
|
||||||
if entry.passwordEntity!.synced {
|
|
||||||
cell.textLabel?.text = entry.title
|
|
||||||
} else {
|
|
||||||
cell.textLabel?.text = "↻ \(entry.title)"
|
|
||||||
}
|
|
||||||
|
|
||||||
cell.addGestureRecognizer(longPressGestureRecognizer)
|
cell.addGestureRecognizer(longPressGestureRecognizer)
|
||||||
cell.accessoryType = .none
|
cell.accessoryType = .none
|
||||||
cell.detailTextLabel?.text = ""
|
cell.detailTextLabel?.text = ""
|
||||||
} else {
|
} else {
|
||||||
cell.textLabel?.text = "\(entry.title)"
|
|
||||||
cell.accessoryType = .disclosureIndicator
|
cell.accessoryType = .disclosureIndicator
|
||||||
cell.detailTextLabel?.font = UIFont.preferredFont(forTextStyle: .body)
|
cell.detailTextLabel?.font = UIFont.preferredFont(forTextStyle: .body)
|
||||||
cell.detailTextLabel?.text = "\(entry.passwordEntity?.children?.count ?? 0)"
|
cell.detailTextLabel?.text = "\(entry.passwordEntity?.children?.count ?? 0)"
|
||||||
|
|
|
||||||
|
|
@ -471,17 +471,6 @@ public class PasswordStore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func getNumberOfUnsyncedPasswords() -> Int {
|
|
||||||
let passwordEntityFetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: "PasswordEntity")
|
|
||||||
do {
|
|
||||||
passwordEntityFetchRequest.predicate = NSPredicate(format: "synced = %i", 0)
|
|
||||||
return try context.count(for: passwordEntityFetchRequest)
|
|
||||||
} catch {
|
|
||||||
fatalError("Failed to fetch unsynced passwords: \(error)")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public func getLatestUpdateInfo(filename: String) -> String {
|
public func getLatestUpdateInfo(filename: String) -> String {
|
||||||
guard let storeRepository = storeRepository else {
|
guard let storeRepository = storeRepository else {
|
||||||
return "Unknown"
|
return "Unknown"
|
||||||
|
|
@ -622,6 +611,7 @@ public class PasswordStore {
|
||||||
if let passwordEntity = getPasswordEntity(by: path, isDir: isDir) {
|
if let passwordEntity = getPasswordEntity(by: path, isDir: isDir) {
|
||||||
print(passwordEntity.path!)
|
print(passwordEntity.path!)
|
||||||
parentPasswordEntity = passwordEntity
|
parentPasswordEntity = passwordEntity
|
||||||
|
passwordEntity.synced = false
|
||||||
} else {
|
} else {
|
||||||
if !isDir {
|
if !isDir {
|
||||||
return insertPasswordEntity(name: URL(string: path.stringByAddingPercentEncodingForRFC3986()!)!.deletingPathExtension().lastPathComponent, path: path, parent: parentPasswordEntity, synced: false, isDir: false)
|
return insertPasswordEntity(name: URL(string: path.stringByAddingPercentEncodingForRFC3986()!)!.deletingPathExtension().lastPathComponent, path: path, parent: parentPasswordEntity, synced: false, isDir: false)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue