-
Notifications
You must be signed in to change notification settings - Fork 9
[FIX/#1591] 앱잼탬프 QA 사항 반영 #1598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a8f3588
[FIX/#1591] 앱잼 뒤로가기 버튼 클릭 처리 개선
seungjunGong a1e5e24
[FIX/#1591] 미션 제출 후 상세 화면 자동 복귀
seungjunGong 15468b7
[FEAT/#1591] 미션 상세 완료 버튼 활성화 조건 개선
seungjunGong 9e3753e
[FIX/#1591] 앱잼 현황 시간 표기 QA 반영
seungjunGong e2ba84a
[MOD/#1591] toRelativeTime 확장 함수 유틸화 및 개선
seungjunGong 6e2c7f8
[MOD/#1591] AppjamtampButton 클릭 시 리플 효과 추가
seungjunGong 99a2367
[REFACTOR/#1591] MissionDetailRoute의 미션 완료 후 처리 로직 개선
seungjunGong ecbfd5d
[MOD/#1591] 상대 시간 표시 포맷 및 로직 수정
seungjunGong 90037aa
[MERGE/#1591] pulled develop
seungjunGong 2ab14b9
[FEAT/#1591] RelativeTimeExt 단위 테스트 추가 및 로직 개선
seungjunGong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
63 changes: 63 additions & 0 deletions
63
...ure/appjamtamp/src/main/java/org/sopt/official/feature/appjamtamp/util/RelativeTimeExt.kt
This file contains hidden or 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,63 @@ | ||
| /* | ||
| * MIT License | ||
| * Copyright 2025-2026 SOPT - Shout Our Passion Together | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal | ||
| * in the Software without restriction, including without limitation the rights | ||
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| * copies of the Software, and to permit persons to whom the Software is | ||
| * furnished to do so, subject to the following conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be included in all | ||
| * copies or substantial portions of the Software. | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| * SOFTWARE. | ||
| */ | ||
| package org.sopt.official.feature.appjamtamp.util | ||
|
|
||
| import java.time.LocalDateTime | ||
| import java.time.ZoneId | ||
| import java.time.ZonedDateTime | ||
| import java.time.format.DateTimeFormatter | ||
| import java.util.Locale | ||
| import java.util.concurrent.TimeUnit | ||
|
|
||
| private val seoulZoneId: ZoneId = ZoneId.of("Asia/Seoul") | ||
| private val monthDayFormatter: DateTimeFormatter = | ||
| DateTimeFormatter.ofPattern("M월 d일", Locale.KOREA) | ||
|
|
||
| fun String?.toRelativeTime( | ||
| currentDateTime: ZonedDateTime = ZonedDateTime.now(seoulZoneId) | ||
| ): String { | ||
| if (this.isNullOrBlank()) return "" | ||
|
|
||
| val dateTime = runCatching { | ||
| LocalDateTime.parse(this).atZone(seoulZoneId) | ||
| }.getOrNull() ?: return "" | ||
|
|
||
| val diffMillis = currentDateTime.toInstant().toEpochMilli() - dateTime.toInstant().toEpochMilli() | ||
|
|
||
| if (diffMillis < 0) return "방금 전" | ||
|
|
||
| val minutes = TimeUnit.MILLISECONDS.toMinutes(diffMillis) | ||
| val hours = TimeUnit.MILLISECONDS.toHours(diffMillis) | ||
| val days = TimeUnit.MILLISECONDS.toDays(diffMillis) | ||
|
|
||
| return when { | ||
| diffMillis < TimeUnit.MINUTES.toMillis(10) -> "방금 전" | ||
| diffMillis < TimeUnit.HOURS.toMillis(1) -> "${minutes}분 전" | ||
| diffMillis < TimeUnit.DAYS.toMillis(1) -> "${hours}시간 전" | ||
| diffMillis < TimeUnit.DAYS.toMillis(7) -> "${days}일 전" | ||
| diffMillis < TimeUnit.DAYS.toMillis(28) -> "${days / 7}주 전" | ||
| else -> dateTime.format(monthDayFormatter) | ||
|
seungjunGong marked this conversation as resolved.
|
||
| } | ||
| } | ||
70 changes: 70 additions & 0 deletions
70
...appjamtamp/src/test/java/org/sopt/official/feature/appjamtamp/util/RelativeTimeExtTest.kt
This file contains hidden or 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,70 @@ | ||
| /* | ||
| * MIT License | ||
| * Copyright 2026 SOPT - Shout Our Passion Together | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal | ||
| * in the Software without restriction, including without limitation the rights | ||
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| * copies of the Software, and to permit persons to whom the Software is | ||
| * furnished to do so, subject to the following conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be included in all | ||
| * copies or substantial portions of the Software. | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| * SOFTWARE. | ||
| */ | ||
| package org.sopt.official.feature.appjamtamp.util | ||
|
|
||
| import com.google.common.truth.Truth.assertThat | ||
| import java.time.ZoneId | ||
| import java.time.ZonedDateTime | ||
| import org.junit.jupiter.api.DisplayName | ||
| import org.junit.jupiter.params.ParameterizedTest | ||
| import org.junit.jupiter.params.provider.Arguments | ||
| import org.junit.jupiter.params.provider.MethodSource | ||
|
|
||
| class RelativeTimeExtTest { | ||
|
|
||
| @ParameterizedTest | ||
| @MethodSource("relativeTimeCases") | ||
| @DisplayName("createdAt 문자열을 상대 시간 문구로 변환한다") | ||
| fun toRelativeTime(description: String, createdAt: String?, expected: String) { | ||
| // when | ||
| val actual = createdAt.toRelativeTime(currentDateTime = fixedNow) | ||
|
|
||
| // then | ||
| assertThat(actual).isEqualTo(expected) | ||
| } | ||
|
|
||
| companion object { | ||
| private val fixedNow: ZonedDateTime = | ||
| ZonedDateTime.of(2026, 6, 3, 12, 0, 0, 0, ZoneId.of("Asia/Seoul")) | ||
|
|
||
| @JvmStatic | ||
| fun relativeTimeCases() = listOf( | ||
| Arguments.of("null 입력은 빈 문자열을 반환한다", null, ""), | ||
| Arguments.of("blank 입력은 빈 문자열을 반환한다", "", ""), | ||
| Arguments.of("파싱 불가능한 입력은 빈 문자열을 반환한다", "invalid", ""), | ||
| Arguments.of("미래 시각은 방금 전으로 표시한다", "2026-06-03T12:01:00", "방금 전"), | ||
| Arguments.of("10분 미만은 방금 전으로 표시한다", "2026-06-03T11:50:01", "방금 전"), | ||
| Arguments.of("10분 경계는 분 전으로 표시한다", "2026-06-03T11:50:00", "10분 전"), | ||
| Arguments.of("1시간 미만은 분 전으로 표시한다", "2026-06-03T11:01:00", "59분 전"), | ||
| Arguments.of("1시간 경계는 시간 전으로 표시한다", "2026-06-03T11:00:00", "1시간 전"), | ||
| Arguments.of("24시간 미만은 시간 전으로 표시한다", "2026-06-02T12:01:00", "23시간 전"), | ||
| Arguments.of("24시간 경계는 일 전으로 표시한다", "2026-06-02T12:00:00", "1일 전"), | ||
| Arguments.of("7일 미만은 일 전으로 표시한다", "2026-05-27T12:00:01", "6일 전"), | ||
| Arguments.of("7일 경계는 주 전으로 표시한다", "2026-05-27T12:00:00", "1주 전"), | ||
| Arguments.of("28일 미만은 주 전으로 표시한다", "2026-05-06T12:00:01", "3주 전"), | ||
| Arguments.of("28일 경계는 월일 포맷으로 표시한다", "2026-05-06T12:00:00", "5월 6일"), | ||
| ) | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.