-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Thumbnails to wallpapers UI #26671
Thumbnails to wallpapers UI #26671
Conversation
ff7c960
to
50f2007
Compare
This pull request has conflicts when rebasing. Could you fix it @mavduevskiy? 🙏 |
f3c2e5a
to
f0f1148
Compare
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.
Had a couple questions, but this is otherwise looking good to me. I will do a more thorough pass tomorrow including testing it locally.
app/src/main/java/org/mozilla/fenix/settings/wallpaper/WallpaperSettings.kt
Outdated
Show resolved
Hide resolved
override suspend fun invoke(wallpaper: Wallpaper): Wallpaper.ImageFileState { | ||
return if (wallpaper == Wallpaper.Default || fileManager.wallpaperImagesExist(wallpaper)) { | ||
selectWallpaper(wallpaper) | ||
dispatchDownloadState(wallpaper, Wallpaper.ImageFileState.Downloaded) | ||
Wallpaper.ImageFileState.Downloaded | ||
} else { | ||
dispatchDownloadState(wallpaper, Wallpaper.ImageFileState.Downloading) | ||
val result = downloader.downloadWallpaper(wallpaper) | ||
dispatchDownloadState(wallpaper, result) | ||
if (result == Wallpaper.ImageFileState.Downloaded) { | ||
selectWallpaper(wallpaper) | ||
} | ||
result |
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 worth updating the tests to capture the return behavior here.
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.
Tested locally, this is looking good! Stamping approval now but I think it would be good to have tests updated per my earlier comment
This pull request has conflicts when rebasing. Could you fix it @mavduevskiy? 🙏 |
2e13561
to
d5e593e
Compare
This pull request has conflicts when rebasing. Could you fix it @mavduevskiy? 🙏 |
7190433
to
f5e0790
Compare
This pull request has conflicts when rebasing. Could you fix it @mavduevskiy? 🙏 |
f5e0790
to
c606b2b
Compare
Closes #26212
Should be merged after this PR.
I made some adjustments to address the bug with
assetFileState
not updating, that was found here. The original problem with it was that after dispatching new state, items were copied, and further dispatch couldn't rely on the defaultequals
implementation.But overriding
equals
to comparename
would preventStore.transitionTo
from updating with the new state, because overriddenequals
will make the new state with the newWallpaperState
(with new loading state) to be equal to the old one, hence no update.Also added a new
snackbar
to the HomeScreen for edge case when for some reason the app fails to read the file from the storage (disk damage may be? iOS team requested the copywrite for the case, and I following the instructions from here).Moved snackbars from the Compose into the fragment. They wouldn't cancel themselves after a new one has been invoked, observing for failed/success result was easier from the fragment, and they looked quite differently from what we have system wide.
Made changes to the usecase to return the result directly, because calculating the result of the download process from the appstate was complex.
Adds visual feedback to the wallpaper download process.
device-2022-08-29-112717.webm
device-2022-08-30-212856.webm
Pull Request checklist
QA
To download an APK when reviewing a PR (after all CI tasks finished running):
Checks
at the top of the PR page.firefoxci-taskcluster
group on the left to expand all tasks.build-debug
task.View task in Taskcluster
in the newDETAILS
section.GitHub Automation
Fixes #26212