updated version

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-05-25 14:34:22 -05:00
parent ee772648b1
commit 4dd121f961
2 changed files with 25 additions and 17 deletions

View File

@ -650,7 +650,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 17;
CURRENT_PROJECT_VERSION = 18;
DEVELOPMENT_TEAM = 59V5935DHZ;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = VDSSample/Info.plist;
@ -680,7 +680,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 17;
CURRENT_PROJECT_VERSION = 18;
DEVELOPMENT_TEAM = 59V5935DHZ;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = VDSSample/Info.plist;

View File

@ -65,27 +65,17 @@ class MenuCell: UITableViewCell {
class MenuViewController: UITableViewController, TooltipLaunchable {
override func viewDidLoad() {
title = "VDS Sample: Build \(Bundle.main.buildNumber ?? "none")"
title = "VDS Sample: Build \(Bundle.main.build ?? "none")"
let tooltip = VDS.Tooltip()
tooltip.title = "Release Notes"
tooltip.content = getReleaseNotes()
let bundle = VDS.Bundle(for: VDS.Badge.self)
tooltip.title = "Release Notes: \(bundle.build ?? "")"
tooltip.content = bundle.contents("ReleaseNotes")
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: tooltip) // UIBarButtonItem(barButtonSystemItem: .compose, target: self, action: #selector(buildInfoTapped))
super.viewDidLoad()
overrideUserInterfaceStyle = .light
tableView.register(MenuCell.self, forCellReuseIdentifier: "cell")
}
func getReleaseNotes() -> String {
let bundle = VDS.Bundle(for: VDS.Badge.self)
guard let fileURL = bundle.url(forResource: "ReleaseNotes", withExtension: "txt") else { return "none" }
do {
return try String(contentsOf: fileURL)
} catch {
print("error reading releaseNotes")
return "none"
}
}
let items: [MenuComponent] = [
MenuComponent(title: "Badge", completed: true, viewController: BadgeViewController.self),
MenuComponent(title: "Button", completed: true, viewController: ButtonViewController.self),
@ -169,7 +159,25 @@ class MenuViewController: UITableViewController, TooltipLaunchable {
}
extension Bundle {
var versionNumber: String? {
infoDictionary?["CFBundleShortVersionString"] as? String
}
var buildNumber: String? {
infoDictionary?["CFBundleVersion"] as? String
}
var build: String? {
guard let versionNumber, let buildNumber else { return nil }
return "\(versionNumber).\(buildNumber)"
}
func contents(_ fileName: String, fileExtension: String = "txt" ) -> String {
guard let fileURL = url(forResource: fileName, withExtension: fileExtension) else { return "none" }
do {
return try String(contentsOf: fileURL)
} catch {
print("error reading releaseNotes")
return "none"
}
}
}