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-11132 [Homepage] [Message] initial state + view for message card #24271

Merged
merged 2 commits into from
Jan 23, 2025

Conversation

cyndichin
Copy link
Contributor

📜 Tickets

Jira ticket
Github issue

💡 Description

Add initial view and state for the message card section for the new homepage.

  • Added MessageCardState with mock string
  • Copied over previous homepage message card view and made modifications to use state instead of view model
  • Add message section to diffable and add configs for compositional layout + message card cells

📝 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)

Screenshot

iPhone

Comment on lines +100 to +104
func configure(state: MessageCardState, theme: Theme) {
applyGleanMessage(with: state.title, description: state.description, buttonLabel: state.buttonLabel)
applyTheme(theme: theme)
ctaButton.applyTheme(theme: theme)
}
Copy link
Contributor Author

@cyndichin cyndichin Jan 21, 2025

Choose a reason for hiding this comment

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

copied most of this class over, mainly changed this method from the original in LegacyHomepageMessageCardCell. Also moved the shadow constants used in setupShadow here instead of calling it from HomepageViewModel

Previous implementation

func configure(viewModel: HomepageMessageCardViewModel, theme: Theme) {
        self.viewModel = viewModel

        if let message = viewModel.getMessage(for: .newTabCard) {
            applyGleanMessage(message)
        }

        applyTheme(theme: theme)
        ctaButton.applyTheme(theme: theme)
    }
    ```
   
 

@mobiletest-ci-bot
Copy link

mobiletest-ci-bot commented Jan 21, 2025

Messages
📖 Project coverage: 33.49%
📖 Edited 10 files
📖 Created 3 files

Client.app: Coverage: 32.31

File Coverage
HomepageState.swift 92.94%
HomepageSectionType.swift 41.07% ⚠️
HomepageMessageCardCell.swift 0.0% ⚠️
HomepageMessageCardViewModel.swift 77.01%
HomepageSectionLayoutProvider.swift 48.81% ⚠️
HomepageDiffableDataSource.swift 100.0%
MessageCardState.swift 97.78%
HomepageViewController.swift 45.65% ⚠️
HomepageMessageCard.swift 65.09%

Generated by 🚫 Danger Swift against 9ccd9cd

@cyndichin cyndichin marked this pull request as ready for review January 21, 2025 19:05
@cyndichin cyndichin requested a review from a team as a code owner January 21, 2025 19:05
Copy link
Contributor

@Cramsden Cramsden left a comment

Choose a reason for hiding this comment

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

One small nit but lgtm

@@ -107,6 +109,27 @@ final class HomepageSectionLayoutProvider {
return section
}

private func createMessageCardSectionLayout(for traitCollection: UITraitCollection) -> NSCollectionLayoutSection {
let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1),
heightDimension: .estimated(180))
Copy link
Contributor

Choose a reason for hiding this comment

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

could we move this value out in to a constant?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes! I was also contemplating on consolidating this logic into one reusable method, since its similar for header section / customize homepage section. I would pass in the constants as params. What do you think?

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 merge this PR and discuss on slack + create a separate PR to address this comment!

Copy link
Contributor

Choose a reason for hiding this comment

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

ok!

@cyndichin cyndichin merged commit 796a502 into main Jan 23, 2025
13 checks passed
@cyndichin cyndichin deleted the cc/FXIOS-11132_add-message-state-and-view branch January 23, 2025 17:52
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