-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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-10521 [Homescreen Rebuild] Add wallpaper to new homescreen #23202
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @Cramsden for working on this!! looks 🔥 , the main structure looks great, left a couple of comments for consideration. Let me know what you think~
I didn't run down and build the app to test the wallpaper work, but happy to when the feature is more complete. Thanks again for taking this on :) !
firefox-ios/Client/Frontend/Home/Wallpaper/Redux/WallpaperState.swift
Outdated
Show resolved
Hide resolved
...s-tests/Tests/ClientTests/Frontend/Homepage Rebuild/Wallpaper/WallpaperMiddlewareTests.swift
Outdated
Show resolved
Hide resolved
...s-tests/Tests/ClientTests/Frontend/Homepage Rebuild/Wallpaper/WallpaperMiddlewareTests.swift
Outdated
Show resolved
Hide resolved
...s-tests/Tests/ClientTests/Frontend/Homepage Rebuild/Wallpaper/WallpaperMiddlewareTests.swift
Outdated
Show resolved
Hide resolved
} | ||
|
||
// MARK: - Variables | ||
var wallpaper: Wallpaper? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think about using the WallpaperState
here to populate the details of the view and passing only what's needed from the wallpaper instead of setting the Wallpaper
object here? For the other cells, I've been using the states, so can maintain consistency and clear on what is needed as well.
i.e. wallpaperState.landscapeImage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We get nice functionality on wallpaper like providing a default image as well as fetching an image for landscape vs portrait. Are you proposing that it would be better to pass in these as separate items to the wallpaper view? We definitely could I guess i am not sure what the benefit as wallpaper
is already a lightweight struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By adding wallpaper, we are surfacing other properties and logic that the view doesn't need to know. So by providing a specific state for the view, we only pull in what's needed from wallpaper.
Also, we can follow a consistent structure in our codebase which our views take in a state, which I'm happy to rethink or restructure. So for other views, PocketStandardCell
populates its data by passing in PocketStoryState
and HomepageHeaderCell
takes in HeaderState
.
The downside of this that I can see is that now the views are heavily tied to a state instead of specific properties if we decide to move from Redux.
However, now that I think about it, maybe this should be a team discussion to see what is preferred. Let me know what you think!
This also doesn't need to block this PR. So happy to get this merge in first and have that discussion later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like the outcome of that discussion is we actually do want to have the view have a reference to wallpaper state with just the information it needs instead of the the wallpaper object.
@@ -87,6 +90,11 @@ final class HomepageViewController: UIViewController, | |||
applyTheme() | |||
} | |||
|
|||
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { | |||
super.viewWillTransition(to: size, with: coordinator) | |||
wallpaperView.updateImageForOrientationChange() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment did make me think of a question I had earlier:
Do orientation changes need to be redux actions as well or if the view controller can just directly update the view. @cyndichin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be a nice to have if we can add redux since some of that orientation logic makes more sense to live in the state, then in the view. Ideally, all we need to do is dispatch an action here, and then the state updates with the new wallpaper image.
However, that's increasing the scope a bit, so we can add this to the back burner of our wishlist
of things we would like to update. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems based on this discussion, It does not need to be part of redux:
Broadcasting an action when you know there will be nobody listing for it is not necessary. Someone can always come back later and add it if a use case pops up where they need to listen for it.
Client.app: Coverage: 31.41
Generated by 🚫 Danger Swift against ce7a6ae |
📜 Tickets
Jira ticket
Github issue
💡 Description
Move wallpaper to new homescreen
WallpaperView
and move existingWallpaperView
toLegacyWallpaperView
wallpaperDidChange
as this will be handled by reduxAdd redux for wallpaper actions like initial load and changing the wallpaper
WallpaperAction
WallpaperMiddleware
as interface forWallpaperManager
WallpaperManager
is still being interacted directly everywhere other than the new home screenWallpaperState
as as sub-state forHomepageState
TODO:
📝 Checklist
You have to check all boxes before merging
@Mergifyio backport release/v120
)