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: add listenbrainz scrobbling support #1047

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

CosmicRaptor
Copy link
Member

@CosmicRaptor CosmicRaptor commented Nov 25, 2024

Added listenbrainz scrobbling. (#1029)
ListenBrainz icon was taken from here which is licensed under creative commons.

@CosmicRaptor
Copy link
Member Author

As far as I can tell, I followed their icon design guidelines.
https://github.com/metabrainz/design-system/blob/master/guidelines/design-guidelines.md

@CosmicRaptor
Copy link
Member Author

@Feichtmeier if you want you can replace the PNG with a SVG from the same link for the icon.

Copy link
Member

@Feichtmeier Feichtmeier left a comment

Choose a reason for hiding this comment

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

Thank you the code looks very good! GJ!

I just think we might need to call init() again after you activated it or did I miss this?
Like maybe from the app model initListenbrainz() => _exposeService.initListenBrainz()... which calls _listenBrainzService().init() after you entered the api key and after you pressed the button together with the setting you set?

The icon is fine, looks very good!

@Feichtmeier Feichtmeier changed the title Added listenbrainz scrobbling support feat: add listenbrainz scrobbling support Nov 25, 2024
@CosmicRaptor
Copy link
Member Author

I just think we might need to call init() again after you activated it or did I miss this?

Umm I don't think we need to, the init method simply reads the key from shared prefs and sets up the listenbrainz model. What edge case do you have in mind where this needs to be called twice?

@Feichtmeier
Copy link
Member

Feichtmeier commented Nov 25, 2024

I just think we might need to call init() again after you activated it or did I miss this?

Umm I don't think we need to, the init method simply reads the key from shared prefs and sets up the listenbrainz model. What edge case do you have in mind where this needs to be called twice?

 ..registerLazySingleton(
      () => ListenBrainzService(
        settingsService: di<SettingsService>(),
      )..init(),
    )

this lazy registration registeres this callback that is called when di<ListenBrainzService>() is called for the first time (in the constructor of th eexposeservice)
and then the address the constructor returtns is saved and is used for later calls of di<ListenBrainzService>()
so this means also init is only called once
so the instance of ListenBrainzService() is created, init() is called right after, once, and thats it :) so we need to call it again if the api key changes from null to sth or from sth to sth else

@CosmicRaptor
Copy link
Member Author

I just think we might need to call init() again after you activated it or did I miss this?

Umm I don't think we need to, the init method simply reads the key from shared prefs and sets up the listenbrainz model. What edge case do you have in mind where this needs to be called twice?

 ..registerLazySingleton(
      () => ListenBrainzService(
        settingsService: di<SettingsService>(),
      )..init(),
    )

this lazy registration registeres this callback that is called when di<ListenBrainzService>() is called for the first time (in the constructor of th eexposeservice) and then the address the constructor returtns is saved and is used for later calls of di<ListenBrainzService>() so this means also init is only called once so the instance of ListenBrainzService() is created, init() is called right after, once, and thats it :) so we need to call it again if the api key changes from null to sth or from sth to sth else

Oh okay I did not know that quirk of get_it! I'll make the changes.

@CosmicRaptor
Copy link
Member Author

I fixed it and as a bonus the app will also update the now playing on listenbrainz.

Copy link
Member

@Feichtmeier Feichtmeier left a comment

Choose a reason for hiding this comment

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

Thank you very much! GJ!

@Feichtmeier Feichtmeier merged commit 6ff4723 into ubuntu-flutter-community:main Nov 25, 2024
4 checks passed
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.

2 participants