add commits and format style
This commit is contained in:
parent
6307d320d2
commit
cbbb631e08
1 changed files with 16 additions and 5 deletions
|
|
@ -27,22 +27,33 @@ class AboutRepositoryTableViewController: BasicStaticTableViewController {
|
||||||
tableView.addSubview(indicatorLable)
|
tableView.addSubview(indicatorLable)
|
||||||
|
|
||||||
DispatchQueue.global(qos: .userInitiated).async {
|
DispatchQueue.global(qos: .userInitiated).async {
|
||||||
let passwordEntities = PasswordStore.shared.fetchPasswordEntityCoreData()
|
let numberFormatter = NumberFormatter()
|
||||||
|
numberFormatter.numberStyle = NumberFormatter.Style.decimal
|
||||||
let fm = FileManager.default
|
let fm = FileManager.default
|
||||||
|
|
||||||
|
let passwordEntities = PasswordStore.shared.fetchPasswordEntityCoreData()
|
||||||
|
let numberOfPasswords = numberFormatter.string(from: NSNumber(value: passwordEntities.count))!
|
||||||
|
|
||||||
var size = UInt64(0)
|
var size = UInt64(0)
|
||||||
do {
|
do {
|
||||||
size = try fm.allocatedSizeOfDirectoryAtURL(directoryURL: PasswordStore.shared.storeURL)
|
size = try fm.allocatedSizeOfDirectoryAtURL(directoryURL: PasswordStore.shared.storeURL)
|
||||||
} catch {
|
} catch {
|
||||||
print(error)
|
print(error)
|
||||||
}
|
}
|
||||||
|
let sizeOfRepository = ByteCountFormatter.string(fromByteCount: Int64(size), countStyle: ByteCountFormatter.CountStyle.file)
|
||||||
|
|
||||||
|
let numberOfCommits = PasswordStore.shared.storeRepository?.numberOfCommits(inCurrentBranch: NSErrorPointer(nilLiteral: ())) ?? 0
|
||||||
|
let numberOfCommitsString = numberFormatter.string(from: NSNumber(value: numberOfCommits))!
|
||||||
|
|
||||||
|
|
||||||
DispatchQueue.main.async { [weak self] in
|
DispatchQueue.main.async { [weak self] in
|
||||||
let formatted = ByteCountFormatter.string(fromByteCount: Int64(size), countStyle: ByteCountFormatter.CountStyle.file)
|
let type = UITableViewCellAccessoryType.none
|
||||||
self?.tableData = [
|
self?.tableData = [
|
||||||
// section 0
|
// section 0
|
||||||
[[.style: CellDataStyle.value1, .accessoryType: UITableViewCellAccessoryType.none, .title: "Passwords", .detailText: String(passwordEntities.count)],
|
[[.style: CellDataStyle.value1, .accessoryType: type, .title: "Passwords", .detailText: numberOfPasswords],
|
||||||
[.style: CellDataStyle.value1, .accessoryType: UITableViewCellAccessoryType.none, .title: "Size", .detailText: formatted],
|
[.style: CellDataStyle.value1, .accessoryType: type, .title: "Size", .detailText: sizeOfRepository],
|
||||||
[.style: CellDataStyle.value1, .accessoryType: UITableViewCellAccessoryType.none, .title: "Last Synced", .detailText: Utils.getLastUpdatedTimeString()],
|
[.style: CellDataStyle.value1, .accessoryType: type, .title: "Last Synced", .detailText: Utils.getLastUpdatedTimeString()],
|
||||||
|
[.style: CellDataStyle.value1, .accessoryType: type, .title: "Commits", .detailText: numberOfCommitsString]
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
indicator.stopAnimating()
|
indicator.stopAnimating()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue