AboutScreenViewController.swift 3.41 KB
Newer Older
1
2
3
4
5
6
7
8
9
//
//  AboutScreenViewController.swift
//  WhatsOpen
//
//  Created by Zach Knox on 7/28/17.
//  Copyright © 2017 SRCT. All rights reserved.
//

import UIKit
10
import SafariServices
11

12
class AboutScreenViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
13

14
15
	@IBOutlet var versionLabel: UILabel!
	
16
17
18
19
	override var preferredStatusBarStyle: UIStatusBarStyle {
		return .default
	}
	
20
21
22
    override func viewDidLoad() {
        super.viewDidLoad()

23
24
25
26
27
28
29
30
31
		let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String
		let build = Bundle.main.object(forInfoDictionaryKey: kCFBundleVersionKey as String) as! String
		
		let versionstring = "Version " + version + " (" + build + ")"
		
		versionLabel.text = versionstring
		
		
		
32
33
34
35
36
37
38
        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
39
40
41
42
43
	
	let contributors = [
		"Eyad Hasan",
		"Zach Knox",
		"Patrick Murray",
Jesse Scearce's avatar
Jesse Scearce committed
44
        "Jesse Scearce",
45
		"Zac Wood",
46
47
48
49
		"Jason Yeomans"
	]
	
	func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
50
51
52
53
54
55
56
57
		switch section {
		case 0:
			return 1
		case 1:
			return contributors.count
		default:
			return 0
		}
58
59
60
	}
	
	func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
61
62
63
64
65
66
67
68
		switch section {
		case 0:
			return "What's Open for iOS is an open source project created by students at George Mason University"
		case 1:
			return "Thanks to the contributors to What's Open!"
		default:
			return ""
		}
69
70
	}
	
71
72
73
74
75
76
77
78
79
80
81
82
83
	func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
		if let headerView = view as? UITableViewHeaderFooterView {
			switch section {
			case 0:
				headerView.textLabel?.text = "What's Open for iOS is an open source project created by students at George Mason University"
			case 1:
				headerView.textLabel?.text = "Thanks to the contributors to What's Open!"
			default:
				headerView.textLabel?.text = ""
			}
		}
	}
	
84
	func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
85
		let cell = tableView.dequeueReusableCell(withIdentifier: "Contributor", for: indexPath) as! SettingTableViewCell
86
		
87
88
89
		switch indexPath.section {
		case 0:
			cell.textLabel!.text = "Check out our code on Gitlab"
Zach Knox's avatar
Zach Knox committed
90
91
			cell.selectionStyle = UITableViewCell.SelectionStyle.blue
			cell.accessoryType = UITableViewCell.AccessoryType.disclosureIndicator
92
93
94
95
96
		case 1:
			cell.textLabel!.text = contributors[indexPath.row]
		default:
			break
		}
97
98
99
100
		
		return cell
	}
	
101
102
103
104
105
106
107
108
	func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
		if indexPath.section == 0 {
			let cell = self.tableView(tableView, cellForRowAt: indexPath) as! SettingTableViewCell
			let lnk = URL(string: "https://git.gmu.edu/srct/whats-open-ios")
			self.showDetailViewController(SFSafariViewController(url: lnk!), sender: cell)
		}
	}
	
109
	func numberOfSections(in tableView: UITableView) -> Int {
110
		return 2
111
112
113
	}
	
	
114
115
116
117
118
119
120
121
122
123
124
125

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}