Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Issue #36 #117

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open

Fix for Issue #36 #117

wants to merge 5 commits into from

Conversation

Janglinator
Copy link
Contributor

Here's a suggested fix for issue #36.

Here are some design considerations around the manual showing:

On showing:
if NFX.started - I check this value in the new method, showManually()
NFX.presented = true - At this point Netfox will no longer control whether the window has already been presented, that is the job of the new presenter. If Netfox is asked to show using show(), it will (and should) do so.

On hiding:
if !NFX.presented - Same as above, Netfox is no longer in charge if they used showManually()
NotificationCenter.default.post - If the user wishes to deactivate the search window on disappearing, they are free to do so. The notification has been publicly exposed. I'd love to have more discussion as to why we (Netfox) even needs to do this. At first glance, it seems like we're having a memory leak. Once the window is shown and dismissed, whether the search controller is active shouldn't matter anymore, it should be deallocated.
NFX.lastVisitDate - I moved this logic into NFXListController's ViewWillDisappear method. It makes a little more sense to do so, since NFXListController is the only one that cares about it. I left the actual property in NFX, simply because another class might be interested in this value as well (in the future)

@kasketis
Copy link
Owner

I'd love to have more discussion as to why we (Netfox) even needs to do this. At first glance, it seems like we're having a memory leak. Once the window is shown and dismissed, whether the search controller is active shouldn't matter anymore, it should be deallocated.

There was a bug when the search controller was active and you tried to hide the netfox. Search controller never removed from the screen. In order to workaround on this, we added the notification.
If you want to reproduce the old issue get the master, comment the self.searchController.isActive = false in the NFXListController_iOS, shake - open the netfox, perform a search and shake again - search screen is not being removed. If you shake again netfox will appear again above the stacked search screen (as the internal presented state has changed).

In 5480bf9 I have removed all the search notifications and now I'm trying to solve the same issue by using the self.definesPresentationContext = YES; which works well but has some side effects: when you tap on a search result and return back to the list the results move under the search bar.

Let me know if it is clear enough and if you have any idea about the side effect issue 👍 🍺

@vGubriienko vGubriienko changed the base branch from master to develop December 11, 2021 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants