Skip to content
Closed
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
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

<data
android:scheme="https"
android:host="keepiluv.jiyong.xyz"
android:host="keepiluv.teamtwix.com"
android:pathPrefix="/invite" />
</intent-filter>
</activity>
Expand Down
2 changes: 1 addition & 1 deletion core/design-system/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
<string name="onboarding_couple_connection_fail">커플 연결 요청에 실패했어요</string>
<string name="toast_self_invite_code">자신의 초대 코드는 사용할 수 없어요</string>

<string name="onboarding_invite_share_message">[키피럽 함께 시작해요]\n함께 시작하고 일상 속 시너지를!\n\n1. \'키피럽\'을 설치해 주세요.\n%3$s\n\n2. 회원가입을 해 주세요.\n\n3. 아래 링크를 통해 연결하거나, 연결 코드를 메이트와 공유하세요!\n\n연결 코드: %1$s\n%2$s</string>
<string name="onboarding_invite_share_message">[키피럽 함께 시작해요]\n함께 시작하고 일상 속 시너지를!\n\n1. \'키피럽\'을 설치해 주세요.\n\n2. 회원가입을 해 주세요.\n\n3. 아래 링크를 통해 연결하거나, 연결 코드를 메이트와 공유하세요!\n\n연결 코드: %1$s\n%2$s</string>

<string name="onboarding_invite_code_plz_write_invite_code">짝꿍에게 받은\n초대 코드를 써주세요</string>
<string name="onboarding_invite_code_my_invite_code">내 초대 코드</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class InviteLaunchDispatcher : InviteLaunchEventSource {
private const val INVITE_SCHEME = "twix"
private const val INVITE_HOST = "invite"
private const val INVITE_CODE_PARAM = "code"
private const val INVITE_WEB_HOST = "keepiluv.jiyong.xyz"
private const val INVITE_WEB_HOST = "keepiluv.teamtwix.com"
private const val HTTP_SCHEME = "http"
private const val HTTPS_SCHEME = "https"

Expand Down
19 changes: 19 additions & 0 deletions core/ui/src/main/java/com/twix/ui/base/BaseViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,25 @@ abstract class BaseViewModel<S : State, I : Intent, SE : SideEffect>(
reduceLoadableState { copyState(error = error) }
}

/**
* AppResult를 loading/error 상태 변경 없이 처리한다.
*
* best effort 요청처럼 DefaultLoadableState를 변경하지 않아야 하는 경우 사용한다.
*/
protected suspend fun <D> handleResultWithoutLoadableStateUpdate(
result: AppResult<D>,
onSuccess: (D) -> Unit = {},
onError: (suspend (AppError) -> Unit)? = null,
) {
when (result) {
is AppResult.Success -> onSuccess(result.data)
is AppResult.Error -> {
handleError(result.error)
onError?.invoke(result.error)
}
}
}

/**
* API 결과 처리
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import com.twix.notification.contract.NotificationSideEffect
import com.twix.notification.contract.NotificationUiState
import com.twix.notification.deeplink.NotificationDeepLink
import com.twix.notification.deeplink.NotificationDeepLinkParser
import com.twix.result.AppResult
import com.twix.ui.base.BaseViewModel
import kotlinx.coroutines.launch

Expand Down Expand Up @@ -77,10 +76,7 @@ class NotificationViewModel(

private fun markAllNotificationAsRead() {
viewModelScope.launch {
when (val result = notificationRepository.markAllNotificationsAsRead()) {
is AppResult.Success -> Unit
is AppResult.Error -> handleError(result.error)
}
handleResultWithoutLoadableStateUpdate(notificationRepository.markAllNotificationsAsRead())
}
}

Expand All @@ -106,7 +102,7 @@ class NotificationViewModel(
}

// 알림 읽음 처리는 best effort가 정책이므로 에러 처리는 생략
private fun markNotificationAsRead(notification: Notification) {
private suspend fun markNotificationAsRead(notification: Notification) {
reduce {
copy(
notificationList =
Expand All @@ -116,11 +112,6 @@ class NotificationViewModel(
)
}

viewModelScope.launch {
when (val result = notificationRepository.markNotificationAsRead(notification.id)) {
is AppResult.Success -> Unit
is AppResult.Error -> handleError(result.error)
}
}
handleResultWithoutLoadableStateUpdate(notificationRepository.markNotificationAsRead(notification.id))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data class NotificationUiState(
val notificationList: List<Notification> = emptyList(),
val hasNext: Boolean = true,
override val hasLoadedContent: Boolean = false,
override val isLoading: Boolean = true,
override val isLoading: Boolean = false,
override val error: AppError? = null,
) : ContentLoadableState {
val canLoadNextPage: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import com.twix.designsystem.theme.CommonColor
import com.twix.designsystem.theme.GrayColor
import com.twix.designsystem.theme.TwixTheme
import com.twix.domain.model.enums.AppTextStyle
import com.twix.navigation_contract.Constants
import com.twix.onboarding.OnBoardingViewModel
import com.twix.onboarding.contract.OnBoardingIntent
import com.twix.onboarding.contract.OnBoardingSideEffect
Expand Down Expand Up @@ -94,7 +93,6 @@ fun CoupleConnectRoute(
R.string.onboarding_invite_share_message,
sideEffect.inviteCode,
deepLink,
Constants.PLAY_STORE_URL,
)
val sendIntent =
Intent(Intent.ACTION_SEND).apply {
Expand Down
Loading