Skip to content
Snippets Groups Projects
Commit 01732c9d authored by Oliver Wiese's avatar Oliver Wiese
Browse files

add return button

parent a5d621cc
No related branches found
No related tags found
2 merge requests!58Onboarding screens swift ui merge dev,!56Create badge case screen
......@@ -132,7 +132,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}
func showBadgeCase() {
self.window?.rootViewController = UIHostingController(rootView: BadgeCaseView())
// self.window?.rootViewController = UIHostingController(rootView: BadgeCaseView())
// return
guard let vc = self.window?.rootViewController as? UINavigationController else {
fatalError("No rootViewController!")
}
let nextVC = UIHostingController(rootView: BadgeCaseView())
vc.navigationBar.isHidden = true
vc.pushViewController(nextVC, animated: true)
}
// Option removed from Settings app, but this might still be usefull in the future
......
......@@ -27,11 +27,35 @@ struct BadgeCaseView: View {
}
}
}
}.navigationBarTitle(Text(NSLocalizedString("Gamification.Overview.HeaderTitle", comment:"Badge Case Navigation Title" )), displayMode: .inline).navigationBarItems(leading: titleIcon)
}.navigationBarTitle(Text(NSLocalizedString("Gamification.Overview.HeaderTitle", comment:"Badge Case Navigation Title" )), displayMode: .inline).navigationBarItems(leading: Button(action: goBack, label: {
Text("Back")
}
))
}
}
}
private func goBack() {
if let win = AppDelegate.getAppDelegate().window {
if let root = win.rootViewController {
print("Appdelegates current root: \(root.debugDescription)")
if let navi = root.navigationController {
navi.popViewController(animated: true)
}
else if let root = root as? UINavigationController {
print("Root is a UINavigationController -> we can pop!")
root.popViewController(animated: true)
}
else {
if let coord = AppDelegate.getAppDelegate().inboxCoordinator {
print("Inbox coord root: \(coord.root.topViewController.debugDescription)")
coord.root.popViewController(animated: true)
}
}
}
}
}
private var titleIcon: some View {
HStack{
Image("verschluesseltOn")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment