Skip to content

Commit 1dfb84e

Browse files
authored
Merge #100 -> develop
[Feat/#100] QA 4차
2 parents 906b02b + c86642a commit 1dfb84e

File tree

15 files changed

+203
-200
lines changed

15 files changed

+203
-200
lines changed

app/build.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ android {
5555
compose = true
5656
buildConfig = true
5757
}
58+
signingConfigs {
59+
getByName("debug") {
60+
keyAlias = "androiddebugkey"
61+
keyPassword = "android"
62+
storeFile = File("${project.rootDir.absolutePath}/keystore/debug.keystore")//project.rootProject.file("debug.keystore")
63+
storePassword = "android"
64+
}
65+
}
5866
}
5967

6068
dependencies {

app/src/main/java/com/paw/key/core/designsystem/component/CourseDetail.kt

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
3131
import androidx.compose.ui.layout.ContentScale
3232
import androidx.compose.ui.platform.LocalContext
3333
import androidx.compose.ui.res.vectorResource
34+
import androidx.compose.ui.text.style.TextOverflow
3435
import androidx.compose.ui.tooling.preview.Preview
3536
import androidx.compose.ui.unit.dp
3637
import androidx.compose.ui.zIndex
@@ -292,16 +293,20 @@ fun CourseDetail(
292293
.fillMaxWidth(fillRatio)
293294
.fillMaxHeight()
294295
.background(backgroundColor, RoundedCornerShape(6.dp))
295-
) {
296-
Text(
297-
text = tag.optionText,
298-
color = PawKeyTheme.colors.black,
299-
modifier = Modifier
300-
.align(Alignment.CenterStart)
301-
.padding(horizontal = 16.dp),
302-
style = PawKeyTheme.typography.caption12Sb2
303-
)
304-
}
296+
)
297+
298+
Text(
299+
text = tag.optionText,
300+
color = PawKeyTheme.colors.black,
301+
modifier = Modifier
302+
.align(Alignment.CenterStart)
303+
.padding(horizontal = 16.dp)
304+
.zIndex(1f),
305+
style = PawKeyTheme.typography.caption12Sb2,
306+
maxLines = 1,
307+
softWrap = false,
308+
overflow = TextOverflow.Visible
309+
)
305310
}
306311
}
307312
}

app/src/main/java/com/paw/key/core/designsystem/component/TopBar.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
package com.paw.key.core.designsystem.component
22

3-
import androidx.compose.foundation.clickable
4-
import androidx.compose.foundation.layout.Arrangement
53
import androidx.compose.foundation.layout.Box
6-
import androidx.compose.foundation.layout.Row
7-
import androidx.compose.foundation.layout.Spacer
84
import androidx.compose.foundation.layout.fillMaxWidth
95
import androidx.compose.foundation.layout.padding
10-
import androidx.compose.foundation.layout.width
116
import androidx.compose.material3.Icon
127
import androidx.compose.material3.Text
138
import androidx.compose.runtime.Composable
@@ -19,6 +14,7 @@ import androidx.compose.ui.tooling.preview.Preview
1914
import androidx.compose.ui.unit.dp
2015
import com.paw.key.R
2116
import com.paw.key.core.designsystem.theme.PawKeyTheme
17+
import com.paw.key.core.util.noRippleClickable
2218

2319
@Composable
2420
fun TopBar(
@@ -38,7 +34,7 @@ fun TopBar(
3834
contentDescription = "뒤로가기",
3935
modifier = Modifier
4036
.align(Alignment.CenterStart)
41-
.clickable { onBackClick() }
37+
.noRippleClickable { onBackClick() }
4238
)
4339
}
4440

app/src/main/java/com/paw/key/core/util/PreferenceDataStore.kt

Lines changed: 72 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -38,135 +38,115 @@ private fun String.toLatLngList(): List<LatLng> =
3838
}
3939

4040
object PreferenceDataStore {
41+
42+
private lateinit var appContext: Context
43+
44+
fun init(context: Context) {
45+
appContext = context.applicationContext
46+
}
47+
48+
private val summaryStore
49+
get() = appContext.summaryStore
50+
51+
4152
suspend fun saveWalkSummary(
42-
context: Context,
4353
points: List<LatLng>,
4454
totalDistance: Float,
4555
totalTime: Long,
4656
totalSteps: Int,
4757
) {
48-
context.summaryStore.edit { preferences ->
58+
summaryStore.edit { preferences ->
4959
preferences[POINTS_KEY] = points.toPreferenceString()
5060
preferences[TOTAL_DISTANCE_KEY] = totalDistance
5161
preferences[TOTAL_TIME_KEY] = totalTime
5262
preferences[TOTAL_STEPS_KEY] = totalSteps
5363
}
5464
}
5565

56-
fun getPoints(context: Context): Flow<List<LatLng>> {
57-
return context.summaryStore.data.map { preferences ->
58-
preferences[POINTS_KEY]?.toLatLngList() ?: emptyList()
59-
}
66+
fun getPoints(): Flow<List<LatLng>> = summaryStore.data.map {
67+
it[POINTS_KEY]?.toLatLngList() ?: emptyList()
6068
}
6169

62-
fun getTotalDistance(context: Context): Flow<Float> {
63-
return context.summaryStore.data.map { preferences ->
64-
preferences[TOTAL_DISTANCE_KEY] ?: 0f
65-
}
70+
fun getTotalDistance(): Flow<Float> = summaryStore.data.map {
71+
it[TOTAL_DISTANCE_KEY] ?: 0f
6672
}
6773

68-
fun getTotalTime(context: Context): Flow<Long> {
69-
return context.summaryStore.data.map { preferences ->
70-
preferences[TOTAL_TIME_KEY] ?: 0L
71-
}
74+
fun getTotalTime(): Flow<Long> = summaryStore.data.map {
75+
it[TOTAL_TIME_KEY] ?: 0L
7276
}
7377

74-
fun getTotalSteps(context: Context): Flow<Int> {
75-
return context.summaryStore.data.map { preferences ->
76-
preferences[TOTAL_STEPS_KEY] ?: 0
77-
}
78+
fun getTotalSteps(): Flow<Int> = summaryStore.data.map {
79+
it[TOTAL_STEPS_KEY] ?: 0
7880
}
7981

80-
suspend fun clearWalkSummary(context: Context) {
81-
context.summaryStore.edit { preferences ->
82-
preferences.remove(POINTS_KEY)
83-
preferences.remove(TOTAL_DISTANCE_KEY)
84-
preferences.remove(TOTAL_TIME_KEY)
85-
preferences.remove(TOTAL_STEPS_KEY)
82+
suspend fun clearWalkSummary() {
83+
summaryStore.edit {
84+
it.remove(POINTS_KEY)
85+
it.remove(TOTAL_DISTANCE_KEY)
86+
it.remove(TOTAL_TIME_KEY)
87+
it.remove(TOTAL_STEPS_KEY)
8688
}
8789
}
8890

89-
suspend fun saveLoginInfo(
90-
context: Context,
91-
email: String,
92-
password: String
93-
) {
94-
context.summaryStore.edit { preferences ->
95-
preferences[LOGIN_EMAIL_KEY] = email
96-
preferences[LOGIN_PASSWORD_KEY] = password
91+
suspend fun saveLoginInfo(email: String, password: String) {
92+
summaryStore.edit {
93+
it[LOGIN_EMAIL_KEY] = email
94+
it[LOGIN_PASSWORD_KEY] = password
9795
}
9896
}
9997

100-
fun getLoginEmail(context: Context): Flow<String> {
101-
return context.summaryStore.data.map { preferences ->
102-
preferences[LOGIN_EMAIL_KEY] ?: ""
103-
}
98+
fun getLoginEmail(): Flow<String> = summaryStore.data.map {
99+
it[LOGIN_EMAIL_KEY] ?: ""
104100
}
105101

106-
fun getLoginPassword(context: Context): Flow<String> {
107-
return context.summaryStore.data.map { preferences ->
108-
preferences[LOGIN_PASSWORD_KEY] ?: ""
109-
}
102+
fun getLoginPassword(): Flow<String> = summaryStore.data.map {
103+
it[LOGIN_PASSWORD_KEY] ?: ""
110104
}
111105

112-
data class LoginInfo(
113-
val email: String,
114-
val password: String
115-
)
106+
data class LoginInfo(val email: String, val password: String)
116107

117-
fun getLoginInfo(context: Context): Flow<LoginInfo> {
118-
return context.summaryStore.data.map { preferences ->
119-
LoginInfo(
120-
email = preferences[LOGIN_EMAIL_KEY] ?: "",
121-
password = preferences[LOGIN_PASSWORD_KEY] ?: ""
122-
)
123-
}
108+
fun getLoginInfo(): Flow<LoginInfo> = summaryStore.data.map {
109+
LoginInfo(
110+
email = it[LOGIN_EMAIL_KEY] ?: "",
111+
password = it[LOGIN_PASSWORD_KEY] ?: ""
112+
)
124113
}
125114

126-
suspend fun clearLoginInfo(context: Context) {
127-
context.summaryStore.edit { preferences ->
128-
preferences.remove(LOGIN_EMAIL_KEY)
129-
preferences.remove(LOGIN_PASSWORD_KEY)
115+
suspend fun clearLoginInfo() {
116+
summaryStore.edit {
117+
it.remove(LOGIN_EMAIL_KEY)
118+
it.remove(LOGIN_PASSWORD_KEY)
130119
}
131120
}
132121

133122
suspend fun saveUserInfo(
134-
context: Context,
135123
userId: Int,
136124
userName: String,
137125
petId: Int,
138126
petName: String
139127
) {
140-
context.summaryStore.edit { preferences ->
141-
preferences[USER_ID_KEY] = userId
142-
preferences[USER_NAME_KEY] = userName
143-
preferences[PET_ID_KEY] = petId
144-
preferences[PET_NAME_KEY] = petName
128+
summaryStore.edit {
129+
it[USER_ID_KEY] = userId
130+
it[USER_NAME_KEY] = userName
131+
it[PET_ID_KEY] = petId
132+
it[PET_NAME_KEY] = petName
145133
}
146134
}
147135

148-
fun getUserId(context: Context): Flow<Int> {
149-
return context.summaryStore.data.map { preferences ->
150-
preferences[USER_ID_KEY] ?: 0
151-
}
136+
fun getUserId(): Flow<Int> = summaryStore.data.map {
137+
it[USER_ID_KEY] ?: 0
152138
}
153139

154-
fun getUserName(context: Context): Flow<String> {
155-
return context.summaryStore.data.map { preferences ->
156-
preferences[USER_NAME_KEY] ?: ""
157-
}
140+
fun getUserName(): Flow<String> = summaryStore.data.map {
141+
it[USER_NAME_KEY] ?: ""
158142
}
159143

160-
fun getPetId(context: Context): Flow<Int> {
161-
return context.summaryStore.data.map { preferences ->
162-
preferences[PET_ID_KEY] ?: 0
163-
}
144+
fun getPetId(): Flow<Int> = summaryStore.data.map {
145+
it[PET_ID_KEY] ?: 0
164146
}
165147

166-
fun getPetName(context: Context): Flow<String> {
167-
return context.summaryStore.data.map { preferences ->
168-
preferences[PET_NAME_KEY] ?: ""
169-
}
148+
fun getPetName(): Flow<String> = summaryStore.data.map {
149+
it[PET_NAME_KEY] ?: ""
170150
}
171151

172152
data class UserInfo(
@@ -176,29 +156,25 @@ object PreferenceDataStore {
176156
val petName: String
177157
)
178158

179-
fun getUserInfo(context: Context): Flow<UserInfo> {
180-
return context.summaryStore.data.map { preferences ->
181-
UserInfo(
182-
userId = preferences[USER_ID_KEY] ?: 0,
183-
userName = preferences[USER_NAME_KEY] ?: "",
184-
petId = preferences[PET_ID_KEY] ?: 0,
185-
petName = preferences[PET_NAME_KEY] ?: ""
186-
)
187-
}
159+
fun getUserInfo(): Flow<UserInfo> = summaryStore.data.map {
160+
UserInfo(
161+
userId = it[USER_ID_KEY] ?: 0,
162+
userName = it[USER_NAME_KEY] ?: "",
163+
petId = it[PET_ID_KEY] ?: 0,
164+
petName = it[PET_NAME_KEY] ?: ""
165+
)
188166
}
189167

190-
suspend fun clearUserInfo(context: Context) {
191-
context.summaryStore.edit { preferences ->
192-
preferences.remove(USER_ID_KEY)
193-
preferences.remove(USER_NAME_KEY)
194-
preferences.remove(PET_ID_KEY)
195-
preferences.remove(PET_NAME_KEY)
168+
suspend fun clearUserInfo() {
169+
summaryStore.edit {
170+
it.remove(USER_ID_KEY)
171+
it.remove(USER_NAME_KEY)
172+
it.remove(PET_ID_KEY)
173+
it.remove(PET_NAME_KEY)
196174
}
197175
}
198176

199-
suspend fun clearAllData(context: Context) {
200-
context.summaryStore.edit { preferences ->
201-
preferences.clear()
202-
}
177+
suspend fun clearAllData() {
178+
summaryStore.edit { it.clear() }
203179
}
204180
}

app/src/main/java/com/paw/key/presentation/ui/course/entire/EntireCourseScreen.kt

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ fun EntireCourseScreen(
159159
onTabSelected : (Int) -> Unit,
160160
modifier: Modifier = Modifier,
161161
) {
162+
val scope = rememberCoroutineScope()
163+
162164
Column (
163165
modifier = modifier
164166
.padding(paddingValues)
@@ -176,15 +178,24 @@ fun EntireCourseScreen(
176178

177179
when (currentPage) {
178180
0 -> {
179-
TapMapRoute(
180-
paddingValues = paddingValues,
181-
navigateUp = {},
182-
navigateNext = {
183-
navigateNext()
184-
},
185-
isGranted = isGranted,
186-
snackBarHostState = snackBarHostState,
187-
)
181+
if (!isGranted) {
182+
TapMapRoute(
183+
paddingValues = paddingValues,
184+
navigateUp = {},
185+
navigateNext = {
186+
navigateNext()
187+
},
188+
isGranted = isGranted,
189+
snackBarHostState = snackBarHostState,
190+
)
191+
} else {
192+
// 스낵바 알림만 띄우고 아무 것도 렌더링하지 않음
193+
LaunchedEffect(Unit) {
194+
scope.launch {
195+
snackBarHostState.showSnackbar("위치 권한이 필요합니다.")
196+
}
197+
}
198+
}
188199
}
189200

190201
1 -> {

0 commit comments

Comments
 (0)