-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from TimerTiTi/73-log-home-setting
close #73 log home setting
- Loading branch information
Showing
24 changed files
with
753 additions
and
87 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
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,14 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="30dp" | ||
android:height="30dp" | ||
android:viewportWidth="30" | ||
android:viewportHeight="30"> | ||
<group> | ||
<clip-path | ||
android:pathData="M3,3h24.011v24h-24.011z"/> | ||
<path | ||
android:pathData="M13.872,26.989H16.139C17.003,26.989 17.665,26.461 17.867,25.631L18.349,23.533L18.708,23.41L20.537,24.531C21.267,24.992 22.108,24.879 22.725,24.262L24.296,22.703C24.913,22.086 25.025,21.233 24.565,20.515L23.421,18.697L23.555,18.361L25.654,17.867C26.473,17.665 27.011,16.992 27.011,16.139V13.917C27.011,13.064 26.484,12.391 25.654,12.189L23.578,11.684L23.432,11.325L24.576,9.508C25.037,8.79 24.924,7.948 24.307,7.32L22.736,5.749C22.13,5.143 21.289,5.031 20.56,5.48L18.731,6.602L18.349,6.456L17.867,4.358C17.665,3.527 17.003,3 16.139,3H13.872C13.008,3 12.346,3.527 12.144,4.358L11.651,6.456L11.269,6.602L9.452,5.48C8.722,5.031 7.87,5.143 7.264,5.749L5.704,7.32C5.087,7.948 4.964,8.79 5.435,9.508L6.568,11.325L6.433,11.684L4.358,12.189C3.527,12.391 3,13.064 3,13.917V16.139C3,16.992 3.539,17.665 4.358,17.867L6.456,18.361L6.579,18.697L5.446,20.515C4.975,21.233 5.098,22.086 5.715,22.703L7.275,24.262C7.892,24.879 8.745,24.992 9.474,24.531L11.292,23.41L11.651,23.533L12.144,25.631C12.346,26.461 13.008,26.989 13.872,26.989ZM14.052,25.238C13.861,25.238 13.76,25.16 13.726,24.98L13.053,22.198C12.369,22.029 11.729,21.76 11.247,21.457L8.801,22.961C8.666,23.062 8.52,23.039 8.386,22.905L7.062,21.581C6.938,21.457 6.927,21.323 7.017,21.166L8.52,18.742C8.262,18.271 7.971,17.631 7.791,16.947L5.008,16.285C4.829,16.251 4.75,16.15 4.75,15.959V14.086C4.75,13.884 4.818,13.794 5.008,13.76L7.78,13.087C7.959,12.358 8.296,11.696 8.498,11.281L7.006,8.857C6.905,8.689 6.916,8.554 7.039,8.419L8.374,7.118C8.509,6.983 8.633,6.961 8.801,7.062L11.224,8.532C11.707,8.262 12.391,7.982 13.064,7.791L13.726,5.008C13.76,4.829 13.861,4.75 14.052,4.75H15.959C16.15,4.75 16.251,4.829 16.274,5.008L16.958,7.813C17.654,7.993 18.26,8.274 18.764,8.543L21.199,7.062C21.379,6.961 21.491,6.983 21.637,7.118L22.961,8.419C23.095,8.554 23.095,8.689 22.994,8.857L21.502,11.281C21.715,11.696 22.041,12.358 22.22,13.087L25.003,13.76C25.182,13.794 25.261,13.884 25.261,14.086V15.959C25.261,16.15 25.171,16.251 25.003,16.285L22.209,16.947C22.029,17.631 21.749,18.271 21.48,18.742L22.983,21.166C23.073,21.323 23.073,21.457 22.938,21.581L21.625,22.905C21.48,23.039 21.345,23.062 21.199,22.961L18.753,21.457C18.271,21.76 17.642,22.029 16.958,22.198L16.274,24.98C16.251,25.16 16.15,25.238 15.959,25.238H14.052ZM15.006,19.281C17.351,19.281 19.281,17.351 19.281,14.994C19.281,12.661 17.351,10.731 15.006,10.731C12.661,10.731 10.719,12.661 10.719,14.994C10.719,17.339 12.649,19.281 15.006,19.281ZM15.006,17.541C13.614,17.541 12.47,16.397 12.47,14.994C12.47,13.614 13.614,12.47 15.006,12.47C16.375,12.47 17.519,13.614 17.519,14.994C17.519,16.386 16.375,17.541 15.006,17.541Z" | ||
android:fillColor="#ffffff" | ||
android:fillAlpha="0.85"/> | ||
</group> | ||
</vector> |
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
7 changes: 6 additions & 1 deletion
7
.../data/graph/api/GraphCheckedRepository.kt → ...iti/app/data/graph/api/GraphRepository.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,11 +1,16 @@ | ||
package com.titi.app.data.graph.api | ||
|
||
import com.titi.app.data.graph.api.model.GraphCheckedRepositoryModel | ||
import com.titi.app.data.graph.api.model.GraphGoalTimeRepositoryModel | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
interface GraphCheckedRepository { | ||
interface GraphRepository { | ||
|
||
suspend fun setGraphChecked(graphCheckedRepositoryModel: GraphCheckedRepositoryModel) | ||
|
||
fun getGraphCheckedFlow(): Flow<GraphCheckedRepositoryModel> | ||
|
||
suspend fun setGraphGoalTime(graphGoalTimeRepositoryModel: GraphGoalTimeRepositoryModel) | ||
|
||
fun getGraphGoalTimeFlow(): Flow<GraphGoalTimeRepositoryModel> | ||
} |
6 changes: 6 additions & 0 deletions
6
...aph/api/src/main/kotlin/com/titi/app/data/graph/api/model/GraphGoalTimeRepositoryModel.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,6 @@ | ||
package com.titi.app.data.graph.api.model | ||
|
||
data class GraphGoalTimeRepositoryModel( | ||
val monthGoalTime: Int, | ||
val weekGoalTime: Int, | ||
) |
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
35 changes: 35 additions & 0 deletions
35
data/graph/impl/src/main/kotlin/com/titi/app/data/graph/impl/local/GraphGoalTimeDataStore.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,35 @@ | ||
package com.titi.app.data.graph.impl.local | ||
|
||
import android.content.Context | ||
import androidx.datastore.core.DataStore | ||
import androidx.datastore.preferences.core.Preferences | ||
import androidx.datastore.preferences.core.stringPreferencesKey | ||
import androidx.datastore.preferences.preferencesDataStore | ||
import com.titi.app.core.util.fromJson | ||
import com.titi.app.core.util.readFlowValue | ||
import com.titi.app.core.util.storeValue | ||
import com.titi.app.core.util.toJson | ||
import com.titi.app.data.graph.impl.local.model.GraphGoalTimeEntity | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.map | ||
|
||
internal class GraphGoalTimeDataStore(context: Context) { | ||
private val dataStore: DataStore<Preferences> = context.dataStore | ||
|
||
suspend fun setGraphGoalTime(graphGoalTimeEntity: GraphGoalTimeEntity) { | ||
dataStore.storeValue(GRAPH_GOAL_TIME_KEY, graphGoalTimeEntity.toJson()) | ||
} | ||
|
||
fun getGraphGoalTimeFlow(): Flow<GraphGoalTimeEntity?> { | ||
return dataStore.readFlowValue(GRAPH_GOAL_TIME_KEY).map { it?.fromJson() } | ||
} | ||
|
||
companion object { | ||
private const val GRAPH_GOAL_TIME_PREF_NAME = "graphGoalTimePrefName" | ||
private val GRAPH_GOAL_TIME_KEY = stringPreferencesKey("graphGoalTimeKey") | ||
|
||
private val Context.dataStore: DataStore<Preferences> by preferencesDataStore( | ||
name = GRAPH_GOAL_TIME_PREF_NAME, | ||
) | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...raph/impl/src/main/kotlin/com/titi/app/data/graph/impl/local/model/GraphGoalTimeEntity.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,6 @@ | ||
package com.titi.app.data.graph.impl.local.model | ||
|
||
internal data class GraphGoalTimeEntity( | ||
val monthGoalTime: Int, | ||
val weekGoalTime: Int, | ||
) |
7 changes: 7 additions & 0 deletions
7
...graph/impl/src/main/kotlin/com/titi/app/data/graph/impl/mapper/LocalToRepositoryMapper.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,8 +1,15 @@ | ||
package com.titi.app.data.graph.impl.mapper | ||
|
||
import com.titi.app.data.graph.api.model.GraphCheckedRepositoryModel | ||
import com.titi.app.data.graph.api.model.GraphGoalTimeRepositoryModel | ||
import com.titi.app.data.graph.impl.local.model.GraphCheckedEntity | ||
import com.titi.app.data.graph.impl.local.model.GraphGoalTimeEntity | ||
|
||
internal fun GraphCheckedEntity.toRepositoryModel() = GraphCheckedRepositoryModel( | ||
checkedButtonStates = checkedButtonStates, | ||
) | ||
|
||
internal fun GraphGoalTimeEntity.toRepositoryModel() = GraphGoalTimeRepositoryModel( | ||
monthGoalTime = monthGoalTime, | ||
weekGoalTime = weekGoalTime, | ||
) |
7 changes: 7 additions & 0 deletions
7
...graph/impl/src/main/kotlin/com/titi/app/data/graph/impl/mapper/RepositoryToLocalMapper.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,8 +1,15 @@ | ||
package com.titi.app.data.graph.impl.mapper | ||
|
||
import com.titi.app.data.graph.api.model.GraphCheckedRepositoryModel | ||
import com.titi.app.data.graph.api.model.GraphGoalTimeRepositoryModel | ||
import com.titi.app.data.graph.impl.local.model.GraphCheckedEntity | ||
import com.titi.app.data.graph.impl.local.model.GraphGoalTimeEntity | ||
|
||
internal fun GraphCheckedRepositoryModel.toLocalModel() = GraphCheckedEntity( | ||
checkedButtonStates = checkedButtonStates, | ||
) | ||
|
||
internal fun GraphGoalTimeRepositoryModel.toLocalModel() = GraphGoalTimeEntity( | ||
monthGoalTime = monthGoalTime, | ||
weekGoalTime = weekGoalTime, | ||
) |
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: 9 additions & 0 deletions
9
feature/log/src/main/kotlin/com/titi/app/feature/log/mapper/FeatureToRepositoryMapper.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,9 @@ | ||
package com.titi.app.feature.log.mapper | ||
|
||
import com.titi.app.data.graph.api.model.GraphGoalTimeRepositoryModel | ||
import com.titi.app.feature.log.model.GraphGoalTimeUiState | ||
|
||
internal fun GraphGoalTimeUiState.toRepositoryModel() = GraphGoalTimeRepositoryModel( | ||
monthGoalTime = monthGoalTime, | ||
weekGoalTime = weekGoalTime, | ||
) |
9 changes: 9 additions & 0 deletions
9
feature/log/src/main/kotlin/com/titi/app/feature/log/mapper/RepositoryToFeatureMapper.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,9 @@ | ||
package com.titi.app.feature.log.mapper | ||
|
||
import com.titi.app.data.graph.api.model.GraphGoalTimeRepositoryModel | ||
import com.titi.app.feature.log.model.GraphGoalTimeUiState | ||
|
||
internal fun GraphGoalTimeRepositoryModel.toFeatureModel() = GraphGoalTimeUiState( | ||
monthGoalTime = monthGoalTime, | ||
weekGoalTime = weekGoalTime, | ||
) |
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.