Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Thumbnails to wallpapers UI #26671

Merged

Conversation

mavduevskiy
Copy link
Contributor

@mavduevskiy mavduevskiy commented Aug 26, 2022

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 default equals implementation.

But overriding equals to compare name would prevent Store.transitionTo from updating with the new state, because overridden equals will make the new state with the new WallpaperState (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

  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Screenshots: This PR includes screenshots or GIFs of the changes made or an explanation of why it does not
  • Accessibility: The code in this PR follows accessibility best practices or does not include any user facing features. In addition, it includes a screenshot of a successful accessibility scan to ensure no new defects are added to the product.

QA

  • QA Needed

To download an APK when reviewing a PR (after all CI tasks finished running):

  1. Click on Checks at the top of the PR page.
  2. Click on the firefoxci-taskcluster group on the left to expand all tasks.
  3. Click on the build-debug task.
  4. Click on View task in Taskcluster in the new DETAILS section.
  5. The APK links should be on the right side of the screen, named for each CPU architecture.

GitHub Automation

Fixes #26212

@mavduevskiy mavduevskiy force-pushed the thumbnails-to-wallpapers-ui branch 2 times, most recently from ff7c960 to 50f2007 Compare August 29, 2022 17:53
@mavduevskiy mavduevskiy reopened this Aug 29, 2022
@mergify
Copy link
Contributor

mergify bot commented Aug 31, 2022

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

@mavduevskiy mavduevskiy force-pushed the thumbnails-to-wallpapers-ui branch from f3c2e5a to f0f1148 Compare September 6, 2022 00:51
@mavduevskiy mavduevskiy marked this pull request as ready for review September 6, 2022 17:52
@mavduevskiy mavduevskiy requested review from a team as code owners September 6, 2022 17:52
Copy link
Contributor

@MatthewTighe MatthewTighe left a 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/res/values/strings.xml Show resolved Hide resolved
Comment on lines +465 to +478
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
Copy link
Contributor

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.

Copy link
Contributor

@MatthewTighe MatthewTighe left a 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

@mergify
Copy link
Contributor

mergify bot commented Sep 7, 2022

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

@mavduevskiy mavduevskiy force-pushed the thumbnails-to-wallpapers-ui branch 2 times, most recently from 2e13561 to d5e593e Compare September 9, 2022 21:23
@mergify
Copy link
Contributor

mergify bot commented Sep 9, 2022

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

@mavduevskiy mavduevskiy force-pushed the thumbnails-to-wallpapers-ui branch 2 times, most recently from 7190433 to f5e0790 Compare September 12, 2022 20:59
@MatthewTighe
Copy link
Contributor

:shipit:

@mergify
Copy link
Contributor

mergify bot commented Sep 12, 2022

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

@mavduevskiy mavduevskiy force-pushed the thumbnails-to-wallpapers-ui branch from f5e0790 to c606b2b Compare September 13, 2022 05:22
@mavduevskiy mavduevskiy added the pr:needs-landing PRs that are ready to land [Will be merged by Mergify] label Sep 13, 2022
@mergify mergify bot merged commit 3aff74b into mozilla-mobile:main Sep 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr:needs-landing PRs that are ready to land [Will be merged by Mergify]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clicking wallpaper thumbnails should download the full version.
2 participants