Skip to content

Commit

Permalink
Merge pull request #106 from THT-Team/develop
Browse files Browse the repository at this point in the history
QA: Location Patch Fail Debug 버전
  • Loading branch information
cwj-c authored Sep 18, 2023
2 parents b14b6c3 + e1b87c9 commit 3bb083f
Show file tree
Hide file tree
Showing 25 changed files with 549 additions and 236 deletions.
26 changes: 25 additions & 1 deletion .github/workflows/android_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,19 @@ jobs:
echo -e KAKAO_NATIVE_APP_KEY=\"$KAKAO_NATIVE_APP_KEY\" >> ./local.properties
echo -e NAVER_CLIENT_ID=\"$NAVER_CLIENT_ID\" >> ./local.properties
echo -e NAVER_CLIENT_SECRET=\"$NAVER_CLIENT_SECRET\" >> ./local.properties
echo -e REGION_CODE_SERVICE_KEY=\"REGION_CODE_SERVICE_KEY\" >> ./local.properties
echo -e APP_EMAIL_ID=\"APP_EMAIL_ID\" >> ./local.properties
echo -e APP_EMAIL_PASSWORD=\"APP_EMAIL_PASSWORD\" >> ./local.properties
echo -e CEO_EMAIL=\"CEO_EMAIL\" >> ./local.properties
cat ./local.properties
env:
KAKAO_NATIVE_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }}
NAVER_CLIENT_SECRET: ${{ secrets.NAVER_CLIENT_SECRET }}
NAVER_CLIENT_ID: ${{ secrets.NAVER_CLIENT_ID }}
REGION_CODE_SERVICE_KEY: ${{ secrets.REGION_CODE_SERVICE_KEY }}
APP_EMAIL_ID: ${{ secrets.APP_EMAIL_ID }}
APP_EMAIL_PASSWORD: ${{ secrets.APP_EMAIL_PASSWORD }}
CEO_EMAIL: ${{ secrets.CEO_EMAIL }}

- name: Build with Gradle Without Test
run: ./gradlew build -x test
Expand Down Expand Up @@ -77,11 +85,19 @@ jobs:
echo -e KAKAO_NATIVE_APP_KEY=\"$KAKAO_NATIVE_APP_KEY\" >> ./local.properties
echo -e NAVER_CLIENT_ID=\"$NAVER_CLIENT_ID\" >> ./local.properties
echo -e NAVER_CLIENT_SECRET=\"$NAVER_CLIENT_SECRET\" >> ./local.properties
echo -e REGION_CODE_SERVICE_KEY=\"REGION_CODE_SERVICE_KEY\" >> ./local.properties
echo -e APP_EMAIL_ID=\"APP_EMAIL_ID\" >> ./local.properties
echo -e APP_EMAIL_PASSWORD=\"APP_EMAIL_PASSWORD\" >> ./local.properties
echo -e CEO_EMAIL=\"CEO_EMAIL\" >> ./local.properties
cat ./local.properties
env:
KAKAO_NATIVE_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }}
NAVER_CLIENT_SECRET: ${{ secrets.NAVER_CLIENT_SECRET }}
NAVER_CLIENT_ID: ${{ secrets.NAVER_CLIENT_ID }}
REGION_CODE_SERVICE_KEY: ${{ secrets.REGION_CODE_SERVICE_KEY }}
APP_EMAIL_ID: ${{ secrets.APP_EMAIL_ID }}
APP_EMAIL_PASSWORD: ${{ secrets.APP_EMAIL_PASSWORD }}
CEO_EMAIL: ${{ secrets.CEO_EMAIL }}

- name: Run unit tests
run: ./gradlew testDebugUnitTest
Expand Down Expand Up @@ -119,11 +135,19 @@ jobs:
echo -e KAKAO_NATIVE_APP_KEY=\"$KAKAO_NATIVE_APP_KEY\" >> ./local.properties
echo -e NAVER_CLIENT_ID=\"$NAVER_CLIENT_ID\" >> ./local.properties
echo -e NAVER_CLIENT_SECRET=\"$NAVER_CLIENT_SECRET\" >> ./local.properties
echo -e REGION_CODE_SERVICE_KEY=\"REGION_CODE_SERVICE_KEY\" >> ./local.properties
echo -e APP_EMAIL_ID=\"APP_EMAIL_ID\" >> ./local.properties
echo -e APP_EMAIL_PASSWORD=\"APP_EMAIL_PASSWORD\" >> ./local.properties
echo -e CEO_EMAIL=\"CEO_EMAIL\" >> ./local.properties
cat ./local.properties
env:
KAKAO_NATIVE_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }}
NAVER_CLIENT_SECRET: ${{ secrets.NAVER_CLIENT_SECRET }}
NAVER_CLIENT_ID: ${{ secrets.NAVER_CLIENT_ID }}
REGION_CODE_SERVICE_KEY: ${{ secrets.REGION_CODE_SERVICE_KEY }}
APP_EMAIL_ID: ${{ secrets.APP_EMAIL_ID }}
APP_EMAIL_PASSWORD: ${{ secrets.APP_EMAIL_PASSWORD }}
CEO_EMAIL: ${{ secrets.CEO_EMAIL }}

- name: Access APP_GOOGLE_SERVICES_JSON
run: echo '${{ secrets.APP_GOOGLE_SERVICES_JSON }}' > ./app/google-services.json
Expand All @@ -149,7 +173,7 @@ jobs:
with:
appId: ${{secrets.FIREBASE_APP_ID}}
serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
groups: android-developer
groups: android-developer, tht-team
file: app/build/outputs/apk/release/app-release-unsigned-signed.apk
releaseNotesFile: app/release_note.md

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.example.compose_ui.extensions

import android.util.Log
import android.view.MotionEvent
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
Expand Down Expand Up @@ -35,7 +34,6 @@ fun Modifier.onDoubleTab(
pointerInteropFilter {
when (it.action) {
MotionEvent.ACTION_UP -> {
Log.d("TAG", "onDoubleTab ACTION_UP")
System.currentTimeMillis().let { now ->
doubleTabTouchTimeMill = if (doubleTabTouchTimeMill != 0L && now - doubleTabTouchTimeMill <= doubleIntervalMill) {
onDoubleTab()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ package com.tht.tht.domain.signup.model

sealed interface SignupException {

data class InvalidateLocationInfo(
override val message: String? = "location data is invalidate"
): SignupException, Exception()

data class SignupUserInvalidateException(
override val message: String? = "signup user data is invalidate"
): SignupException, IllegalArgumentException()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class PatchLocationUseCase(
address: String
): Result<Boolean> {
return kotlin.runCatching {
if (lat < 0.0 || lng < 0.0 || address.isBlank()) {
throw SignupException.InvalidateLocationInfo()
}
withContext(dispatcher) {
val regionCode = fetchRegionCodeUseCase(address).getOrThrow().regionCode
repository.patchSignupUser(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ internal class PatchLocationUseCaseImpl {

@Test
fun `useCase는 FetchRegionCodeUseCase의 invoke()를 호출한다`() = runTest(testDispatcher) {
patchLocationUseCase("phone", 0.0, 0.0, "")
patchLocationUseCase("phone", 10.0, 127.0, "address")
coVerify(exactly = 1) { fetchRegionCodeUseCase(any()) }
}

Expand All @@ -46,7 +46,7 @@ internal class PatchLocationUseCaseImpl {
val unitTestException = Exception("unit test")
coEvery { fetchRegionCodeUseCase(any()) } throws unitTestException

val actual = patchLocationUseCase("phone", 0.0, 0.0, "")
val actual = patchLocationUseCase("phone", 10.0, 127.0, "address")

Assertions.assertThat(actual)
.isInstanceOf(Result::class.java)
Expand All @@ -56,9 +56,21 @@ internal class PatchLocationUseCaseImpl {
.isEqualTo(unitTestException.message)
}

@Test
fun `useCase는 lat, lng, address가 유효하지 않으면 InvalidateLocationInfo를 Result로 래핑해 리턴한다`() = runTest(testDispatcher) {
val actual = patchLocationUseCase("phone", 0.0, 0.0, "")

Assertions.assertThat(actual)
.isInstanceOf(Result::class.java)

Assertions.assertThat(actual.exceptionOrNull())
.isNotNull
.isInstanceOf(SignupException.InvalidateLocationInfo::class.java)
}

@Test
fun `useCase는 repository의 fetchSignupUser를 호출한다`() = runTest(testDispatcher) {
patchLocationUseCase("phone", 0.0, 0.0, "")
patchLocationUseCase("phone", 10.0, 127.0, "address")
coEvery { fetchRegionCodeUseCase(any()) } returns kotlin.runCatching { RegionCodeModel("0") }
coVerify(exactly = 1) { fetchRegionCodeUseCase(any()) }
}
Expand All @@ -69,7 +81,7 @@ internal class PatchLocationUseCaseImpl {
coEvery { fetchRegionCodeUseCase(any()) } returns kotlin.runCatching { RegionCodeModel("0") }
coEvery { repository.fetchSignupUser(any()) } throws unitTestException

val actual = patchLocationUseCase("phone", 0.0, 0.0, "")
val actual = patchLocationUseCase("phone", 10.0, 127.0, "address")

Assertions.assertThat(actual)
.isInstanceOf(Result::class.java)
Expand All @@ -86,7 +98,7 @@ internal class PatchLocationUseCaseImpl {
}
coEvery { repository.fetchSignupUser(any()) } returns null

val actual = patchLocationUseCase("phone", 0.0, 0.0, "")
val actual = patchLocationUseCase("phone", 10.0, 127.0, "address")

Assertions.assertThat(actual)
.isInstanceOf(Result::class.java)
Expand All @@ -100,7 +112,7 @@ internal class PatchLocationUseCaseImpl {
fun `useCase는 fetchSignupUser리턴 값이 유효하면 patchSignupUser를 호출한다`() = runTest(testDispatcher) {
coEvery { fetchRegionCodeUseCase(any()) } returns kotlin.runCatching { RegionCodeModel("0") }
coEvery { repository.fetchSignupUser(any()) } returns SignupUserModel.getFromDefaultArgument()
patchLocationUseCase("phone", 0.0, 0.0, "")
patchLocationUseCase("phone", 10.0, 127.0, "address")
coVerify { repository.patchSignupUser(any(), any()) }
}

Expand All @@ -110,7 +122,7 @@ internal class PatchLocationUseCaseImpl {
coEvery { repository.patchSignupUser(any(), any()) } throws unitTestException
coEvery { repository.fetchSignupUser(any()) } returns SignupUserModel.getFromDefaultArgument()
coEvery { fetchRegionCodeUseCase(any()) } returns kotlin.runCatching { RegionCodeModel("0") }
val actual = patchLocationUseCase("phone", 0.0, 0.0, "")
val actual = patchLocationUseCase("phone", 10.0, 127.0, "address")

Assertions.assertThat(actual)
.isInstanceOf(Result::class.java)
Expand All @@ -126,7 +138,7 @@ internal class PatchLocationUseCaseImpl {
coEvery { repository.patchSignupUser(any(), any()) } returns expect
coEvery { repository.fetchSignupUser(any()) } returns SignupUserModel.getFromDefaultArgument()
coEvery { fetchRegionCodeUseCase(any()) } returns kotlin.runCatching { RegionCodeModel("0") }
val actual = patchLocationUseCase("phone", 0.0, 0.0, "")
val actual = patchLocationUseCase("phone", 10.0, 127.0, "address")

Assertions.assertThat(actual)
.isInstanceOf(Result::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ interface StringProvider {
RegionCodeFetchFail,
SignupFail,
InvalidDate,
EmailSendFail
EmailSendFail,
SignupUserInvalidate
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class StringProviderImpl @Inject constructor(
StringProvider.ResId.SignupFail -> R.string.message_signup_fail
StringProvider.ResId.InvalidDate -> R.string.message_invalidate_date
StringProvider.ResId.EmailSendFail -> R.string.message_email_send_fail
StringProvider.ResId.SignupUserInvalidate -> R.string.signup_user_invalidate
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tht.feature.signin.signup.location

import androidx.lifecycle.viewModelScope
import com.tht.tht.domain.signup.model.LocationModel
import com.tht.tht.domain.signup.model.SignupException
import com.tht.tht.domain.signup.usecase.FetchCurrentLocationUseCase
import com.tht.tht.domain.signup.usecase.FetchLocationByAddressUseCase
import com.tht.tht.domain.signup.usecase.PatchLocationUseCase
Expand Down Expand Up @@ -92,16 +93,6 @@ class LocationViewModel @Inject constructor(

fun nextEvent(phone: String) {
viewModelScope.launch {
fullLocation.value.run {
if (lat < 0.0 || lng < 0.0 || address.isBlank()) {
_sideEffectFlow.emit(
LocationSideEffect.ShowToast(
stringProvider.getString(StringProvider.ResId.InvalidateLocation)
)
)
return@launch
}
}
_dataLoading.value = true
patchLocationUseCase(
phone,
Expand All @@ -113,12 +104,23 @@ class LocationViewModel @Inject constructor(
}.onFailure {
_sideEffectFlow.emit(
LocationSideEffect.ShowToast(
stringProvider.getString(StringProvider.ResId.LocationPatchFail)
when (it) {
is SignupException.InvalidateLocationInfo -> {
stringProvider.getString(StringProvider.ResId.InvalidateLocation)
}

is SignupException.SignupUserInvalidateException -> {
stringProvider.getString(StringProvider.ResId.SignupUserInvalidate) + " $it"
}

else -> {
stringProvider.getString(StringProvider.ResId.LocationPatchFail) + " $it"
}
}
)
)
}.also {
_dataLoading.value = false
}
_dataLoading.value = false
}
}

Expand Down
2 changes: 2 additions & 0 deletions feature/signin/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,6 @@
<string name="message_complete_back"><u>돌아가기</u></string>
<string name="inquiry_complete_dialog">InquiryCompleteDialog</string>

<string name="signup_user_invalidate">회원가입 정보가 존재하지 않습니다</string>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import tht.feature.tohot.R

/**
* 이미 주제어를 선택한 상태로 앱에 접속
* 유저 List가 보여지기 전에 보여지는 EnterCard
*/
@Composable
fun ToHotEnterCard(
modifier: Modifier = Modifier,
Expand All @@ -17,7 +21,7 @@ fun ToHotEnterCard(
image = painterResource(id = R.drawable.ic_mudy_enter),
title = stringResource(id = R.string.to_hot_enter_card_title),
description = stringResource(id = R.string.to_hot_enter_card_description),
buttonText = stringResource(id = R.string.waiting),
buttonText = stringResource(id = R.string.entering),
onClick = onClick
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package tht.feature.tohot.component.card

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import tht.feature.tohot.R

/**
* 처음 주제어를 선택 시 유저가 없는 경우
* - 기다리는 무디 조회 버튼
*/
@Composable
fun ToHotNoneInitialUserCard(
modifier: Modifier = Modifier,
onClick: () -> Unit = { }
) {
ToHotNotifyCard(
modifier = modifier,
image = painterResource(id = R.drawable.ic_mudy_none_initial_user),
title = stringResource(id = R.string.to_hot_none_initial_user_card_title),
description = stringResource(id = R.string.to_hot_none_initial_user_card_description),
buttonText = stringResource(id = R.string.waiting),
onClick = onClick
)
}

@Composable
@Preview
private fun ToHotNoneInitialUserCardPreview() {
ToHotNoneInitialUserCard()
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,27 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import tht.feature.tohot.R

/**
* 주제어에 더 이상 유저가 없는 경우
* - 기다리는 무디 조회 버튼
*/
@Composable
fun ToHotEmptyCard(
fun ToHotNoneNextUserCard(
modifier: Modifier = Modifier,
onClick: () -> Unit = { }
) {
ToHotNotifyCard(
modifier = modifier,
image = painterResource(id = R.drawable.ic_mudy_empty),
title = stringResource(id = R.string.to_hot_empty_card_title),
description = stringResource(id = R.string.to_hot_empty_card_description),
image = painterResource(id = R.drawable.ic_mudy_none_next),
title = stringResource(id = R.string.to_hot_none_next_user_card_title),
description = stringResource(id = R.string.to_hot_none_next_user_card_description),
buttonText = stringResource(id = R.string.waiting),
onClick = onClick
)
}

@Composable
@Preview
private fun ToHotEmptyCardPreview() {
ToHotEmptyCard()
private fun ToHotNoneNextUserCardPreview() {
ToHotNoneNextUserCard()
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fun ToHotNotifyCard(
@Preview
private fun ToHotNotifyCardPreview() {
ToHotNotifyCard(
image = painterResource(id = R.drawable.ic_mudy_enter),
image = painterResource(id = R.drawable.ic_mudy_none_initial_user),
title = "가나다라마바사",
description = "preview",
buttonText = "테스트"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package tht.feature.tohot.component.card

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import tht.feature.tohot.R

@Composable
fun ToHotQuerySuccessCard(
modifier: Modifier = Modifier,
onClick: () -> Unit = { }
) {
ToHotNotifyCard(
modifier = modifier,
image = painterResource(id = R.drawable.ic_mudy_query_success),
title = stringResource(id = R.string.to_hot_query_success_card_title),
description = stringResource(id = R.string.to_hot_query_success_card_description),
buttonText = stringResource(id = R.string.starting),
onClick = onClick
)
}

@Composable
@Preview
private fun ToHotQuerySuccessCardPreview() {
ToHotQuerySuccessCard()
}
Loading

0 comments on commit 3bb083f

Please sign in to comment.