Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
applicationId = "com.combo.runcombi"
minSdk = 26
targetSdk = 35
versionCode = 108
versionName = "1.0.8"
versionCode = 109
versionName = "1.0.9"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

Expand Down Expand Up @@ -71,6 +71,9 @@ dependencies {
ksp(libs.hilt.compiler)
implementation(libs.hilt.android)
implementation(libs.v2.user)

// Wear OS 연동
implementation(libs.play.services.wearable)

// Firebase
implementation(platform(libs.firebase.bom))
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@
android:scheme="kakao${kakaoApiKey}" />
</intent-filter>
</activity>

<service
android:name="com.combo.runcombi.main.wear.MobileWearDataListenerService"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.gms.wearable.DATA_CHANGED" />
<data android:scheme="wear" android:host="*" />
</intent-filter>
</service>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ class AuthTokenProvider @Inject constructor(
private val authDataSource: AuthDataSource,
) : TokenProvider {
override suspend fun getAccessToken(): String? {
return authDataSource.getAccessToken().firstOrNull()
android.util.Log.d("AuthTokenProvider", "getAccessToken 호출")
val token = authDataSource.getAccessToken().firstOrNull()
android.util.Log.d("AuthTokenProvider", "getAccessToken 결과: ${token?.take(20)}...")
return token
}

override suspend fun getRefreshToken(): String? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@ import javax.inject.Inject
class UserRepositoryImpl @Inject constructor(private val userService: UserService) :
UserRepository {
override suspend fun getUserInfo(): DomainResult<UserInfo> = handleResult {
userService.getUserInfo()
android.util.Log.d("UserRepositoryImpl", "getUserInfo API 호출 시작")
val response = userService.getUserInfo()
android.util.Log.d("UserRepositoryImpl", "getUserInfo API 응답: ${response.code()}, ${response.body()}")
response
}.convert {
it.toDomainModel()
android.util.Log.d("UserRepositoryImpl", "getUserInfo 데이터 변환 시작: $it")
val result = it.toDomainModel()
android.util.Log.d("UserRepositoryImpl", "getUserInfo 데이터 변환 완료: $result")
result
}

override suspend fun setUserTerms(agreeTerms: List<String>): DomainResult<Unit> = handleResult {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.combo.runcombi.walk.repository
import com.combo.runcombi.common.DomainResult
import com.combo.runcombi.common.convert
import com.combo.runcombi.common.handleResult
import com.combo.runcombi.network.model.request.MidRunUpdateRequest
import com.combo.runcombi.network.model.request.StartRunRequest
import com.combo.runcombi.network.model.response.MemberRunData
import com.combo.runcombi.network.model.response.PetId
Expand Down Expand Up @@ -73,4 +74,18 @@ class WalkRepositoryImpl @Inject constructor(private val walkService: WalkServic
routeImage = routeImagePart,
)
}.convert {}

override suspend fun midRunUpdate(
runId: Int,
runTime: Int,
runDistance: Double,
): DomainResult<Unit> = handleResult {
walkService.requestMidRunUpdate(
MidRunUpdateRequest(
runId = runId,
runTime = runTime,
runDistance = runDistance
)
)
}.convert {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package com.combo.runcombi.auth.usecase
import com.combo.runcombi.auth.repository.AuthRepository
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.runBlocking
import javax.inject.Inject

class GetIsNewUserUseCase @Inject constructor(
class GetAccessTokenUseCase @Inject constructor(
private val authRepository: AuthRepository,
) {

operator fun invoke(): Boolean = runBlocking(Dispatchers.IO) {
authRepository.getAccessToken().first() == null
operator fun invoke(): String? = runBlocking(Dispatchers.IO) {
authRepository.getAccessToken().firstOrNull()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@ interface WalkRepository {
routeImage: File?,
): DomainResult<Unit>

suspend fun midRunUpdate(
runId: Int,
runTime: Int,
runDistance: Double,
): DomainResult<Unit>

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.combo.runcombi.walk.usecase

import com.combo.runcombi.common.DomainResult
import com.combo.runcombi.walk.repository.WalkRepository
import javax.inject.Inject

class MidRunUpdateUseCase @Inject constructor(
private val walkRepository: WalkRepository
) {
suspend operator fun invoke(
runId: Int,
runTime: Int,
runDistance: Double,
): DomainResult<Unit> {
return walkRepository.midRunUpdate(runId, runTime, runDistance)
}
}
3 changes: 2 additions & 1 deletion core/network/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ dependencies {
implementation(libs.bundles.network)
implementation(libs.kotlin.serialization.json)
implementation(libs.bundles.coroutines)
implementation(libs.play.services.wearable)

ksp(libs.hilt.compiler)
implementation(libs.hilt.android)
}

fun getBaseUrl(): String {
return gradleLocalProperties(rootDir, providers).getProperty("BASE_URL") ?: ""
return gradleLocalProperties(rootDir, providers).getProperty("BASE_URL") ?: "http://api.runcombi.site/"
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,20 @@ class TokenInterceptor @Inject constructor(
) : Interceptor {

override fun intercept(chain: Interceptor.Chain): Response {
android.util.Log.d("TokenInterceptor", "API 요청 시작: ${chain.request().url}")

val newRequest = chain.request().newBuilder().apply {
runBlocking {
val token = tokenProvider.getAccessToken()
android.util.Log.d("TokenInterceptor", "토큰 확인: ${token?.take(20)}...")
token?.let {
addHeader("Authorization", "Bearer $it")
android.util.Log.d("TokenInterceptor", "Authorization 헤더 추가됨")
}
}
}

android.util.Log.d("TokenInterceptor", "실제 API 호출 시작")
val response = chain.proceed(newRequest.build())

when (response.code) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.combo.runcombi.network.model.request

import kotlinx.serialization.Serializable

@Serializable
data class MidRunUpdateRequest(
val runId: Int,
val runTime: Int,
val runDistance: Double
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.combo.runcombi.network.service

import com.combo.runcombi.network.model.request.KakaoLoginRequest
import com.combo.runcombi.network.model.request.MidRunUpdateRequest
import com.combo.runcombi.network.model.request.StartRunRequest
import com.combo.runcombi.network.model.response.DefaultResponse
import com.combo.runcombi.network.model.response.LoginResponse
Expand Down Expand Up @@ -28,4 +29,9 @@ interface WalkService {
@Part("petRunData") petRunData: RequestBody,
@Part routeImage: MultipartBody.Part?,
): Response<DefaultResponse>

@POST("api/run/midRunUpdate")
suspend fun requestMidRunUpdate(
@Body request: MidRunUpdateRequest,
): Response<DefaultResponse>
}
1 change: 1 addition & 0 deletions core/wear/consumer-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Consumer ProGuard rules for core:wear module
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@file:OptIn(ExperimentalMaterial3Api::class)
@file:OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3Api::class)

package com.combo.runcombi.history.screen

Expand All @@ -17,6 +17,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.ExperimentalMaterial3Api
Expand All @@ -37,6 +38,8 @@ import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
Expand Down Expand Up @@ -280,9 +283,9 @@ fun AddRecordContent(
}
},
value = distanceText,
onValueChange = {
distanceText = it
updateDistance(it)
onValueChange = { newValue ->
distanceText = newValue
updateDistance(newValue)
},
placeholder = "",
trailingText = "km",
Expand All @@ -291,6 +294,10 @@ fun AddRecordContent(
singleLine = true,
leadingText = "거리",
textAlign = TextAlign.End,
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Decimal,
imeAction = ImeAction.Next
),
)
Spacer(Modifier.width(12.dp))
RunCombiTextField(
Expand All @@ -309,9 +316,9 @@ fun AddRecordContent(
}
},
value = timeText,
onValueChange = {
timeText = it
updateTime(it)
onValueChange = { newValue ->
timeText = newValue
updateTime(newValue)
},
placeholder = "",
trailingText = "min",
Expand All @@ -320,6 +327,10 @@ fun AddRecordContent(
singleLine = true,
leadingText = "시간",
textAlign = TextAlign.End,
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Number,
imeAction = ImeAction.Done
),
)
}
Spacer(Modifier.height(24.dp))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.ExperimentalMaterial3Api
Expand All @@ -35,6 +36,8 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
Expand Down Expand Up @@ -246,9 +249,9 @@ fun EditRecordContent(
}
},
value = distanceText,
onValueChange = {
distanceText = it
updateDistance(it)
onValueChange = { newValue ->
distanceText = newValue
updateDistance(newValue)
},
placeholder = "",
trailingText = "km",
Expand All @@ -257,6 +260,10 @@ fun EditRecordContent(
singleLine = true,
leadingText = "거리",
textAlign = TextAlign.End,
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Decimal,
imeAction = ImeAction.Next
),
)
Spacer(Modifier.width(12.dp))
RunCombiTextField(
Expand All @@ -275,9 +282,9 @@ fun EditRecordContent(
}
},
value = timeText,
onValueChange = {
timeText = it
updateTime(it)
onValueChange = { newValue ->
timeText = newValue
updateTime(newValue)
},
placeholder = "",
trailingText = "min",
Expand All @@ -286,6 +293,10 @@ fun EditRecordContent(
singleLine = true,
leadingText = "시간",
textAlign = TextAlign.End,
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Number,
imeAction = ImeAction.Done
),
)
}
Spacer(Modifier.height(24.dp))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ fun RecordContent(
RecordImagePager(imagePaths = uiState.imagePaths, onAddPhoto = onAddPhoto)
RecordAppBar(
date = uiState.date,
hasRunImage = uiState.imagePaths.size == 2,
hasRunImage = uiState.imagePaths.isNotEmpty(),
onBack = onBack,
onEdit = onEdit,
onAddPhoto = onAddPhoto,
Expand Down
4 changes: 4 additions & 0 deletions feature/main/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ android {
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.bundles.lifecycle)
implementation(libs.play.services.wearable)

testImplementation(libs.bundles.test)
androidTestImplementation(libs.bundles.android.test)

implementation(libs.androidx.core.splashscreen)

// Wear OS - 비활성화
// implementation(libs.play.services.wearable)

implementation(project(":feature:login"))
implementation(project(":feature:signup"))
implementation(project(":feature:history"))
Expand Down
Loading
Loading