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

feat: multisnap progress indicator #1637

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

jssotomdz
Copy link
Collaborator

@jssotomdz jssotomdz commented Apr 10, 2024

Screenshot from 2024-04-10 14-42-16
Screenshot from 2024-04-10 14-42-02

Right now:

  • button state and progress bar are not persistent when switching tabs. This means that it returns to the original state of enabled and no progress, the elements are kept only when clicking on a snap in the snap grid
  • Clicking install on a bundle that has a snap already installed just installs the ones missing. If all of them are already installed, the button ignores the clicks but remains enabled

Feedback and ideas are welcomed for this behaviour

@jssotomdz jssotomdz requested a review from d-loose April 10, 2024 20:51
@Feichtmeier
Copy link
Member

little design feedback:
even if the current layout of the snap page is not optimal, a little improvement here should be to move the install all button to the left side

Comment on lines +103 to +104
await _getLocalSnaps(change.snapNames);
notifyListeners();
Copy link
Member

Choose a reason for hiding this comment

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

It probably only makes sense to update the model state once all of the changes are ready

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm a little bit lost here. I have a list of listeners and I remove them as the changes they're tracking are ready. Should I call notifyListeners when this list is empty then? And getLocalSnaps in this case doesn't do anything within the model, just asks snapd if the snaps are there but doesn't store them

Copy link
Member

Choose a reason for hiding this comment

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

I'm a little bit lost here. I have a list of listeners and I remove them as the changes they're tracking are ready. Should I call notifyListeners when this list is empty then?

Yes, I'd treat the installation of the entire bundle as a 'busy' state and would only call notifyListeners() again when all changes are finished.

And getLocalSnaps in this case doesn't do anything within the model, just asks snapd if the snaps are there but doesn't store them

Hm, so that raises a couple of questions:

  • How do you know whether a bundle has already been installed or not? (In the single snap model that's determined by whether or not a local snap is returned from snapd).
  • What happens in the case of partially installed bundles? E.g. a user could already have a snap from the bundle installed on their system, but wants to install the remaining ones.

I'd recommend adding some tests for the MultiSnapModel that tests the installAll method for various possibilities with clear assertions on what should happen in each case. (probably beyond the scope of this PR)

@jssotomdz
Copy link
Collaborator Author

Newest implementation
image

@jssotomdz jssotomdz marked this pull request as ready for review April 19, 2024 17:39
@jssotomdz
Copy link
Collaborator Author

@d-loose implemented your feedback regarding the columns/rows and the circular progress indicator. I think it's ready, the only thing I don't like is that if you switch to a different tab, for instance explore and then go back to the bundle, the UI resets. Buuuut to have a persistent indicator, it would require to query snapd for active changes regarding all the apps in the bundle and for some of the bundles it won't scale very nice, wdyt?

@Feichtmeier
Copy link
Member

Feichtmeier commented Apr 19, 2024

More design feedback :)
I would move the YaruCircularProgressIndicator into the ElevatedButton
There is the named constructor
ElevatedButton.icon
for this
Or if anyone disagrees with this put the YaruCircularProgressIndicator into a SizedBox.square whichs dimension fits the button height, should be 34
https://github.com/ubuntu/yaru.dart/blob/main/lib/constants.dart#L21

@jssotomdz

@d-loose
Copy link
Member

d-loose commented Apr 23, 2024

Buuuut to have a persistent indicator, it would require to query snapd for active changes regarding all the apps in the bundle and for some of the bundles it won't scale very nice, wdyt?

The snapd API isn't great in this regard - you can obtain a list of all active changes from snapd, but unfortunately the individual changes don't tell you which snap they belong to, so you'd have to explicitly request the active changes for each snap in your bundle. I guess that's what you meant, but unless you have dozens of snaps in a bundle that shouldn't really be an issue.

@@ -12,7 +12,7 @@ part of 'chart.dart';
T _$identity<T>(T value) => value;

final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
Copy link
Member

Choose a reason for hiding this comment

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

There are still some outdated mocks here, probably caused by running the build runner with an outdated local version of freezed. If you run melos pub upgrade followed by melos generate you should be in sync again :)
Otherwise you can simply git restore the entire app_center_ratings_client.

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.

None yet

3 participants