-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Dependency Injection & Add Audio Caching
- Loading branch information
1 parent
3dcbaeb
commit 7cdb087
Showing
13 changed files
with
108 additions
and
59 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
.../echo/data/extensions/OfflineExtension.kt → ...hmkshatriya/echo/data/OfflineExtension.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
2 changes: 1 addition & 1 deletion
2
...ahmkshatriya/echo/di/ApkManifestParser.kt → ...echo/data/extensions/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
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
2 changes: 1 addition & 1 deletion
2
...mkshatriya/echo/di/RepoWithPreferences.kt → ...ho/data/extensions/RepoWithPreferences.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
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,48 @@ | ||
package dev.brahmkshatriya.echo.di | ||
|
||
import android.app.Application | ||
import android.content.Context | ||
import android.content.SharedPreferences | ||
import androidx.media3.common.util.UnstableApi | ||
import androidx.media3.database.StandaloneDatabaseProvider | ||
import androidx.media3.datasource.cache.LeastRecentlyUsedCacheEvictor | ||
import androidx.media3.datasource.cache.SimpleCache | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import dev.brahmkshatriya.echo.player.Queue | ||
import kotlinx.coroutines.flow.MutableSharedFlow | ||
import java.io.File | ||
import javax.inject.Singleton | ||
|
||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
class AppModule { | ||
|
||
@Provides | ||
@Singleton | ||
fun provideGlobalQueue() = Queue() | ||
|
||
@Provides | ||
@Singleton | ||
fun provideThrowableFlow() = MutableSharedFlow<Throwable>() | ||
|
||
@Provides | ||
@Singleton | ||
fun provideSettingsPreferences(application: Application): SharedPreferences = | ||
application.getSharedPreferences(application.packageName, Context.MODE_PRIVATE) | ||
|
||
@Provides | ||
@Singleton | ||
@UnstableApi | ||
fun provideCache(application: Application): SimpleCache { | ||
val databaseProvider = StandaloneDatabaseProvider(application) | ||
return SimpleCache( | ||
File(application.cacheDir, "exoplayer"), | ||
LeastRecentlyUsedCacheEvictor(100 * 1024 * 1024L), | ||
databaseProvider | ||
) | ||
} | ||
} |
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
12 changes: 0 additions & 12 deletions
12
app/src/main/java/dev/brahmkshatriya/echo/di/FlowModels.kt
This file was deleted.
Oops, something went wrong.
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
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