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: controller #45

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

Conversation

rebelonion
Copy link
Contributor

Fixes:

  • Calling onExtensionSelected on disabled extensions other than music
  • SettingTextInput not updating the shown value immediately after setting

Additions

MessagePostClient

  • Allows an extension to hook into mutableMessageFlow to post messages other than errors
  • Interface uses delegate/callback

CloseableClient

  • Allows extensions to close resources the app closes
  • Tied to the player service which should be the last thing running in the app
  • In my case this was useful for closing a websocket that otherwise kept running after the app was closed

ControllerClient

  • Allows an extension to perform actions directly onto the player
  • Uses functions for app->extension communication and callbacks for extension->app communication
  • Nicely documented

examples:

Echo Song Skipper

  • skips songs based off of song or artist name automatically

Echo Remote Control

  • connects to a control app through a websocket server to remotely control playback

Copy link
Owner

@brahmkshatriya brahmkshatriya left a comment

Choose a reason for hiding this comment

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

I am thinking, it would be better to just combine tracker extensions and controller extensions to a simply PlayerExtension (suggest better name if you can think any)
because to me, it seems excessive to have so many types of different extensions.

Copy link
Owner

Choose a reason for hiding this comment

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

It would be better if you use this class here. (you can move this class to common package)

data class Message(
val message: String,
val action: Action? = null
)

Copy link
Owner

Choose a reason for hiding this comment

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

and also using MutableSharedFlow<Message> instead of those functions.

Copy link
Owner

Choose a reason for hiding this comment

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

Rename to onClose()

Copy link
Owner

Choose a reason for hiding this comment

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

I recommend using MutableSharedFlow<T> instead of suspend (t: T) -> Unit for all the var on...Request, and converting this abstract class to an interface.

you can see how MutableSharedFlow works here: https://developer.android.com/kotlin/flow/stateflow-and-sharedflow#sharedflow

Also, it'd be better if you move all data classes and enums to models package

@brahmkshatriya
Copy link
Owner

Thanks again for the PR!

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