Skip to content

Commit

Permalink
fix(DeeplinkManager): fix double notif welcome four and five
Browse files Browse the repository at this point in the history
  • Loading branch information
clemPerrousset committed Jun 22, 2023
1 parent 58b1ea5 commit bc5c860
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 72 deletions.
8 changes: 6 additions & 2 deletions entourage/Managers/DeeplinkManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ struct DeepLinkManager {
DispatchQueue.main.async {
let sb = UIStoryboard.init(name: StoryboardName.main, bundle: nil)
if let vc = sb.instantiateViewController(withIdentifier: "welcomefourvc") as? WelcomeFourViewController {
AppState.getTopViewController()!.present(vc,animated: true)
if let currentVc = AppState.getTopViewController() as? HomeMainViewController{
currentVc.present(vc, animated: true)
}
}
}

Expand All @@ -255,7 +257,9 @@ struct DeepLinkManager {
DispatchQueue.main.async {
let sb = UIStoryboard.init(name: StoryboardName.main, bundle: nil)
if let vc = sb.instantiateViewController(withIdentifier: "welcomefivevc") as? WelcomeFiveViewController {
AppState.getTopViewController()!.present(vc,animated: true)
if let currentVc = AppState.getTopViewController() as? HomeMainViewController{
currentVc.present(vc, animated: true)
}
}
}
}
Expand Down
70 changes: 0 additions & 70 deletions entourage/Scenes/Home/HomeMainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -143,76 +143,6 @@ class HomeMainViewController: UIViewController {
}


@objc func testWelcomeNotif() {

let alertController = UIAlertController(title: "Bonjour testeur", message: "Choisi un jour", preferredStyle: .alert)
// Créer les actions pour les boutons
let action1 = UIAlertAction(title: "Welcome H1", style: .default) { _ in

let sb = UIStoryboard.init(name: StoryboardName.main, bundle: nil)
//TODO HERE ASOLULETY CHANGE IN CASE OF PUSH
if let welcomeViewController = self.storyboard?.instantiateViewController(withIdentifier: "welcomeonevc") as? WelcomeViewController {
// Remplacez “WelcomeViewController” par l’identifiant de votre WelcomeViewController dans le storyboard
welcomeViewController.modalPresentationStyle = .fullScreen
// Présentez le WelcomeViewController
welcomeViewController.delegate = self
self.present(welcomeViewController, animated: true, completion: nil)
}
}
let action2 = UIAlertAction(title: "Welcome day 2", style: .default) { _ in

let sb = UIStoryboard.init(name: StoryboardName.main, bundle: nil)
//TODO HERE ASOLULETY CHANGE IN CASE OF PUSH
if let welcomeViewController = self.storyboard?.instantiateViewController(withIdentifier: "welcometwovc") as? WelcmeTwoViewController {
// Remplacez “WelcomeViewController” par l’identifiant de votre WelcomeViewController dans le storyboard
welcomeViewController.modalPresentationStyle = .fullScreen
// Présentez le WelcomeViewController
welcomeViewController.delegate = self
self.present(welcomeViewController, animated: true, completion: nil)
}
}
let action3 = UIAlertAction(title: "Welcome day 5", style: .default) { _ in

let sb = UIStoryboard.init(name: StoryboardName.main, bundle: nil)
//TODO HERE ASOLULETY CHANGE IN CASE OF PUSH
if let welcomeViewController = self.storyboard?.instantiateViewController(withIdentifier: "welcomethreevc") as? WelcomeThreeViewController {
// Remplacez “WelcomeViewController” par l’identifiant de votre WelcomeViewController dans le storyboard
welcomeViewController.modalPresentationStyle = .fullScreen
// Présentez le WelcomeViewController
welcomeViewController.delegate = self
self.present(welcomeViewController, animated: true, completion: nil)
}
}
let action4 = UIAlertAction(title: "Welcome day 8", style: .default) { _ in
let sb = UIStoryboard.init(name: StoryboardName.main, bundle: nil)
//TODO HERE ASOLULETY CHANGE IN CASE OF PUSH
if let welcomeViewController = self.storyboard?.instantiateViewController(withIdentifier: "welcomefourvc") as? WelcomeFourViewController {
// Remplacez “WelcomeViewController” par l’identifiant de votre WelcomeViewController dans le storyboard
welcomeViewController.modalPresentationStyle = .fullScreen
// Présentez le WelcomeViewController
self.present(welcomeViewController, animated: true, completion: nil)
}
}
let action5 = UIAlertAction(title: "Welcome day 11", style: .default) { _ in
let sb = UIStoryboard.init(name: StoryboardName.main, bundle: nil)
//TODO HERE ASOLULETY CHANGE IN CASE OF PUSH
if let welcomeViewController = self.storyboard?.instantiateViewController(withIdentifier: "welcomefivevc") as? WelcomeFiveViewController {
// Remplacez “WelcomeViewController” par l’identifiant de votre WelcomeViewController dans le storyboard
welcomeViewController.modalPresentationStyle = .fullScreen
// Présentez le WelcomeViewController
self.present(welcomeViewController, animated: true, completion: nil)
}
}
// Ajouter les actions à l'alerte
alertController.addAction(action1)
alertController.addAction(action2)
alertController.addAction(action3)
alertController.addAction(action4)
alertController.addAction(action5)
// Afficher l'alerte
present(alertController, animated: true, completion: nil)
}

func updateTopView() {
ui_username.text = String.init(format: "home_title_welcome".localized, homeViewModel.userHome.displayName)

Expand Down

0 comments on commit bc5c860

Please sign in to comment.