-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for extensions working with flows
- Loading branch information
1 parent
b5fc7bb
commit 549eac7
Showing
33 changed files
with
439 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 4 additions & 5 deletions
9
app/src/main/java/dev/brahmkshatriya/echo/data/extensions/LocalExtensionRepo.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
package dev.brahmkshatriya.echo.data.extensions | ||
|
||
import android.content.Context | ||
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())) | ||
class LocalExtensionRepo(val context: Context) : PluginRepo<ExtensionClient> { | ||
override fun getAllPlugins(exceptionHandler: (Exception) -> Unit) = | ||
flowOf(listOf(OfflineExtension(context))) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
app/src/main/java/dev/brahmkshatriya/echo/di/ApkManifestParser.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package dev.brahmkshatriya.echo.di | ||
|
||
import android.content.pm.ApplicationInfo | ||
import tel.jeelpa.plugger.ManifestParser | ||
import tel.jeelpa.plugger.models.PluginMetadata | ||
|
||
class ApkManifestParser: ManifestParser<ApplicationInfo> { | ||
override fun parseManifest(data: ApplicationInfo): PluginMetadata { | ||
|
||
return PluginMetadata( | ||
path = data.sourceDir, | ||
className = data.metaData.getString("class") | ||
?: error("Class Name not found in Metadata for ${data.packageName}"), | ||
) | ||
} | ||
} |
17 changes: 0 additions & 17 deletions
17
app/src/main/java/dev/brahmkshatriya/echo/di/ContextProviderForRepo.kt
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
app/src/main/java/dev/brahmkshatriya/echo/di/FlowModels.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package dev.brahmkshatriya.echo.di | ||
|
||
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 kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.MutableStateFlow | ||
|
||
|
||
// Dagger cannot directly infer Foo<Bar>, if Bar is an interface | ||
// That means the Flow<Clients?> cannot be directly injected, | ||
// So, we need to wrap it in a data class and inject that instead | ||
data class MutableExtensionFlow(val flow: MutableStateFlow<ExtensionClient?>) | ||
data class ExtensionFlow(val flow: Flow<ExtensionClient?>) | ||
data class SearchFlow(val flow: Flow<SearchClient?>) | ||
data class HomeFeedFlow(val flow: Flow<HomeFeedClient?>) | ||
data class TrackFlow(val flow: Flow<TrackClient?>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.