Skip to content
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

#99 [hotfix] : 중복되는 네이밍 에러 수정 #100

Merged
merged 2 commits into from
Oct 12, 2024
Merged
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: 2 additions & 0 deletions core/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ android {
}

dependencies {
implementation(project(":core:model"))

// Third Party
implementation(libs.amplitude)
implementation(libs.google.play.services)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.teamwable.common.util

import android.content.res.Resources
import com.teamwable.common.R
import com.teamwable.model.network.Error
import java.net.UnknownHostException

fun getThrowableMessage(
throwable: Throwable?, localContextResource: Resources,
): String = when (throwable) {
is UnknownHostException -> localContextResource.getString(R.string.error_message_network)
is Error.NetWorkConnectError -> localContextResource.getString(R.string.error_message_network)
is Error.ApiError -> throwable.message.toString()
is Error.TimeOutError -> throwable.message.toString()
else -> localContextResource.getString(R.string.error_message_unknown)
}
16 changes: 0 additions & 16 deletions core/ui/src/main/java/com/teamwable/ui/util/GetErrorMessage.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import com.teamwable.onboarding.agreeterms.naviagation.navigateToAgreeTerms
import com.teamwable.onboarding.firstlckwatch.naviagation.navigateToFirstLckWatch
import com.teamwable.onboarding.profile.naviagation.navigateToProfile
import com.teamwable.onboarding.selectlckteam.naviagation.navigateToSelectLckTeam
import kotlinx.collections.immutable.persistentListOf

class MainNavigator(
val navController: NavHostController,
Expand All @@ -26,6 +27,10 @@ class MainNavigator(

val startDestination = Route.Splash

private val topBarHiddenRoutes = persistentListOf(
Route.Login::class, Route.Splash::class,
)

fun navigateToLogin(navOptions: NavOptions) {
navController.navigateLogin(navOptions)
}
Expand Down Expand Up @@ -74,10 +79,7 @@ class MainNavigator(
}

@Composable
fun shouldShowTopBar(): Boolean {
val currentRoute = currentDestination?.route ?: return false
return !(currentRoute.contains("Login") || currentRoute.contains("Splash"))
}
fun shouldShowTopBar(): Boolean = !topBarHiddenRoutes.any { currentDestination?.hasRoute(it) ?: false }

private inline fun <reified T : Route> isSameCurrentDestination(): Boolean {
return navController.currentDestination?.hasRoute<T>() == true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import androidx.navigation.compose.NavHost
import androidx.navigation.navOptions
import com.teamwable.auth.naviagation.loginNavGraph
import com.teamwable.common.intentprovider.IntentProvider
import com.teamwable.common.util.getThrowableMessage
import com.teamwable.designsystem.component.snackbar.SNACK_BAR_DURATION
import com.teamwable.designsystem.component.snackbar.WableSnackBar
import com.teamwable.designsystem.component.topbar.WableAppBar
import com.teamwable.designsystem.type.SnackBarType
import com.teamwable.main_compose.extensions.getErrorMessage
import com.teamwable.main_compose.splash.navigation.splashNavGraph
import com.teamwable.onboarding.agreeterms.naviagation.agreeTermsNavGraph
import com.teamwable.onboarding.firstlckwatch.naviagation.firstLckWatchNavGraph
Expand All @@ -47,7 +47,7 @@ internal fun MainScreen(
val onShowErrorSnackBar: (throwable: Throwable?) -> Unit = { throwable ->
coroutineScope.launch {
val job = launch {
snackBarHostState.showSnackbar(getErrorMessage(throwable, localContextResource))
snackBarHostState.showSnackbar(message = getThrowableMessage(throwable, localContextResource))
}
delay(SNACK_BAR_DURATION)
job.cancel()
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.LocalLifecycleOwner
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.flowWithLifecycle
import com.teamwable.common.util.getThrowableMessage
import com.teamwable.designsystem.component.snackbar.SNACK_BAR_DURATION
import com.teamwable.designsystem.component.snackbar.WableSnackBar
import com.teamwable.designsystem.component.snackbar.WableSnackBarPopUp
Expand All @@ -29,7 +30,6 @@ import com.teamwable.onboarding.profile.permission.launchImagePicker
import com.teamwable.onboarding.profile.permission.rememberGalleryLauncher
import com.teamwable.onboarding.profile.permission.rememberPhotoPickerLauncher
import com.teamwable.profile.profile.edit.model.ProfilePatchState
import com.teamwable.ui.util.getErrorMessage
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch

Expand All @@ -51,7 +51,7 @@ internal fun ProfileEditRoute(
val onShowErrorSnackBar: (throwable: Throwable?) -> Unit = { throwable ->
coroutineScope.launch {
val job = launch {
snackBarHostState.showSnackbar(getErrorMessage(throwable, localContextResource))
snackBarHostState.showSnackbar(message = getThrowableMessage(throwable, localContextResource))
}
delay(SNACK_BAR_DURATION)
job.cancel()
Expand Down