If app is killed and user click on push notification app takes it directly to the respective screen(detail screen) but before pushing to the detail screen we push to the list screen.When user click on back button of detail screen navigation title of list screen comes empty for a sec then gets correctly.What could be the reason.
switch(model!.action[1].lowercased()){
case "profile":
NotificationUtils.sharedInstance.moveToDirectoryModuleWithLTDS() //Will shift to Directory module
NotificationUtils.sharedInstance.moveToLocationList(false)
NotificationUtils.sharedInstance.moveToLocation(Guid(locID),rightPanel: false, needAnimation: false) //Move to department detail screen with Info tab selected
hideLoader() //Will stop loading indicator
break
}
func moveToLocationList(_ animate: Bool = true) {
hideNavigationTitle() //This function is used to clear the back button title.
let dropVC = DepartmentViewController(nibName: "DepartmentViewController", bundle: nil)
dropVC.employeeGroupInfo = EmployeeGroupInfo.locationInfo
self.pushWithDelayToVC(dropVC, animation: animate)
}
func pushWithDelayToVC(_ viewController:UIViewController,animation:Bool = true)
{
let appDelegate = UIApplication.shared.delegate as! AppDelegate
AppDelegate.removeUserProfileSetupScreens()
self.removeComposer { () -> Void in
UIUtils.pushViewWhenHideBottom((appDelegate.tabBarController.selectedViewController as! UINavigationController).visibleViewController!, anotherVC: viewController, needAnimation: animation)
self.hideSidePanel()
}
}
func removeComposer(_ completion: @escaping (() -> Void))
{
let appDelegate = UIApplication.shared.delegate as! AppDelegate
if let selectedController = appDelegate.tabBarController.selectedViewController
{
if let selectNavController = selectedController as? UINavigationController
{
if let visibleController = selectNavController.visibleViewController
{
if (NSStringFromClass(type(of: visibleController)) == "MFMailComposeInternalViewController" || NSStringFromClass(type(of: visibleController)) == "CKSMSComposeController" || NSStringFromClass(type(of: visibleController)) == "PLUICameraViewController" || NSStringFromClass(type(of: visibleController)) == "UIAlertController")
{
visibleController.dismiss(animated: false, completion: { () -> Void in
completion()
return
})
}
else
{
completion()
}
}
else { completion() }
}
else { completion()}
}
else { completion() }
}
And code of viewWillAppear is :
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if employeeGroupInfo == EmployeeGroupInfo.departmentInfo {
UIUtils.setTitleFontWhiteOnNavigationController(viewCtrl: self, titleStr: AppMessage.EDByDepartment)
} else if employeeGroupInfo == EmployeeGroupInfo.locationInfo {
UIUtils.setTitleFontWhiteOnNavigationController(viewCtrl: self, titleStr: AppMessage.EDByLocation)
} else if employeeGroupInfo == EmployeeGroupInfo.teamInfo {
UIUtils.setTitleFontWhiteOnNavigationController(viewCtrl: self, titleStr: AppMessage.EDMoreByTeamsMob)
}
self.tabBarController?.tabBar.isHidden = false
}
public class func setTitleFontWhiteOnNavigationController(viewCtrl: UIViewController, titleStr: String, needBorder: Bool = true,needTitleImage: Bool = false)
{
viewCtrl.extendedLayoutIncludesOpaqueBars = true
viewCtrl.navigationController?.navigationBar.isTranslucent = false
viewCtrl.navigationController?.navigationBar.barTintColor = UIColor.LTColor()
// Set navigation bar background color
viewCtrl.navigationController?.navigationBar.tintColor = UIColor.white
viewCtrl.navigationController?.navigationBar.titleTextAttributes = [NSFontAttributeName: UIFont.boldSystemFont(ofSize: 18.0),NSForegroundColorAttributeName: UIColor.white]
if needTitleImage {
setImageWithTitle(viewCtrl: viewCtrl,titleStr: titleStr)
}
else {
viewCtrl.title = titleStr
}
if needBorder
{
//Used to hide shadow line in navigation bar by Nikhil
viewCtrl.navigationController?.navigationBar.setBackgroundImage(nil, for: UIBarMetrics.default)
viewCtrl.navigationController?.navigationBar.shadowImage = nil
}
else
{
//Used to hide shadow line in navigation bar by Nikhil
viewCtrl.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
viewCtrl.navigationController?.navigationBar.shadowImage = UIImage()
}
}