My app rootviewcontroller is with tab bar, but when I use firebase push notification it only allows me "present" method. I want to view the controller with push (like child) to have the tab bar and back option when i view this view controller.
In my code I want to transfer from present to PUSH but i cant find solution. currentController.present(controller, animated: true, completion: nil)
func userNotificationCenter(_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void) {
if Defaults.hasKey(.logged), let logged = Defaults[.logged], logged == true {
//TODO
if let controller = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "ProductDetailsViewController") as? ProductDetailsViewController {
controller.productFromNotificationByCode(code: userInfo["product_code"] as! String, productID: userInfo["product_id"] as! String)
if let window = self.window, let rootViewController = window.rootViewController {
var currentController = rootViewController
while let presentedController = currentController.presentedViewController {
currentController = presentedController
}
currentController.present(controller, animated: true, completion: nil)
}
}
}
print(userInfo)
}
completionHandler()
}