Skip to content

brahmkshatriya/echo-extension-template

Repository files navigation

Echo Extension Template

This is a template for creating an Echo extension. It includes a basic structure for the extension, so you do not have to start from scratch.

Getting Started

1. you can clone this repository.

Clone this repository and name it as you want.

2. Configure the gradle.properties

The file will have the following properties:

  • libVersion - The version of the Echo library, defaults to main-SNAPSHOT.
  • extType - The type of the extension you want to create. It can be music, tracker or lyrics. More information can be found in Extension<*> java doc.
  • extId - The id of the extension. (Do not use spaces or special characters)
  • extClass - The class of the extension. This should be the class that you inherit client interfaces to. For example in this template, it is TestExtension.
  • extIcon - (Optional) The icon of the extension. Will be cropped into a circle.
  • extName - The name of the extension.
  • extDescription - The description of the extension.
  • extAuthor - The author of the extension.
  • extAuthorUrl - (Optional) The author's website.
  • extRepoUrl - (Optional) The repository URL of the extension.
  • extUpdateUrl - (Optional) The update URL of the extension. The following urls are supported:

3. Implement the extension

Here's where the fun begins. Echo checks for Client interfaces that your extension implemented to know if your extension supports the feature or not.

  • What are Client interfaces?
    • These are interfaces that include functions your extension need to implement (override fun).
    • For example, if you want to create a lyrics extension, you need to implement the LyricsClient interface.
  • What interfaces are available?
    • By default, the TestExtension implements the ExtensionClient interface.
    • Pro tip: Hover over the interface to see the documentation, Click on every one things that is clickable to dive deep into the rabbit hole.
    • You can find all the available interfaces, for:
      • Music Extension - here
      • Tracker Extension - here
      • Lyrics Extension - here

The best example of how to implement an extension should be the Spotify Extension.

4. Making network requests

If your extension needs to make network requests, you can use OkHttpClient class provided directly by Echo. For example:

class TestExtension : ExtensionClient {
    private val client = OkHttpClient()

    override suspend fun someNiceFunction() {
        val request = Request.Builder().url("https://example.com").build()
        val response = client.newCall(request).await()
        println(response.body?.string())
    }
}

If you are using OkHttpClient, use the custom await() function for suspending the network call.

5. Testing the extension

There are two ways to test the extension:

  • Local testing: You can test the extension locally by running the tests in the ExtensionUnitTest class.
  • App testing: You can test the extension in the Echo app by building & installing the app & then opening Echo app.

6. Publishing the extension

This template includes a GitHub Actions workflow that will automatically build and publish the extension to GitHub releases when you make a new commit. You can find the workflow file here. You need to do the following steps to publish the extension:

  • Enable Read & write permissions for workflows in the repository settings (Settings -> Actions -> General -> Workflow Permissions).
  • Generate a keystore file : https://developer.android.com/studio/publish/app-signing#generate-key
  • Add action secrets in the repository settings (Settings -> Secrets and variables -> Actions -> New repository secret):
    • KEYSTORE_B64 - The base64 encoded keystore file. How to
    • PASSWORD - The password of the keystore file.

About

A template repo, for creating Extensions for Echo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages