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

[navigation #3+4] canGoBack/GoForward; SERP headers #885

Merged
merged 21 commits into from
Feb 13, 2023

Conversation

mallexxx
Copy link
Collaborator

@mallexxx mallexxx commented Dec 12, 2022

Task/Issue URL: https://app.asana.com/0/72649045549333/1202061524436301/f
Tech Design URL: (RePublished) https://app.asana.com/0/481882893211075/1203312264447430/f
CC: @tomasstrba

Description:

  • canGoBack/Forward, navigation state publishers refactored based on navigation state

Steps to test this PR:

  1. Validate correctness of canGoBack state
    • do some searches, open a link
    • click goBack/Forward
    • use Cmd+] Cmd+[ hotkeys
    • activate another app/window, use cmd+click to navigate the background window back/forward
  2. Validate r.duckduckgo.com doesn‘t leave an empty back item

Testing checklist:

  • Test with Release configuration
  • Test proper deallocation of tabs

Internal references:

Software Engineering Expectations
Technical Design Template
When ready for review, remember to post the PR in MM

@mallexxx mallexxx force-pushed the alex/gobackforward-republished branch from 1eba6ec to 2d9c1b9 Compare December 12, 2022 04:48
@mallexxx mallexxx changed the title canGoBack/GoForward properties RePublished [navigation] canGoBack/GoForward properties RePublished Dec 12, 2022
@mallexxx mallexxx changed the title [navigation] canGoBack/GoForward properties RePublished [navigation #2] canGoBack/GoForward properties RePublished Feb 7, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2023

Warnings
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS against ba59440

@mallexxx mallexxx changed the base branch from alex/dist-nav-delegate to alex/navigation/adclick February 7, 2023 09:04
@mallexxx mallexxx changed the title [navigation #2] canGoBack/GoForward properties RePublished [navigation #3] canGoBack/GoForward properties RePublished Feb 7, 2023
@mallexxx mallexxx assigned tomasstrba and unassigned mallexxx Feb 7, 2023
@tomasstrba tomasstrba assigned mallexxx and unassigned tomasstrba Feb 8, 2023
@mallexxx mallexxx assigned tomasstrba and unassigned mallexxx Feb 8, 2023
@tomasstrba tomasstrba assigned mallexxx and unassigned tomasstrba Feb 9, 2023
@mallexxx
Copy link
Collaborator Author

mallexxx commented Feb 9, 2023

@tomasstrba this one not related, it's been fixed in the #884, not merged to this one yet

@mallexxx
Copy link
Collaborator Author

mallexxx commented Feb 9, 2023

@tomasstrba I updated the branch to match #884, the assertion shouldn‘t happen anymore

@mallexxx mallexxx assigned tomasstrba and unassigned mallexxx Feb 9, 2023
Copy link
Contributor

@tomasstrba tomasstrba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is no longer there 👍 Thanks for fixing it.

I only have few comments below


/// `CurrentValueSubject` wrapper used to receive and store a published property and re-publish it when used as a $projectedValue
@propertyWrapper
struct RePublished<Owner: AnyObject, Value, Pub: Publisher<Value, Never>> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, it's always a good idea to consider using existing components from the framework before introducing custom implementations, as this reduces the amount of code you need to maintain, ensures compatibility with other apps and makes it easier for new team members to start contributing to codebase.

In order to descope your project where possible, do you think we could focus on this property wrapper after you release the refactor? It is already too complicated and introducing custom property wrapper like this doesn't make it easier.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let‘s drop it

Unit Tests/Tab/Model/TabTests.swift Outdated Show resolved Hide resolved
DuckDuckGo/Browser Tab/Model/Tab.swift Show resolved Hide resolved
@tomasstrba tomasstrba assigned mallexxx and unassigned tomasstrba Feb 9, 2023
@mallexxx mallexxx assigned tomasstrba and unassigned mallexxx Feb 9, 2023
Copy link
Contributor

@tomasstrba tomasstrba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

One more issue I found that is probably not related to this PR but related to the refactoring is how quickly is the tab released from memory. If you play any video and close the tab, it continues playing for few seconds. If possible, please make sure this issue is resolved before merging this to develop


// MARK: - Back/Forward navigation

func testCanGoBack() throws {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to break down the test into multiple tests or do you think it would lead to unnecessary code duplication?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, splitting the test into multiple will lead to repeating the whole test but with different assertion points, so let‘s keep it as it is

@mallexxx mallexxx changed the title [navigation #3] canGoBack/GoForward properties RePublished [navigation #3] canGoBack/GoForward properties Feb 9, 2023
* SERP headers handling in SerpHeadersNavigationResponder
@mallexxx mallexxx changed the title [navigation #3] canGoBack/GoForward properties [navigation #3+4] canGoBack/GoForward; SERP headers Feb 9, 2023
@mallexxx mallexxx assigned mallexxx and unassigned tomasstrba Feb 9, 2023
@mallexxx
Copy link
Collaborator Author

the issue with the delayed Tab release you mentioned was caused by the long time decision making checker in BSK PR (DEBUG only) which is fixed already.

@mallexxx mallexxx merged commit 33acd85 into alex/navigation/adclick Feb 13, 2023
@mallexxx mallexxx deleted the alex/gobackforward-republished branch February 13, 2023 11:11
mallexxx added a commit that referenced this pull request Feb 13, 2023
* AdClickAttributionTabExtension+NavigationResponder

* fix TabExtension test overrides, adClick extension tests

* fix AdClickAttributionTabExtensionTests teardown

* cleanup

* don‘t use shared state in tests

* fix adClick inherited attribution initialization

* cleanup

* Adjust adClick tests to better match UserScripts/UserContentController behaviour; cleanup

* fix RELEASE

* remove Swifter dependency

* fix file header

* [navigation #3+4] canGoBack/GoForward; SERP headers (#885)

* canGoBack, canGoForward RePublished, Tab.publishers refactored

* redo redirect(_:NavigationAction, invalidatingBackItemIfNeeded)

* tests

* don‘t use shared state in tests

* fix RELEASE

* rollback renaming

* drop RePublished

* fix header name

* [navigation #4] SERP headers navigation responder (#887)

* SERP headers handling in SerpHeadersNavigationResponder

* convert TabTests to custom SchemeHandler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants