Skip to content

Commit

Permalink
refactor: @StringRes 어노테이션 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
p-chanmin committed Dec 11, 2023
1 parent 83f861d commit c8791dd
Show file tree
Hide file tree
Showing 19 changed files with 53 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package com.teameetmeet.meetmeet.presentation.addevent

import androidx.annotation.StringRes

sealed class AddEventUiEvent {
data class ShowMessage(val messageId: Int, val extraMessage: String = "") : AddEventUiEvent()
data class ShowMessage(@StringRes val messageId: Int, val extraMessage: String = "") :
AddEventUiEvent()

data object FinishAddEventActivity : AddEventUiEvent()
data object NavigateToLoginActivity : AddEventUiEvent()
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package com.teameetmeet.meetmeet.presentation.follow

import androidx.annotation.StringRes

sealed class FollowUiEvent {
data class ShowMessage(val message: Int, val extraMessage: String = "") : FollowUiEvent()
data class ShowMessage(@StringRes val message: Int, val extraMessage: String = "") :
FollowUiEvent()

data class VisitProfile(val userId: Int, val userNickname: String) : FollowUiEvent()
data object NavigateToLoginActivity : FollowUiEvent()
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.teameetmeet.meetmeet.presentation.follow

import androidx.annotation.StringRes
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.teameetmeet.meetmeet.R
Expand Down Expand Up @@ -221,7 +222,7 @@ class FollowViewModel @Inject constructor(
println("${user.nickname}님을 그룹 $id 에 초대")
}

private suspend fun emitExceptionEvent(e: Throwable, message: Int) {
private suspend fun emitExceptionEvent(e: Throwable, @StringRes message: Int) {
when (e) {
is ExpiredRefreshTokenException -> {
_event.emit(FollowUiEvent.ShowMessage(R.string.common_message_expired_login))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.teameetmeet.meetmeet.presentation.login.selflogin

import androidx.annotation.StringRes

sealed class SelfLoginUiEvent {
data object NavigateToHomeActivity : SelfLoginUiEvent()
data class ShowMessage(val message: Int, val extraMessage: String = "") : SelfLoginUiEvent()
data class ShowMessage(@StringRes val message: Int, val extraMessage: String = "") :
SelfLoginUiEvent()
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.teameetmeet.meetmeet.presentation.login.selflogin

import androidx.annotation.StringRes
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.teameetmeet.meetmeet.R
Expand Down Expand Up @@ -62,7 +63,7 @@ class SelfLoginViewModel @Inject constructor(
}
}

private suspend fun emitExceptionEvent(e: Throwable, message: Int) {
private suspend fun emitExceptionEvent(e: Throwable, @StringRes message: Int) {
when (e) {
is UnknownHostException -> {
_event.emit(SelfLoginUiEvent.ShowMessage(R.string.common_message_no_internet))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.teameetmeet.meetmeet.presentation.login.signup

import androidx.annotation.StringRes

sealed class SignUpUiEvent {
data object NavigateToProfileSettingFragment : SignUpUiEvent()
data class ShowMessage(val message: Int, val extraMessage: String = "") : SignUpUiEvent()
data class ShowMessage(@StringRes val message: Int, val extraMessage: String = "") :
SignUpUiEvent()
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.teameetmeet.meetmeet.presentation.login.signup

import androidx.annotation.StringRes
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.teameetmeet.meetmeet.R
Expand Down Expand Up @@ -123,7 +124,7 @@ class SignUpViewModel @Inject constructor(
}
}

private suspend fun emitExceptionEvent(e: Throwable, message: Int) {
private suspend fun emitExceptionEvent(e: Throwable, @StringRes message: Int) {
when (e) {
is UnknownHostException -> {
_event.emit(SignUpUiEvent.ShowMessage(R.string.common_message_no_internet))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.teameetmeet.meetmeet.presentation.notification

import androidx.annotation.StringRes
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.teameetmeet.meetmeet.R
Expand Down Expand Up @@ -102,7 +103,7 @@ class EventNotificationViewModel @Inject constructor(
}
}

private suspend fun emitExceptionEvent(e: Throwable, message: Int) {
private suspend fun emitExceptionEvent(e: Throwable, @StringRes message: Int) {
when (e) {
is ExpiredRefreshTokenException -> {
_event.emit(EventNotificationUiEvent.ShowMessage(R.string.common_message_expired_login))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.teameetmeet.meetmeet.presentation.notification

import androidx.annotation.StringRes
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.teameetmeet.meetmeet.R
Expand Down Expand Up @@ -63,7 +64,7 @@ class FollowNotificationViewModel @Inject constructor(
}
}

private suspend fun emitExceptionEvent(e: Throwable, message: Int) {
private suspend fun emitExceptionEvent(e: Throwable, @StringRes message: Int) {
when (e) {
is ExpiredRefreshTokenException -> {
_event.emit(FollowNotificationUiEvent.ShowMessage(R.string.common_message_expired_login))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.teameetmeet.meetmeet.presentation.notification.event

import androidx.annotation.StringRes
import com.teameetmeet.meetmeet.data.network.entity.EventInvitationNotification

sealed class EventNotificationUiEvent {
data class ShowAcceptDialog(val event: EventInvitationNotification) : EventNotificationUiEvent()
data class ShowMessage(val message: Int, val extraMessage: String = "") :
data class ShowMessage(@StringRes val message: Int, val extraMessage: String = "") :
EventNotificationUiEvent()

data object NavigateToLoginActivity : EventNotificationUiEvent()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.teameetmeet.meetmeet.presentation.notification.follow

import androidx.annotation.StringRes

sealed class FollowNotificationUiEvent {
data class ShowMessage(val message: Int, val extraMessage: String = "") :
data class ShowMessage(@StringRes val message: Int, val extraMessage: String = "") :
FollowNotificationUiEvent()

data object NavigateToLoginActivity : FollowNotificationUiEvent()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.teameetmeet.meetmeet.presentation.setting.account

import androidx.annotation.StringRes

sealed class SettingAccountUiEvent {
data class ShowMessage(val message: Int, val extraMessage: String = "") :
data class ShowMessage(@StringRes val message: Int, val extraMessage: String = "") :
SettingAccountUiEvent()

data object NavigateToLoginActivity : SettingAccountUiEvent()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.teameetmeet.meetmeet.presentation.setting.account

import androidx.annotation.StringRes
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.teameetmeet.meetmeet.R
Expand Down Expand Up @@ -38,7 +39,7 @@ class SettingAccountViewModel @Inject constructor(
}
}

private suspend fun emitExceptionEvent(e: Throwable, message: Int) {
private suspend fun emitExceptionEvent(e: Throwable, @StringRes message: Int) {
when (e) {
is ExpiredRefreshTokenException -> {
_event.emit(SettingAccountUiEvent.ShowMessage(R.string.common_message_expired_login))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.teameetmeet.meetmeet.presentation.setting.home

import androidx.annotation.StringRes

sealed class SettingHomeUiEvent {
data class ShowMessage(val messageId: Int, val extraMessage: String = "") : SettingHomeUiEvent()
data class ShowMessage(@StringRes val messageId: Int, val extraMessage: String = "") : SettingHomeUiEvent()
data object NavigateToLoginActivity : SettingHomeUiEvent()
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.teameetmeet.meetmeet.presentation.setting.home

import androidx.annotation.StringRes
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.kakao.sdk.user.UserApiClient
Expand Down Expand Up @@ -52,7 +53,7 @@ class SettingHomeViewModel @Inject constructor(
}
}

private suspend fun emitExceptionEvent(e: Throwable, message: Int) {
private suspend fun emitExceptionEvent(e: Throwable, @StringRes message: Int) {
when (e) {
is ExpiredRefreshTokenException -> {
_event.emit(SettingHomeUiEvent.ShowMessage(R.string.common_message_expired_login))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.teameetmeet.meetmeet.presentation.setting.passwordchange

import androidx.annotation.StringRes

sealed class SettingPasswordChangeUiEvent {
data object NavigateToSettingHomeFragment : SettingPasswordChangeUiEvent()
data class ShowMessage(val message: Int, val extraMessage: String = "") :
data class ShowMessage(@StringRes val message: Int, val extraMessage: String = "") :
SettingPasswordChangeUiEvent()

data object NavigateToLoginActivity : SettingPasswordChangeUiEvent()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.teameetmeet.meetmeet.presentation.setting.passwordchange

import androidx.annotation.StringRes
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.teameetmeet.meetmeet.R
Expand Down Expand Up @@ -94,7 +95,7 @@ class SettingPasswordChangeViewModel @Inject constructor(
}
}

private suspend fun emitExceptionEvent(e: Throwable, message: Int) {
private suspend fun emitExceptionEvent(e: Throwable, @StringRes message: Int) {
when (e) {
is ExpiredRefreshTokenException -> {
_event.emit(SettingPasswordChangeUiEvent.ShowMessage(R.string.common_message_expired_login))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.teameetmeet.meetmeet.presentation.setting.profile

import androidx.annotation.StringRes

sealed class SettingProfileUiEvent {
data object NavigateToSettingHomeFragment : SettingProfileUiEvent()
data class ShowMessage(val message: Int, val extraMessage: String = "") :
data class ShowMessage(@StringRes val message: Int, val extraMessage: String = "") :
SettingProfileUiEvent()

data object NavigateToLoginActivity : SettingProfileUiEvent()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.teameetmeet.meetmeet.presentation.setting.profile

import android.net.Uri
import androidx.annotation.StringRes
import androidx.core.net.toUri
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
Expand Down Expand Up @@ -143,7 +144,7 @@ class SettingProfileViewModel @Inject constructor(
}
}

private suspend fun emitExceptionEvent(e: Throwable, message: Int) {
private suspend fun emitExceptionEvent(e: Throwable, @StringRes message: Int) {
when (e) {
is ExpiredRefreshTokenException -> {
_event.emit(SettingProfileUiEvent.ShowMessage(R.string.common_message_expired_login))
Expand Down

0 comments on commit c8791dd

Please sign in to comment.