-
Notifications
You must be signed in to change notification settings - Fork 0
[TNT-273] DisplayText 정의 및 적용 #138
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
9 commits
Select commit
Hold shift + click to select a range
dd556cc
[TNT-273] feat: DisplayText 정의
hoyahozz 5973c79
[TNT-273] refactor: 트레이너 홈 화면 내 단순 문자열 제거
hoyahozz 0dc616c
[TNT-273] refactor: core 모듈 내 문자열 리소스 접두사 추가 및 일괄 import 처리
hoyahozz 192ede6
[TNT-273] refactor: ViewModel 내 DisplayText 일괄 적용
hoyahozz c33322e
[TNT-273] refactor: 문자열 리소스 일괄 적용
hoyahozz fff74e8
[TNT-273] Merge branch 'develop' into refactor/TNT-273
hoyahozz e297a9b
[TNT-273] fix: Merge conflict
hoyahozz 97d020e
[TNT-273] fix: 단일 모듈 내에서 사용되던 공통 문자열 리소스 제거
hoyahozz bbdb9ba
[TNT-273] Merge branch 'develop' into refactor/TNT-273
hoyahozz 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
36 changes: 36 additions & 0 deletions
36
core/ui/src/main/java/co/kr/tnt/ui/resource/DisplayText.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,36 @@ | ||
| package co.kr.tnt.ui.resource | ||
|
|
||
| import android.content.Context | ||
| import androidx.annotation.StringRes | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.res.stringResource | ||
|
|
||
| sealed interface DisplayText { | ||
| fun asString(context: Context): String | ||
|
|
||
| @JvmInline | ||
| value class Plain( | ||
| val value: String, | ||
| ) : DisplayText { | ||
| override fun asString(context: Context): String = value | ||
| } | ||
|
|
||
| class Resource( | ||
| @StringRes val resId: Int, | ||
| vararg val args: Any, | ||
| ) : DisplayText { | ||
| override fun asString(context: Context): String = context.getString(resId, *args) | ||
| } | ||
|
|
||
| @Composable | ||
| fun asString(): String { | ||
| return when (this) { | ||
| is Plain -> value | ||
| is Resource -> stringResource(resId, *args) | ||
| } | ||
| } | ||
|
|
||
| companion object { | ||
| val EMPTY = Plain("") | ||
| } | ||
| } |
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 |
|---|---|---|
| @@ -1,78 +1,84 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <resources> | ||
| <string name="session_expired">세션이 만료되었어요</string> | ||
| <string name="session_expired_description">장시간 미사용으로 로그인 화면으로 이동해요</string> | ||
| <string name="core_failed_to_server_request">서버 요청에 실패했어요</string> | ||
|
|
||
| <string name="core_session_expired">세션이 만료되었어요</string> | ||
| <string name="core_session_expired_description">장시간 미사용으로 로그인 화면으로 이동해요</string> | ||
|
|
||
| <string name="alarm_permission_title">TnT에서 알림을 보내고자 합니다.</string> | ||
| <string name="alarm_permission_description">해당 기기로 수업 일정 등 서비스 이용에 도움이 되는 안내 사항을 푸시 알림으로 보내드리겠습니다. | ||
| <string name="core_alarm_permission_title">TnT에서 알림을 보내고자 합니다.</string> | ||
| <string name="core_alarm_permission_description">해당 기기로 수업 일정 등 서비스 이용에 도움이 되는 안내 사항을 푸시 알림으로 보내드리겠습니다. | ||
| \n앱 푸시 알림에 수신 동의 하시겠습니까?</string> | ||
|
|
||
| <string name="alarm_permission_permanently_title">TnT에서 알림 권한이 필요합니다.</string> | ||
| <string name="alarm_permission_permanently_description">수업 일정 및 중요한 공지 알림을 받기 위해 알림 권한이 필요합니다.\n설정에서 알림 권한을 활성화해주세요.</string> | ||
| <string name="core_alarm_permission_permanently_title">TnT에서 알림 권한이 필요합니다.</string> | ||
| <string name="core_alarm_permission_permanently_description">수업 일정 및 중요한 공지 알림을 받기 위해 알림 권한이 필요합니다.\n설정에서 알림 권한을 활성화해주세요.</string> | ||
|
|
||
| <string name="core_media_permission_title">프로필 사진 설정을 위해 사진 접근 권한이 필요해요</string> | ||
| <string name="core_media_permission_description">사진 추가는 프로필 말고도 운동과 식단 기록에도 사용돼요</string> | ||
|
|
||
| <string name="media_permission_title">프로필 사진 설정을 위해 사진 접근 권한이 필요해요</string> | ||
| <string name="media_permission_description">사진 추가는 프로필 말고도 운동과 식단 기록에도 사용돼요</string> | ||
| <string name="core_media_permission_permanently_title">프로필 사진 설정 권한 명시 거부</string> | ||
| <string name="core_media_permission_permanently_description">권한 설정을 위해 설정창으로 이동해주세요.</string> | ||
|
|
||
| <string name="media_permission_permanently_title">프로필 사진 설정 권한 명시 거부</string> | ||
| <string name="media_permission_permanently_description">권한 설정을 위해 설정창으로 이동해주세요.</string> | ||
| <string name="close">닫기</string> | ||
| <string name="ok">확인</string> | ||
| <string name="move_to_setting">설정으로 이동</string> | ||
| <string name="core_close">닫기</string> | ||
| <string name="core_ok">확인</string> | ||
| <string name="core_move_to_setting">설정으로 이동</string> | ||
|
|
||
| <string name="entered_wrong_text">잘못된 수치를 입력했어요</string> | ||
| <string name="text_length_and_format_warning">%s자 미만의 한글 또는 영문으로 입력해주세요</string> | ||
| <string name="core_entered_wrong_text">잘못된 수치를 입력했어요</string> | ||
| <string name="core_text_length_and_format_warning">%s자 미만의 한글 또는 영문으로 입력해주세요</string> | ||
|
|
||
| <string name="trainee">트레이니</string> | ||
| <string name="trainer">트레이너</string> | ||
| <string name="core_trainee">트레이니</string> | ||
| <string name="core_trainer">트레이너</string> | ||
|
|
||
| <string name="next">다음</string> | ||
| <string name="connect">연결하기</string> | ||
| <string name="start">시작하기</string> | ||
| <string name="skip">건너뛰기</string> | ||
| <string name="cancel">취소</string> | ||
| <string name="next_time">다음에</string> | ||
| <string name="core_next">다음</string> | ||
| <string name="core_connect">연결하기</string> | ||
| <string name="core_start">시작하기</string> | ||
| <string name="core_skip">건너뛰기</string> | ||
| <string name="core_cancel">취소</string> | ||
| <string name="core_next_time">다음에</string> | ||
|
|
||
| <string name="name">이름</string> | ||
| <string name="age_label">나이</string> | ||
| <string name="height_label">키</string> | ||
| <string name="weight_label">체중</string> | ||
| <string name="age_unit">세</string> | ||
| <string name="height_unit">cm</string> | ||
| <string name="weight_unit">kg</string> | ||
| <string name="core_name">이름</string> | ||
| <string name="core_age_label">나이</string> | ||
| <string name="core_height_label">키</string> | ||
| <string name="core_weight_label">체중</string> | ||
| <string name="core_age_unit">세</string> | ||
| <string name="core_height_unit">cm</string> | ||
| <string name="core_weight_unit">kg</string> | ||
|
|
||
| <string name="notification">알림</string> | ||
| <string name="no_recent_notifications">최근 받은 알림이 없어요</string> | ||
| <string name="core_notification">알림</string> | ||
| <string name="core_no_recent_notifications">최근 받은 알림이 없어요</string> | ||
|
|
||
| <!-- Dialog --> | ||
| <string name="do_not_see_for_three_days">3일 동안 보지 않기</string> | ||
| <string name="core_do_not_see_for_three_days">3일 동안 보지 않기</string> | ||
|
|
||
| <!-- Meal --> | ||
| <string name="meal_breakfast">아침</string> | ||
| <string name="meal_lunch">점심</string> | ||
| <string name="meal_dinner">저녁</string> | ||
| <string name="meal_snack">간식</string> | ||
| <string name="core_meal_breakfast">아침</string> | ||
| <string name="core_meal_lunch">점심</string> | ||
| <string name="core_meal_dinner">저녁</string> | ||
| <string name="core_meal_snack">간식</string> | ||
|
|
||
| <!-- Exercise --> | ||
| <string name="exercise_upper_body">상체 운동</string> | ||
| <string name="exercise_lower_body">하체 운동</string> | ||
| <string name="exercise_back">등 운동</string> | ||
| <string name="exercise_shoulder">어깨 운동</string> | ||
| <string name="exercise_cardio">유산소</string> | ||
| <string name="core_exercise_upper_body">상체 운동</string> | ||
| <string name="core_exercise_lower_body">하체 운동</string> | ||
| <string name="core_exercise_back">등 운동</string> | ||
| <string name="core_exercise_shoulder">어깨 운동</string> | ||
| <string name="core_exercise_cardio">유산소</string> | ||
|
|
||
| <!-- PT Session --> | ||
| <string name="pt_session">%d회차 수업</string> | ||
| <string name="core_pt_session">%d회차 수업</string> | ||
|
|
||
| <!-- MyPage --> | ||
| <string name="modifying_personal_info">개인정보 수정</string> | ||
| <string name="app_push_notification">앱 푸시 알림</string> | ||
| <string name="terms_of_service">서비스 이용약관</string> | ||
| <string name="privacy_policy">개인정보 처리방침</string> | ||
| <string name="app_version">버전 정보</string> | ||
| <string name="open_source_license">오픈소스 라이선스</string> | ||
| <string name="logout">로그아웃</string> | ||
| <string name="delete_account">계정 탈퇴</string> | ||
|
|
||
| <string name="logout_title">현재 계정을 로그아웃 할까요?</string> | ||
| <string name="logout_content">언제든지 다시 로그인 할 수 있어요!</string> | ||
| <string name="logout_complete_title">로그아웃이 완료되었어요</string> | ||
| <string name="core_modifying_personal_info">개인정보 수정</string> | ||
| <string name="core_app_push_notification">앱 푸시 알림</string> | ||
| <string name="core_terms_of_service">서비스 이용약관</string> | ||
| <string name="core_privacy_policy">개인정보 처리방침</string> | ||
| <string name="core_app_version">버전 정보</string> | ||
| <string name="core_open_source_license">오픈소스 라이선스</string> | ||
| <string name="core_logout">로그아웃</string> | ||
| <string name="core_delete_account">계정 탈퇴</string> | ||
|
|
||
| <string name="core_logout_title">현재 계정을 로그아웃 할까요?</string> | ||
| <string name="core_logout_content">언제든지 다시 로그인 할 수 있어요!</string> | ||
| <string name="core_logout_complete_title">로그아웃이 완료되었어요</string> | ||
|
|
||
| <string name="core_length_warning">%d자 미만으로 입력해주세요.</string> | ||
| <string name="core_no_records_yet">아직 등록된 기록이 없어요</string> | ||
| </resources> |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,17 @@ | ||
| package co.kr.tnt.login | ||
|
|
||
| import androidx.lifecycle.viewModelScope | ||
| import co.kr.tnt.core.ui.R.string.core_failed_to_server_request | ||
| import co.kr.tnt.domain.model.AuthType | ||
| import co.kr.tnt.domain.model.LoginResult | ||
| import co.kr.tnt.domain.repository.LoginRepository | ||
| import co.kr.tnt.feature.login.R | ||
| import co.kr.tnt.login.LoginContract.LoginSideEffect | ||
| import co.kr.tnt.login.LoginContract.LoginUiEvent | ||
| import co.kr.tnt.login.LoginContract.LoginUiState | ||
| import co.kr.tnt.login.model.TermState | ||
| import co.kr.tnt.ui.base.BaseViewModel | ||
| import co.kr.tnt.ui.resource.DisplayText | ||
| import dagger.hilt.android.lifecycle.HiltViewModel | ||
| import kotlinx.coroutines.launch | ||
| import javax.inject.Inject | ||
|
|
@@ -28,7 +31,11 @@ internal class LoginViewModel @Inject constructor( | |
|
|
||
| is LoginUiEvent.OnAuthFail -> { | ||
| if (event.throwable !is LoginException.CancelException) { | ||
| sendEffect(LoginSideEffect.ShowToast("로그인에 실패하였습니다. 다시 시도해주세요.")) | ||
| sendEffect( | ||
| LoginSideEffect.ShowToast( | ||
| DisplayText.Resource(R.string.failed_login_try_again), | ||
| ), | ||
| ) | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -67,8 +74,11 @@ internal class LoginViewModel @Inject constructor( | |
| clearAllChecks() | ||
| sendEffect(LoginSideEffect.ShowTermBottomSheet) | ||
| }.onFailure { | ||
| // TODO resource | ||
| sendEffect(LoginSideEffect.ShowToast("알 수 없는 오류가 발생했습니다. 다시 시도해주세요.")) | ||
| sendEffect( | ||
| LoginSideEffect.ShowToast( | ||
| DisplayText.Resource(core_failed_to_server_request), | ||
| ), | ||
| ) | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -106,7 +116,11 @@ internal class LoginViewModel @Inject constructor( | |
| sendEffect(LoginSideEffect.NavigateToSignup(loginResult, messagingToken)) | ||
| [email protected] = null | ||
| } ?: run { | ||
| sendEffect(LoginSideEffect.ShowToast("로그인에 실패하였습니다. 다시 시도해주세요.")) | ||
| sendEffect( | ||
| LoginSideEffect.ShowToast( | ||
| DisplayText.Resource(R.string.failed_login_try_again), | ||
| ), | ||
| ) | ||
| } | ||
| } | ||
| } | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
왁.. 진짜 고생하셨습니다🥹