Commit fabff4b6 authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Kateryna Kostiuk

UI: get ring version info from Info.plist

- avoids having to hard code the date string when releasing

Change-Id: Ie635e1b1d7e678a4a4015e46cab264de35112364
Reviewed-by: Kateryna Kostiuk's avatarKateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
parent bfca4018
......@@ -89,8 +89,20 @@ class MeViewController: EditProfileViewController, StoryboardBased, ViewModelBas
}
func infoItemTapped() {
let alert = UIAlertController(title: "\nRing\nbuild: 20180131\n\"In varietate concordia\"", message: "", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "ok", style: .default, handler: nil))
var compileDate: String {
let dateDefault = "20180131"
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "YYYYMMdd"
let bundleName = Bundle.main.infoDictionary!["CFBundleName"] as? String ?? "Info.plist"
if let infoPath = Bundle.main.path(forResource: bundleName, ofType: nil),
let infoAttr = try? FileManager.default.attributesOfItem(atPath: infoPath),
let infoDate = infoAttr[FileAttributeKey.creationDate] as? Date {
return dateFormatter.string(from: infoDate)
}
return dateDefault
}
let alert = UIAlertController(title: "\nRing\nbuild: \(compileDate)\n\"In varietate concordia\"", message: "", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: L10n.Global.ok, style: .default, handler: nil))
let image = UIImageView(image: UIImage(asset: Asset.ringIcon))
alert.view.addSubview(image)
image.translatesAutoresizingMaskIntoConstraints = false
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment