2017-02-09 22:13:31 +08:00
|
|
|
//
|
|
|
|
|
// AboutRepositoryTableViewController.swift
|
|
|
|
|
// pass
|
|
|
|
|
//
|
|
|
|
|
// Created by Mingshen Sun on 9/2/2017.
|
|
|
|
|
// Copyright © 2017 Bob Sun. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
|
|
|
|
|
|
class AboutRepositoryTableViewController: BasicStaticTableViewController {
|
|
|
|
|
|
|
|
|
|
override func viewDidLoad() {
|
|
|
|
|
navigationItemTitle = "About Repository"
|
|
|
|
|
super.viewDidLoad()
|
|
|
|
|
let passwordEntities = PasswordStore.shared.fetchPasswordEntityCoreData()
|
2017-02-10 00:50:03 +08:00
|
|
|
let fm = FileManager.default
|
|
|
|
|
var size = UInt64(0)
|
|
|
|
|
do {
|
|
|
|
|
size = try fm.allocatedSizeOfDirectoryAtURL(directoryURL: PasswordStore.shared.storeURL)
|
|
|
|
|
} catch {
|
|
|
|
|
print(error)
|
|
|
|
|
}
|
|
|
|
|
let formatted = ByteCountFormatter.string(fromByteCount: Int64(size), countStyle: ByteCountFormatter.CountStyle.file)
|
2017-02-09 22:13:31 +08:00
|
|
|
tableData = [
|
|
|
|
|
// section 0
|
|
|
|
|
[[.type: CellDataType.detail, .title: "Passwords", .detailText: String(passwordEntities.count)],
|
2017-02-10 00:50:03 +08:00
|
|
|
[.type: CellDataType.detail, .title: "Size", .detailText: formatted],
|
2017-02-10 15:32:01 +08:00
|
|
|
[.type: CellDataType.detail, .title: "Last Synced", .detailText: Utils.getLastUpdatedTimeString()],
|
2017-02-09 22:13:31 +08:00
|
|
|
],
|
|
|
|
|
]
|
|
|
|
|
tableView.reloadData()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|