From 180ec0f4be6460b1ce1ce6659e066c6ede19bf3b Mon Sep 17 00:00:00 2001 From: nixzhu Date: Mon, 14 Dec 2015 15:16:34 +0800 Subject: [PATCH 1/5] check topViewController before show from Conversations --- .../Conversations/ConversationsViewController.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Yep/ViewControllers/Conversations/ConversationsViewController.swift b/Yep/ViewControllers/Conversations/ConversationsViewController.swift index 013565fa..79297d4b 100644 --- a/Yep/ViewControllers/Conversations/ConversationsViewController.swift +++ b/Yep/ViewControllers/Conversations/ConversationsViewController.swift @@ -380,7 +380,14 @@ extension ConversationsViewController: UITableViewDataSource, UITableViewDelegat } func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { - tableView.deselectRowAtIndexPath(indexPath, animated: true) + + defer { + tableView.deselectRowAtIndexPath(indexPath, animated: true) + } + + guard navigationController?.topViewController == self else { + return + } switch indexPath.section { From ed4840ed4a8f442167e3d3283fe660e13defd946 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Mon, 14 Dec 2015 15:21:00 +0800 Subject: [PATCH 2/5] another way check topViewController before show from FeedConversations --- .../FeedConversationsViewController.swift | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Yep/ViewControllers/FeedConversations/FeedConversationsViewController.swift b/Yep/ViewControllers/FeedConversations/FeedConversationsViewController.swift index ffc0870f..59f38510 100644 --- a/Yep/ViewControllers/FeedConversations/FeedConversationsViewController.swift +++ b/Yep/ViewControllers/FeedConversations/FeedConversationsViewController.swift @@ -89,6 +89,15 @@ class FeedConversationsViewController: UIViewController { // MARK: Navigation + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } + override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "showConversation" { let vc = segue.destinationViewController as! ConversationViewController @@ -161,7 +170,9 @@ extension FeedConversationsViewController: UITableViewDataSource, UITableViewDel } func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { - tableView.deselectRowAtIndexPath(indexPath, animated: true) + defer { + tableView.deselectRowAtIndexPath(indexPath, animated: true) + } if let cell = tableView.cellForRowAtIndexPath(indexPath) as? FeedConversationCell { performSegueWithIdentifier("showConversation", sender: cell.conversation) From 94ea7c3a244c2f0fc561ba73762ad9bbc4f44710 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Mon, 14 Dec 2015 15:30:18 +0800 Subject: [PATCH 3/5] check topViewController before show from Feeds --- Yep/ViewControllers/Feeds/FeedsViewController.swift | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Yep/ViewControllers/Feeds/FeedsViewController.swift b/Yep/ViewControllers/Feeds/FeedsViewController.swift index d41e2f82..4e6db7c8 100644 --- a/Yep/ViewControllers/Feeds/FeedsViewController.swift +++ b/Yep/ViewControllers/Feeds/FeedsViewController.swift @@ -555,6 +555,15 @@ class FeedsViewController: BaseViewController { // MARK: - Navigation + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } + override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { guard let identifier = segue.identifier else { @@ -1062,7 +1071,9 @@ extension FeedsViewController: UITableViewDataSource, UITableViewDelegate { func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { - tableView.deselectRowAtIndexPath(indexPath, animated: true) + defer { + tableView.deselectRowAtIndexPath(indexPath, animated: true) + } switch indexPath.section { From e13e6d2d4919774942c3b85503500fec57fd4255 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Mon, 14 Dec 2015 15:30:42 +0800 Subject: [PATCH 4/5] defer all deselectRowAtIndexPath --- Yep/ViewControllers/About/AboutViewController.swift | 5 ++++- .../AddFriends/AddFriendsViewController.swift | 5 ++++- Yep/ViewControllers/Contacts/ContactsViewController.swift | 4 +++- .../EditProfile/EditProfileViewController.swift | 4 +++- .../FeedConversations/FeedConversationsViewController.swift | 1 + .../FriendsInContacts/FriendsInContactsViewController.swift | 5 ++++- .../Notifications/NotificationsViewController.swift | 5 ++++- .../PickLocation/PickLocationViewController.swift | 4 +++- .../PodsHelpYep/PodsHelpYepViewController.swift | 5 ++++- .../SearchedUsers/SearchedUsersViewController.swift | 5 ++++- Yep/ViewControllers/Settings/SettingsViewController.swift | 5 ++++- Yep/ViewControllers/SkillHome/SkillHomeViewController.swift | 5 ++++- .../SocialWorks/SocialWorkGithubViewController.swift | 4 +++- Yep/Views/ConversationMore/ConversationMoreView.swift | 4 +++- Yep/Views/DiscoverFilter/DiscoverFilterView.swift | 4 +++- Yep/Views/MoreMessageTypes/MoreMessageTypesView.swift | 4 +++- Yep/Views/NewFeedTypes/NewFeedTypesView.swift | 4 +++- 17 files changed, 57 insertions(+), 16 deletions(-) diff --git a/Yep/ViewControllers/About/AboutViewController.swift b/Yep/ViewControllers/About/AboutViewController.swift index 6af8b576..2da5f916 100644 --- a/Yep/ViewControllers/About/AboutViewController.swift +++ b/Yep/ViewControllers/About/AboutViewController.swift @@ -92,7 +92,10 @@ extension AboutViewController: UITableViewDataSource, UITableViewDelegate { } func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { - tableView.deselectRowAtIndexPath(indexPath, animated: true) + + defer { + tableView.deselectRowAtIndexPath(indexPath, animated: true) + } switch indexPath.row { case Row.Pods.rawValue: diff --git a/Yep/ViewControllers/AddFriends/AddFriendsViewController.swift b/Yep/ViewControllers/AddFriends/AddFriendsViewController.swift index c76495ce..0564bc2e 100644 --- a/Yep/ViewControllers/AddFriends/AddFriendsViewController.swift +++ b/Yep/ViewControllers/AddFriends/AddFriendsViewController.swift @@ -119,7 +119,10 @@ extension AddFriendsViewController: UITableViewDataSource, UITableViewDelegate { } func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { - tableView.deselectRowAtIndexPath(indexPath, animated: true) + + defer { + tableView.deselectRowAtIndexPath(indexPath, animated: true) + } if indexPath.section == Section.More.rawValue { diff --git a/Yep/ViewControllers/Contacts/ContactsViewController.swift b/Yep/ViewControllers/Contacts/ContactsViewController.swift index 87e3e4ec..2474573b 100644 --- a/Yep/ViewControllers/Contacts/ContactsViewController.swift +++ b/Yep/ViewControllers/Contacts/ContactsViewController.swift @@ -201,7 +201,9 @@ extension ContactsViewController: UITableViewDataSource, UITableViewDelegate { func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { - tableView.deselectRowAtIndexPath(indexPath, animated: true) + defer { + tableView.deselectRowAtIndexPath(indexPath, animated: true) + } if let friend = friendAtIndexPath(indexPath) { diff --git a/Yep/ViewControllers/EditProfile/EditProfileViewController.swift b/Yep/ViewControllers/EditProfile/EditProfileViewController.swift index e48d82c5..80b4886b 100644 --- a/Yep/ViewControllers/EditProfile/EditProfileViewController.swift +++ b/Yep/ViewControllers/EditProfile/EditProfileViewController.swift @@ -355,7 +355,9 @@ extension EditProfileViewController: UITableViewDataSource, UITableViewDelegate func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { - tableView.deselectRowAtIndexPath(indexPath, animated: true) + defer { + tableView.deselectRowAtIndexPath(indexPath, animated: true) + } switch indexPath.section { diff --git a/Yep/ViewControllers/FeedConversations/FeedConversationsViewController.swift b/Yep/ViewControllers/FeedConversations/FeedConversationsViewController.swift index 59f38510..1d6cea92 100644 --- a/Yep/ViewControllers/FeedConversations/FeedConversationsViewController.swift +++ b/Yep/ViewControllers/FeedConversations/FeedConversationsViewController.swift @@ -170,6 +170,7 @@ extension FeedConversationsViewController: UITableViewDataSource, UITableViewDel } func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { + defer { tableView.deselectRowAtIndexPath(indexPath, animated: true) } diff --git a/Yep/ViewControllers/FriendsInContacts/FriendsInContactsViewController.swift b/Yep/ViewControllers/FriendsInContacts/FriendsInContactsViewController.swift index a0ecb658..083e931c 100644 --- a/Yep/ViewControllers/FriendsInContacts/FriendsInContactsViewController.swift +++ b/Yep/ViewControllers/FriendsInContacts/FriendsInContactsViewController.swift @@ -143,7 +143,10 @@ extension FriendsInContactsViewController: UITableViewDataSource, UITableViewDel } func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { - tableView.deselectRowAtIndexPath(indexPath, animated: true) + + defer { + tableView.deselectRowAtIndexPath(indexPath, animated: true) + } performSegueWithIdentifier("showProfile", sender: indexPath) } diff --git a/Yep/ViewControllers/Notifications/NotificationsViewController.swift b/Yep/ViewControllers/Notifications/NotificationsViewController.swift index 9ff5d87e..66bef292 100644 --- a/Yep/ViewControllers/Notifications/NotificationsViewController.swift +++ b/Yep/ViewControllers/Notifications/NotificationsViewController.swift @@ -357,7 +357,10 @@ extension NotificationsViewController: UITableViewDataSource, UITableViewDelegat } func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { - tableView.deselectRowAtIndexPath(indexPath, animated: true) + + defer { + tableView.deselectRowAtIndexPath(indexPath, animated: true) + } switch indexPath.section { case 0: diff --git a/Yep/ViewControllers/PickLocation/PickLocationViewController.swift b/Yep/ViewControllers/PickLocation/PickLocationViewController.swift index 82343f50..0ecd2404 100644 --- a/Yep/ViewControllers/PickLocation/PickLocationViewController.swift +++ b/Yep/ViewControllers/PickLocation/PickLocationViewController.swift @@ -549,7 +549,9 @@ extension PickLocationViewController: UITableViewDataSource, UITableViewDelegate func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { - tableView.deselectRowAtIndexPath(indexPath, animated: true) + defer { + tableView.deselectRowAtIndexPath(indexPath, animated: true) + } if let selectedLocationIndexPath = selectedLocationIndexPath { if let cell = tableView.cellForRowAtIndexPath(selectedLocationIndexPath) as? PickLocationCell { diff --git a/Yep/ViewControllers/PodsHelpYep/PodsHelpYepViewController.swift b/Yep/ViewControllers/PodsHelpYep/PodsHelpYepViewController.swift index 2642deab..e90591bf 100644 --- a/Yep/ViewControllers/PodsHelpYep/PodsHelpYepViewController.swift +++ b/Yep/ViewControllers/PodsHelpYep/PodsHelpYepViewController.swift @@ -111,7 +111,10 @@ class PodsHelpYepViewController: UITableViewController { } override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { - tableView.deselectRowAtIndexPath(indexPath, animated: true) + + defer { + tableView.deselectRowAtIndexPath(indexPath, animated: true) + } let pod = pods[indexPath.row] diff --git a/Yep/ViewControllers/SearchedUsers/SearchedUsersViewController.swift b/Yep/ViewControllers/SearchedUsers/SearchedUsersViewController.swift index 3d33db6a..3ef803a4 100644 --- a/Yep/ViewControllers/SearchedUsers/SearchedUsersViewController.swift +++ b/Yep/ViewControllers/SearchedUsers/SearchedUsersViewController.swift @@ -104,7 +104,10 @@ extension SearchedUsersViewController: UITableViewDataSource, UITableViewDelegat } func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { - tableView.deselectRowAtIndexPath(indexPath, animated: true) + + defer { + tableView.deselectRowAtIndexPath(indexPath, animated: true) + } performSegueWithIdentifier("showProfile", sender: indexPath) } diff --git a/Yep/ViewControllers/Settings/SettingsViewController.swift b/Yep/ViewControllers/Settings/SettingsViewController.swift index 2b01f6cd..6af174a6 100644 --- a/Yep/ViewControllers/Settings/SettingsViewController.swift +++ b/Yep/ViewControllers/Settings/SettingsViewController.swift @@ -141,7 +141,10 @@ extension SettingsViewController: UITableViewDataSource, UITableViewDelegate { } func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { - tableView.deselectRowAtIndexPath(indexPath, animated: true) + + defer { + tableView.deselectRowAtIndexPath(indexPath, animated: true) + } switch indexPath.section { diff --git a/Yep/ViewControllers/SkillHome/SkillHomeViewController.swift b/Yep/ViewControllers/SkillHome/SkillHomeViewController.swift index b7496a78..51c422e2 100644 --- a/Yep/ViewControllers/SkillHome/SkillHomeViewController.swift +++ b/Yep/ViewControllers/SkillHome/SkillHomeViewController.swift @@ -638,7 +638,10 @@ extension SkillHomeViewController: UITableViewDelegate, UITableViewDataSource { } func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { - tableView.deselectRowAtIndexPath(indexPath, animated: true) + + defer { + tableView.deselectRowAtIndexPath(indexPath, animated: true) + } switch indexPath.section { diff --git a/Yep/ViewControllers/SocialWorks/SocialWorkGithubViewController.swift b/Yep/ViewControllers/SocialWorks/SocialWorkGithubViewController.swift index b8626e87..8884573f 100644 --- a/Yep/ViewControllers/SocialWorks/SocialWorkGithubViewController.swift +++ b/Yep/ViewControllers/SocialWorks/SocialWorkGithubViewController.swift @@ -225,7 +225,9 @@ extension SocialWorkGithubViewController: UITableViewDataSource, UITableViewDele func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { - tableView.deselectRowAtIndexPath(indexPath, animated: true) + defer { + tableView.deselectRowAtIndexPath(indexPath, animated: true) + } let repo = githubRepos[indexPath.row] diff --git a/Yep/Views/ConversationMore/ConversationMoreView.swift b/Yep/Views/ConversationMore/ConversationMoreView.swift index 779e5221..7e7f253a 100644 --- a/Yep/Views/ConversationMore/ConversationMoreView.swift +++ b/Yep/Views/ConversationMore/ConversationMoreView.swift @@ -529,7 +529,9 @@ extension ConversationMoreView: UITableViewDataSource, UITableViewDelegate { func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { - tableView.deselectRowAtIndexPath(indexPath, animated: true) + defer { + tableView.deselectRowAtIndexPath(indexPath, animated: true) + } switch type { case .OneToOne: diff --git a/Yep/Views/DiscoverFilter/DiscoverFilterView.swift b/Yep/Views/DiscoverFilter/DiscoverFilterView.swift index 56353714..726e56b4 100644 --- a/Yep/Views/DiscoverFilter/DiscoverFilterView.swift +++ b/Yep/Views/DiscoverFilter/DiscoverFilterView.swift @@ -324,7 +324,9 @@ extension DiscoverFilterView: UITableViewDataSource, UITableViewDelegate { func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { - tableView.deselectRowAtIndexPath(indexPath, animated: true) + defer { + tableView.deselectRowAtIndexPath(indexPath, animated: true) + } if let row = Row(rawValue: indexPath.row) { diff --git a/Yep/Views/MoreMessageTypes/MoreMessageTypesView.swift b/Yep/Views/MoreMessageTypes/MoreMessageTypesView.swift index 1a614bee..740b0718 100644 --- a/Yep/Views/MoreMessageTypes/MoreMessageTypesView.swift +++ b/Yep/Views/MoreMessageTypes/MoreMessageTypesView.swift @@ -267,7 +267,9 @@ extension MoreMessageTypesView: UITableViewDataSource, UITableViewDelegate { func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { - tableView.deselectRowAtIndexPath(indexPath, animated: true) + defer { + tableView.deselectRowAtIndexPath(indexPath, animated: true) + } if let row = Row(rawValue: indexPath.row) { switch row { diff --git a/Yep/Views/NewFeedTypes/NewFeedTypesView.swift b/Yep/Views/NewFeedTypes/NewFeedTypesView.swift index 680a885b..0648819f 100644 --- a/Yep/Views/NewFeedTypes/NewFeedTypesView.swift +++ b/Yep/Views/NewFeedTypes/NewFeedTypesView.swift @@ -295,7 +295,9 @@ extension NewFeedTypesView: UITableViewDataSource, UITableViewDelegate { func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { - tableView.deselectRowAtIndexPath(indexPath, animated: true) + defer { + tableView.deselectRowAtIndexPath(indexPath, animated: true) + } if let row = Row(rawValue: indexPath.row) { From 06206fbf4ded17d503eb35fc1b3170e27d537348 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Mon, 14 Dec 2015 15:51:21 +0800 Subject: [PATCH 5/5] add shouldPerformSegueWithIdentifier for all segues --- Yep/ViewControllers/About/AboutViewController.swift | 11 +++++++++++ .../AddFriends/AddFriendsViewController.swift | 9 +++++++++ Yep/ViewControllers/Base/BaseViewController.swift | 12 +----------- .../Contacts/ContactsViewController.swift | 10 ++++++++++ .../Conversation/ConversationViewController.swift | 9 +++++++++ .../Conversations/ConversationsViewController.swift | 11 +++++++++++ .../Discover/DiscoverViewController.swift | 9 +++++++++ .../EditProfile/EditProfileViewController.swift | 11 +++++++++++ .../FriendsInContactsViewController.swift | 9 +++++++++ .../Login/LoginByMobileViewController.swift | 9 +++++++++ .../NewFeed/NewFeedViewController.swift | 9 +++++++++ .../NewFeedVoiceRecordViewController.swift | 9 +++++++++ .../Notifications/NotificationsViewController.swift | 9 +++++++++ .../PickLocation/PickLocationViewController.swift | 9 +++++++++ .../Profile/ProfileViewController.swift | 9 +++++++++ .../Register/RegisterPickAvatarViewController.swift | 11 +++++++++++ .../Register/RegisterPickMobileViewController.swift | 10 +++++++++- .../Register/RegisterPickNameViewController.swift | 11 +++++++++++ .../Register/RegisterPickSkillsViewController.swift | 9 +++++++++ .../RegisterVerifyMobileViewController.swift | 11 +++++++++++ .../SearchedUsers/SearchedUsersViewController.swift | 9 +++++++++ .../Settings/SettingsViewController.swift | 11 +++++++++++ .../SkillHome/SkillHomeViewController.swift | 9 +++++++++ 23 files changed, 214 insertions(+), 12 deletions(-) diff --git a/Yep/ViewControllers/About/AboutViewController.swift b/Yep/ViewControllers/About/AboutViewController.swift index 2da5f916..fca5564b 100644 --- a/Yep/ViewControllers/About/AboutViewController.swift +++ b/Yep/ViewControllers/About/AboutViewController.swift @@ -53,6 +53,17 @@ class AboutViewController: UIViewController { aboutTableViewHeightConstraint.constant = rowHeight * CGFloat(aboutAnnotations.count) + 1 } + + // MARK: Navigation + + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } } // MARK: - UITableViewDataSource, UITableViewDelegate diff --git a/Yep/ViewControllers/AddFriends/AddFriendsViewController.swift b/Yep/ViewControllers/AddFriends/AddFriendsViewController.swift index 0564bc2e..8b7f8b16 100644 --- a/Yep/ViewControllers/AddFriends/AddFriendsViewController.swift +++ b/Yep/ViewControllers/AddFriends/AddFriendsViewController.swift @@ -31,6 +31,15 @@ class AddFriendsViewController: UIViewController { // MARK: Navigation + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } + override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "showSearchedUsers" { if let searchText = sender as? String { diff --git a/Yep/ViewControllers/Base/BaseViewController.swift b/Yep/ViewControllers/Base/BaseViewController.swift index 06b4b495..e47ccb58 100644 --- a/Yep/ViewControllers/Base/BaseViewController.swift +++ b/Yep/ViewControllers/Base/BaseViewController.swift @@ -49,15 +49,5 @@ class BaseViewController: UIViewController { } } - - /* - // MARK: - Navigation - - // In a storyboard-based application, you will often want to do a little preparation before navigation - override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { - // Get the new view controller using segue.destinationViewController. - // Pass the selected object to the new view controller. - } - */ - } + diff --git a/Yep/ViewControllers/Contacts/ContactsViewController.swift b/Yep/ViewControllers/Contacts/ContactsViewController.swift index 2474573b..7144f3cd 100644 --- a/Yep/ViewControllers/Contacts/ContactsViewController.swift +++ b/Yep/ViewControllers/Contacts/ContactsViewController.swift @@ -136,7 +136,17 @@ class ContactsViewController: BaseViewController { // MARK: Navigation + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } + override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { + if segue.identifier == "showProfile" { let vc = segue.destinationViewController as! ProfileViewController diff --git a/Yep/ViewControllers/Conversation/ConversationViewController.swift b/Yep/ViewControllers/Conversation/ConversationViewController.swift index 62ea6c7a..7ce384c6 100644 --- a/Yep/ViewControllers/Conversation/ConversationViewController.swift +++ b/Yep/ViewControllers/Conversation/ConversationViewController.swift @@ -2771,6 +2771,15 @@ class ConversationViewController: BaseViewController { // MARK: Navigation + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } + override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { guard let identifier = segue.identifier else { diff --git a/Yep/ViewControllers/Conversations/ConversationsViewController.swift b/Yep/ViewControllers/Conversations/ConversationsViewController.swift index 79297d4b..71642f11 100644 --- a/Yep/ViewControllers/Conversations/ConversationsViewController.swift +++ b/Yep/ViewControllers/Conversations/ConversationsViewController.swift @@ -276,6 +276,17 @@ class ConversationsViewController: UIViewController { } } + // MARK: Navigation + + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } + override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "showConversation" { let vc = segue.destinationViewController as! ConversationViewController diff --git a/Yep/ViewControllers/Discover/DiscoverViewController.swift b/Yep/ViewControllers/Discover/DiscoverViewController.swift index 9c1a774e..40a4679d 100644 --- a/Yep/ViewControllers/Discover/DiscoverViewController.swift +++ b/Yep/ViewControllers/Discover/DiscoverViewController.swift @@ -214,6 +214,15 @@ class DiscoverViewController: BaseViewController { // MARK: - Navigation + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } + override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "showProfile" { diff --git a/Yep/ViewControllers/EditProfile/EditProfileViewController.swift b/Yep/ViewControllers/EditProfile/EditProfileViewController.swift index 80b4886b..13adae61 100644 --- a/Yep/ViewControllers/EditProfile/EditProfileViewController.swift +++ b/Yep/ViewControllers/EditProfile/EditProfileViewController.swift @@ -82,6 +82,17 @@ class EditProfileViewController: UIViewController { editProfileTableView.registerNib(UINib(nibName: editProfileColoredTitleCellIdentifier, bundle: nil), forCellReuseIdentifier: editProfileColoredTitleCellIdentifier) } + // MARK: Navigation + + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } + // MARK: Actions private func updateAvatar(completion:() -> Void) { diff --git a/Yep/ViewControllers/FriendsInContacts/FriendsInContactsViewController.swift b/Yep/ViewControllers/FriendsInContacts/FriendsInContactsViewController.swift index 083e931c..225c738a 100644 --- a/Yep/ViewControllers/FriendsInContacts/FriendsInContactsViewController.swift +++ b/Yep/ViewControllers/FriendsInContacts/FriendsInContactsViewController.swift @@ -104,6 +104,15 @@ class FriendsInContactsViewController: BaseViewController { // MARK: - Navigation + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } + override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "showProfile" { diff --git a/Yep/ViewControllers/Login/LoginByMobileViewController.swift b/Yep/ViewControllers/Login/LoginByMobileViewController.swift index 0150eaf8..7a3536b3 100644 --- a/Yep/ViewControllers/Login/LoginByMobileViewController.swift +++ b/Yep/ViewControllers/Login/LoginByMobileViewController.swift @@ -151,6 +151,15 @@ class LoginByMobileViewController: BaseViewController { // MARK: Navigation + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } + override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "showLoginVerifyMobile" { diff --git a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift index a109db42..8d7cdb3f 100644 --- a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift +++ b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift @@ -413,6 +413,15 @@ class NewFeedViewController: UIViewController { } // MARK: Navigation + + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { diff --git a/Yep/ViewControllers/NewFeedVoiceRecord/NewFeedVoiceRecordViewController.swift b/Yep/ViewControllers/NewFeedVoiceRecord/NewFeedVoiceRecordViewController.swift index 997502c6..ca32efd4 100644 --- a/Yep/ViewControllers/NewFeedVoiceRecord/NewFeedVoiceRecordViewController.swift +++ b/Yep/ViewControllers/NewFeedVoiceRecord/NewFeedVoiceRecordViewController.swift @@ -411,6 +411,15 @@ class NewFeedVoiceRecordViewController: UIViewController { // MARK: - Navigation + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } + override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { guard let identifier = segue.identifier else { diff --git a/Yep/ViewControllers/Notifications/NotificationsViewController.swift b/Yep/ViewControllers/Notifications/NotificationsViewController.swift index 66bef292..e25869c3 100644 --- a/Yep/ViewControllers/Notifications/NotificationsViewController.swift +++ b/Yep/ViewControllers/Notifications/NotificationsViewController.swift @@ -112,6 +112,15 @@ class NotificationsViewController: UIViewController { // MARK: Navigation + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } + override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "showDoNotDisturbPeriod" { diff --git a/Yep/ViewControllers/PickLocation/PickLocationViewController.swift b/Yep/ViewControllers/PickLocation/PickLocationViewController.swift index 0ecd2404..6d9c752a 100644 --- a/Yep/ViewControllers/PickLocation/PickLocationViewController.swift +++ b/Yep/ViewControllers/PickLocation/PickLocationViewController.swift @@ -189,6 +189,15 @@ class PickLocationViewController: UIViewController { // MARK: Navigation + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } + override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { guard let identifier = segue.identifier else { diff --git a/Yep/ViewControllers/Profile/ProfileViewController.swift b/Yep/ViewControllers/Profile/ProfileViewController.swift index 9e978968..19eb9268 100644 --- a/Yep/ViewControllers/Profile/ProfileViewController.swift +++ b/Yep/ViewControllers/Profile/ProfileViewController.swift @@ -1173,6 +1173,15 @@ class ProfileViewController: UIViewController { // MARK: Navigation + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } + override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { guard let identifier = segue.identifier else { diff --git a/Yep/ViewControllers/Register/RegisterPickAvatarViewController.swift b/Yep/ViewControllers/Register/RegisterPickAvatarViewController.swift index 1a174371..c5a35ac2 100644 --- a/Yep/ViewControllers/Register/RegisterPickAvatarViewController.swift +++ b/Yep/ViewControllers/Register/RegisterPickAvatarViewController.swift @@ -145,6 +145,17 @@ class RegisterPickAvatarViewController: UIViewController { nextButton.enabled = false } + // MARK: Navigation + + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } + // MARK: Helpers private func deviceWithMediaType(mediaType: String, preferringPosition position: AVCaptureDevicePosition) -> AVCaptureDevice? { diff --git a/Yep/ViewControllers/Register/RegisterPickMobileViewController.swift b/Yep/ViewControllers/Register/RegisterPickMobileViewController.swift index c91a5d67..3865030b 100644 --- a/Yep/ViewControllers/Register/RegisterPickMobileViewController.swift +++ b/Yep/ViewControllers/Register/RegisterPickMobileViewController.swift @@ -165,11 +165,19 @@ class RegisterPickMobileViewController: UIViewController { } } }) - } // MARK: Navigation + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } + override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "showRegisterVerifyMobile" { diff --git a/Yep/ViewControllers/Register/RegisterPickNameViewController.swift b/Yep/ViewControllers/Register/RegisterPickNameViewController.swift index 015701ed..65b3272b 100644 --- a/Yep/ViewControllers/Register/RegisterPickNameViewController.swift +++ b/Yep/ViewControllers/Register/RegisterPickNameViewController.swift @@ -87,6 +87,17 @@ class RegisterPickNameViewController: BaseViewController { nameTextField.becomeFirstResponder() } + // MARK: Navigation + + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } + // MARK: Actions @objc private func tapTerms(sender: UITapGestureRecognizer) { diff --git a/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift b/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift index a968a146..3efb4111 100644 --- a/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift +++ b/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift @@ -166,6 +166,15 @@ class RegisterPickSkillsViewController: BaseViewController { // MARK: Navigaition + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } + override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "presentSelectSkills" { diff --git a/Yep/ViewControllers/Register/RegisterVerifyMobileViewController.swift b/Yep/ViewControllers/Register/RegisterVerifyMobileViewController.swift index d6680c0f..3339ee76 100644 --- a/Yep/ViewControllers/Register/RegisterVerifyMobileViewController.swift +++ b/Yep/ViewControllers/Register/RegisterVerifyMobileViewController.swift @@ -93,6 +93,17 @@ class RegisterVerifyMobileViewController: UIViewController { callMeTimer.fire() } + // MARK: Navigation + + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } + // MARK: Actions @objc private func activeAgain(notification: NSNotification) { diff --git a/Yep/ViewControllers/SearchedUsers/SearchedUsersViewController.swift b/Yep/ViewControllers/SearchedUsers/SearchedUsersViewController.swift index 3ef803a4..bfebcf3b 100644 --- a/Yep/ViewControllers/SearchedUsers/SearchedUsersViewController.swift +++ b/Yep/ViewControllers/SearchedUsers/SearchedUsersViewController.swift @@ -66,6 +66,15 @@ class SearchedUsersViewController: BaseViewController { // MARK: Navigation + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } + override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "showProfile" { if let indexPath = sender as? NSIndexPath { diff --git a/Yep/ViewControllers/Settings/SettingsViewController.swift b/Yep/ViewControllers/Settings/SettingsViewController.swift index 6af174a6..8d214183 100644 --- a/Yep/ViewControllers/Settings/SettingsViewController.swift +++ b/Yep/ViewControllers/Settings/SettingsViewController.swift @@ -76,6 +76,17 @@ class SettingsViewController: BaseViewController { } } } + + // MARK: Navigation + + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } } extension SettingsViewController: UITableViewDataSource, UITableViewDelegate { diff --git a/Yep/ViewControllers/SkillHome/SkillHomeViewController.swift b/Yep/ViewControllers/SkillHome/SkillHomeViewController.swift index 51c422e2..2527ff8e 100644 --- a/Yep/ViewControllers/SkillHome/SkillHomeViewController.swift +++ b/Yep/ViewControllers/SkillHome/SkillHomeViewController.swift @@ -420,6 +420,15 @@ class SkillHomeViewController: BaseViewController { } // MARK: - Navigation + + override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { + + guard navigationController?.topViewController == self else { + return false + } + + return true + } override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {