Fixed missing title for personal view controller when username has not been entered

This commit is contained in:
Deniz Duezgoeren
2019-08-03 11:22:16 +02:00
parent 1106a71eff
commit a096ef9848
4 changed files with 140 additions and 3 deletions
+6 -2
View File
@@ -41,13 +41,17 @@ class PersonalPlanViewController: PlanViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
let user = self.prefs.string(forKey: "username")
var navigationBarTitle = ""
if (user != nil && user != "") {
if (user!.last == "x" || user!.last == "s" || user!.last == "z") {
self.navigationController?.navigationBar.topItem?.title = "\(user!)\(NSLocalizedString("nosplan", comment: ""))"
navigationBarTitle = "\(user!)\(NSLocalizedString("nosplan", comment: ""))"
} else {
self.navigationController?.navigationBar.topItem?.title = "\(user!)\(NSLocalizedString("splan", comment: ""))"
navigationBarTitle = "\(user!)\(NSLocalizedString("splan", comment: ""))"
}
} else {
navigationBarTitle = NSLocalizedString("your_plan", comment: "")
}
self.navigationController?.navigationBar.topItem?.title = navigationBarTitle
}
override func getViewType() -> String {