Skip to content

Commit

Permalink
Switch to common library (#4)
Browse files Browse the repository at this point in the history
* We playing with extenzion with this one 🗣️🗣️🔥🔥

* Move to library

* Actually Move to library

* Remove Local Extenzion

* Remove library dependency
  • Loading branch information
brahmkshatriya authored Feb 19, 2024
1 parent 44f60d4 commit 05f9ae1
Show file tree
Hide file tree
Showing 42 changed files with 167 additions and 391 deletions.
4 changes: 4 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ android {
}

dependencies {

implementation("com.github.brahmkshatriya:echo-common:0.0.1")
implementation("com.github.JeelPatel231:plugger:1.0.1")

implementation("org.jetbrains.kotlinx:kotlinx-coroutines-guava:1.7.1")

implementation("androidx.appcompat:appcompat:1.6.1")
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package dev.brahmkshatriya.echo.data.extensions

import dev.brahmkshatriya.echo.common.clients.ExtensionClient
import dev.brahmkshatriya.echo.common.data.extensions.OfflineExtension
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf
import tel.jeelpa.plugger.PluginRepo

class LocalExtensionRepo : PluginRepo<ExtensionClient> {
override fun getAllPlugins(): Flow<List<ExtensionClient>> =
flowOf(listOf(OfflineExtension()))
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.brahmkshatriya.echo.data.extensions
package dev.brahmkshatriya.echo.common.data.extensions

import android.content.Context
import android.net.Uri
Expand All @@ -7,25 +7,36 @@ import androidx.paging.PagingConfig
import androidx.paging.PagingData
import androidx.paging.PagingSource
import androidx.paging.PagingState
import dev.brahmkshatriya.echo.data.clients.HomeFeedClient
import dev.brahmkshatriya.echo.data.clients.SearchClient
import dev.brahmkshatriya.echo.data.clients.TrackClient
import dev.brahmkshatriya.echo.data.models.EchoMediaItem.Companion.toMediaItem
import dev.brahmkshatriya.echo.data.models.EchoMediaItem.Companion.toMediaItemsContainer
import dev.brahmkshatriya.echo.data.models.MediaItemsContainer
import dev.brahmkshatriya.echo.data.models.QuickSearchItem
import dev.brahmkshatriya.echo.data.models.StreamableAudio
import dev.brahmkshatriya.echo.data.models.StreamableAudio.Companion.toAudio
import dev.brahmkshatriya.echo.data.models.Track
import dev.brahmkshatriya.echo.data.offline.LocalAlbum
import dev.brahmkshatriya.echo.data.offline.LocalArtist
import dev.brahmkshatriya.echo.data.offline.LocalStream
import dev.brahmkshatriya.echo.data.offline.LocalTrack
import dev.brahmkshatriya.echo.common.clients.ExtensionClient
import dev.brahmkshatriya.echo.common.clients.HomeFeedClient
import dev.brahmkshatriya.echo.common.clients.SearchClient
import dev.brahmkshatriya.echo.common.clients.TrackClient
import dev.brahmkshatriya.echo.common.models.EchoMediaItem.Companion.toMediaItem
import dev.brahmkshatriya.echo.common.models.EchoMediaItem.Companion.toMediaItemsContainer
import dev.brahmkshatriya.echo.common.models.ExtensionMetadata
import dev.brahmkshatriya.echo.common.models.MediaItemsContainer
import dev.brahmkshatriya.echo.common.models.QuickSearchItem
import dev.brahmkshatriya.echo.common.models.StreamableAudio
import dev.brahmkshatriya.echo.common.models.StreamableAudio.Companion.toAudio
import dev.brahmkshatriya.echo.common.models.Track
import dev.brahmkshatriya.echo.common.data.offline.LocalAlbum
import dev.brahmkshatriya.echo.common.data.offline.LocalArtist
import dev.brahmkshatriya.echo.common.data.offline.LocalStream
import dev.brahmkshatriya.echo.common.data.offline.LocalTrack
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import java.io.IOException

class OfflineExtension(val context: Context) : SearchClient, TrackClient, HomeFeedClient {
class OfflineExtension : ExtensionClient(), SearchClient, TrackClient, HomeFeedClient {

override fun getMetadata() = ExtensionMetadata(
name = "Offline",
version = "1.0.0",
description = "Local media library",
author = "Echo",
iconUrl = null
)

override suspend fun quickSearch(query: String): List<QuickSearchItem> = listOf()

override suspend fun search(query: String): Flow<PagingData<MediaItemsContainer>> = flow {
Expand Down Expand Up @@ -109,4 +120,5 @@ class OfflineExtension(val context: Context) : SearchClient, TrackClient, HomeFe
pagingSourceFactory = { OfflinePagingSource(context) }
).flow


}
31 changes: 0 additions & 31 deletions app/src/main/java/dev/brahmkshatriya/echo/data/models/Album.kt

This file was deleted.

26 changes: 0 additions & 26 deletions app/src/main/java/dev/brahmkshatriya/echo/data/models/Artist.kt

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

29 changes: 0 additions & 29 deletions app/src/main/java/dev/brahmkshatriya/echo/data/models/Playlist.kt

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 05f9ae1

Please sign in to comment.