-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Migrated from MMKV to DataStore for preferences
This commit replaces MMKV with DataStore for managing application preferences. This change improves the overall structure and maintainability of the preferences system by utilizing a more modern and robust solution offered by Jetpack DataStore. The `AppPreferences` class now handles preference management with DataStore, and a `PreferenceDelegate` was introduced for type-safe preference delegation. Additionally, the `CoreSettings` class, previously used with MMKV, has been removed and its logic integrated into the `AppPreferences` structure.
- Loading branch information
Showing
25 changed files
with
480 additions
and
503 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
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
27 changes: 27 additions & 0 deletions
27
app/src/main/java/com/bobbyesp/metadator/di/AppCoreFunctionalitiesModule.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,27 @@ | ||
package com.bobbyesp.metadator.di | ||
|
||
import androidx.datastore.core.DataStore | ||
import androidx.datastore.preferences.core.Preferences | ||
import com.bobbyesp.metadator.util.preferences.AppPreferences | ||
import com.bobbyesp.metadator.util.preferences.datastore.dataStore | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.SupervisorJob | ||
import org.koin.android.ext.koin.androidContext | ||
import org.koin.core.qualifier.named | ||
import org.koin.dsl.module | ||
|
||
val appCoroutinesScope = module { | ||
single<CoroutineScope>( | ||
qualifier = named("AppMainSupervisedScope") | ||
) { CoroutineScope(SupervisorJob()) } | ||
} | ||
|
||
val coreFunctionalitiesModule = module { | ||
single<DataStore<Preferences>> { androidContext().dataStore } | ||
single<AppPreferences> { | ||
AppPreferences( | ||
dataStore = androidContext().dataStore, | ||
scope = get(qualifier = named("AppMainSupervisedScope")) | ||
) | ||
} | ||
} |
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
...tor/presentation/pages/home/LayoutType.kt → ...yesp/metadator/domain/enums/LayoutType.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
128 changes: 0 additions & 128 deletions
128
app/src/main/java/com/bobbyesp/metadator/presentation/HorizontalFloatingAppBarWrapper.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.