2017-02-28 17:10:27 +08:00
|
|
|
//
|
|
|
|
|
// CommitLogsTableViewController.swift
|
|
|
|
|
// pass
|
|
|
|
|
//
|
|
|
|
|
// Created by Mingshen Sun on 28/2/2017.
|
|
|
|
|
// Copyright © 2017 Bob Sun. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
|
import ObjectiveGit
|
|
|
|
|
|
|
|
|
|
class CommitLogsTableViewController: UITableViewController {
|
|
|
|
|
var commits: [GTCommit] = []
|
2017-03-16 22:39:03 -07:00
|
|
|
let passwordStore = PasswordStore.shared
|
2017-02-28 17:10:27 +08:00
|
|
|
|
|
|
|
|
override func viewDidLoad() {
|
|
|
|
|
super.viewDidLoad()
|
2017-03-16 22:39:03 -07:00
|
|
|
commits = passwordStore.getRecentCommits(count: 20)
|
2017-02-28 17:10:27 +08:00
|
|
|
navigationItem.title = "Recent Commit Logs"
|
2017-03-02 17:48:21 +08:00
|
|
|
navigationController!.navigationBar.topItem!.title = "About"
|
2017-02-28 17:10:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
|
|
|
return commits.count
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
|
|
|
let cell = tableView.dequeueReusableCell(withIdentifier: "commitLogCell", for: indexPath)
|
|
|
|
|
let formatter = DateFormatter()
|
2017-03-02 17:48:21 +08:00
|
|
|
formatter.dateStyle = DateFormatter.Style.short
|
|
|
|
|
formatter.timeStyle = .none
|
2017-02-28 17:10:27 +08:00
|
|
|
let dateString = formatter.string(from: commits[indexPath.row].commitDate)
|
2017-03-11 00:10:56 -08:00
|
|
|
let dateLabel = cell.viewWithTag(101) as! UILabel
|
|
|
|
|
let messageLabel = cell.viewWithTag(102) as! UILabel
|
|
|
|
|
dateLabel.text = dateString
|
|
|
|
|
messageLabel.text = commits[indexPath.row].message
|
2017-02-28 17:10:27 +08:00
|
|
|
return cell
|
|
|
|
|
}
|
|
|
|
|
}
|