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

Add FXIOS-10165 [Homepage] Add initial Top Sites Section #22621

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

cyndichin
Copy link
Contributor

@cyndichin cyndichin commented Oct 17, 2024

📜 Tickets

Jira ticket
Github issue

💡 Description

Adds the foundation for setting up top sites section:

  • TopSitesState
  • TopSitesManager (does not include full logic for top sites yet)
  • TopSitesAction
  • TopSitesMiddleware

Includes updating diffable datasource from state and presenting google top site in the view.

Before adding middleware tests, waiting for this PR to be approved: #22643

Next PRs
To keep this PR small, I will create separate future PRs:
Include full logic for top sites (ordering)
Include navigation
Removing + Adding favicons will come with context menus
Update diffable datasource tests

📝 Checklist

You have to check all boxes before merging

  • Filled in the above information (tickets numbers and description of your work)
  • Updated the PR name to follow our PR naming guidelines
  • Wrote unit tests and/or ensured the tests suite is passing
  • When working on UI, I checked and implemented accessibility (minimum Dynamic Text and VoiceOver)
  • If needed, I updated documentation / comments for complex code and public methods
  • If needed, added a backport comment (example @Mergifyio backport release/v120)

Screenshots

iPhone

Copy link
Contributor

github-actions bot commented Nov 2, 2024

This PR has been automatically marked as stale. Please leave any comment to keep this PR opened. It will be closed automatically if no further update occurs in the next 7 days. Thank you for your contributions!

@github-actions github-actions bot added the stale Stalebot use this label to stale issues and PRs label Nov 2, 2024
Copy link
Contributor

mergify bot commented Nov 2, 2024

This pull request has conflicts when rebasing. Could you fix it @cyndichin? 🙏

@github-actions github-actions bot removed the stale Stalebot use this label to stale issues and PRs label Nov 3, 2024
@cyndichin cyndichin force-pushed the cc/FXIOS-10165_add-top-sites-section branch from 58ed566 to bf495f3 Compare November 4, 2024 15:16
Comment on lines 75 to 80
return HomepageState(
windowUUID: state.windowUUID,
headerState: HeaderState.reducer(state.headerState, action),
topSitesState: TopSitesState.reducer(state.topSitesState, action),
pocketState: PocketState.reducer(state.pocketState, action)
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

will create a separate method for the default state in a future PR

Comment on lines +407 to +409
case .ProfileDidFinishSyncing,
.PrivateDataClearedHistory,
.FirefoxAccountChanged,
.TopSitesUpdated,
.DefaultSearchEngineUpdated:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

copied over from adaptor, but would like to drill down to why we need to observe these cases. If anyone has context, happy to hear, otherwise will investigate these further once I dive deeper into the top sites logic.

@cyndichin cyndichin force-pushed the cc/FXIOS-10165_add-top-sites-section branch from bf495f3 to 76317f4 Compare November 4, 2024 16:13
import UIKit

/// The TopSite cell that appears for the homepage rebuild project.
class TopSiteCell: UICollectionViewCell, ReusableCell {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this file is a copy of TopSiteItemCell, but changed the name and update the configure method to using TopSiteState instead of TopSite

import Shared

/// Top site UI class, used in the homepage top site section
final class TopSiteState: Hashable, Equatable {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a copy of TopSite but conformed to Hashable and Equatable

@isabelrios
Copy link
Contributor

In case it helps, looks like this PR is failing several times due to this Unit test: HomepageViewControllerTests.test_viewDidLoad_setsUpThemingAndNotifications()

@cyndichin
Copy link
Contributor Author

cyndichin commented Nov 4, 2024

In case it helps, looks like this PR is failing several times due to this Unit test: HomepageViewControllerTests.test_viewDidLoad_setsUpThemingAndNotifications()

yes thank you! its in draft so I've been committing + pushing as I make changes, but I should probably make sure I don't push too often since it does run the CI / CD process 😅

@cyndichin cyndichin force-pushed the cc/FXIOS-10165_add-top-sites-section branch from cfd9eda to 61a558f Compare November 4, 2024 17:11
@mobiletest-ci-bot
Copy link

mobiletest-ci-bot commented Nov 4, 2024

Messages
📖 Project coverage: 32.22%
📖 Edited 8 files
📖 Created 7 files

Client.app: Coverage: 30.07

File Coverage
HomepageState.swift 86.67%
TopSitesAction.swift 100.0%
HomepageSectionLayoutProvider.swift 93.45%
HomepageDiffableDataSource.swift 93.55%
AppState.swift 100.0%
TopSitesManager.swift 86.67%
TopSitesMiddleware.swift 100.0%
TopSitesSectionState.swift 97.44%
TopSiteState.swift 14.04% ⚠️
HomepageViewController.swift 37.14% ⚠️
TopSiteCell.swift 0.0% ⚠️

Generated by 🚫 Danger Swift against c339fad

@cyndichin cyndichin marked this pull request as ready for review November 4, 2024 17:28
@cyndichin cyndichin requested a review from a team as a code owner November 4, 2024 17:28
@cyndichin cyndichin requested review from thatswinnie, OrlaM, adudenamedruby and MattLichtenstein and removed request for thatswinnie November 4, 2024 17:28
Copy link
Contributor

mergify bot commented Nov 5, 2024

This pull request has conflicts when rebasing. Could you fix it @cyndichin? 🙏

@cyndichin cyndichin force-pushed the cc/FXIOS-10165_add-top-sites-section branch from 61a558f to c339fad Compare November 5, 2024 15:13
@cyndichin cyndichin merged commit 0eaf142 into main Nov 5, 2024
13 of 14 checks passed
@cyndichin cyndichin deleted the cc/FXIOS-10165_add-top-sites-section branch November 5, 2024 16:52
@cyndichin
Copy link
Contributor Author

@tusharC95 @DanielDervishi for visibility

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.

4 participants