Skip to content

Commit

Permalink
Merge pull request #29 from raheemadamboev/1.1.5
Browse files Browse the repository at this point in the history
1.1.5
  • Loading branch information
raheemadamboev authored Sep 17, 2022
2 parents cff5a86 + d53edbc commit 9629854
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
16 changes: 8 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ android {
applicationId "xyz.teamgravity.todo"
minSdk 21
targetSdk 33
versionCode 6
versionName "1.1.4"
versionCode 7
versionName "1.1.5"

javaCompileOptions {
annotationProcessorOptions {
Expand Down Expand Up @@ -92,19 +92,19 @@ android {
dependencies {

// core
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.core:core-ktx:1.9.0'

// compose
implementation "androidx.compose.ui:ui:1.3.0-beta01"
implementation "androidx.compose.ui:ui:1.3.0-beta02"

// compose material2
implementation "androidx.compose.material:material:1.3.0-beta01"
implementation "androidx.compose.material:material:1.3.0-beta02"

// compose material3
implementation 'androidx.compose.material3:material3:1.0.0-beta01'
implementation 'androidx.compose.material3:material3:1.0.0-beta02'

// compose preview
implementation "androidx.compose.ui:ui-tooling-preview:1.3.0-beta01"
implementation "androidx.compose.ui:ui-tooling-preview:1.3.0-beta02"

// compose activity
implementation 'androidx.activity:activity-compose:1.5.1'
Expand All @@ -113,7 +113,7 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout-compose:1.0.1'

// compose icons
implementation "androidx.compose.material:material-icons-extended:1.3.0-beta01"
implementation "androidx.compose.material:material-icons-extended:1.3.0-beta02"

// compose viewmodel
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package xyz.teamgravity.todo.data.local.preferences

import android.content.Context
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.*
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.preferencesDataStore
Expand All @@ -12,8 +11,6 @@ import kotlinx.coroutines.flow.map
import kotlinx.coroutines.withContext
import java.io.IOException

private val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = xyz.teamgravity.todo.data.local.preferences.Preferences.PREFS)

class Preferences(context: Context) {

companion object {
Expand All @@ -35,7 +32,8 @@ class Preferences(context: Context) {
private const val DEFAULT_HIDE_COMPLETED = false
}

private val store = context.dataStore
private val Context.store by preferencesDataStore(name = PREFS)
private val store = context.store

///////////////////////////////////////////////////////////////////////////
// UPDATE
Expand All @@ -58,7 +56,7 @@ class Preferences(context: Context) {
///////////////////////////////////////////////////////////////////////////

val preferences: Flow<PreferencesModel> = store.data
.catch { handleIOException(it) }
.catch { emit(handleIOException(it)) }
.map { preferences ->
val sort = TodoSort.valueOf(preferences[TODO_SORT] ?: DEFAULT_TODO_SORT)

Expand Down

0 comments on commit 9629854

Please # to comment.