generated from AND-SOPT-ANDROID/and-sopt-android-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
514 additions
and
279 deletions.
There are no files selected for viewing
This file contains 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,18 @@ | ||
package org.sopt.and.core | ||
|
||
import androidx.annotation.StringRes | ||
import org.sopt.and.R | ||
|
||
enum class ContentType( | ||
@StringRes val titleResId: Int | ||
) { | ||
NEW_CLASSIC(R.string.type_new_classic), | ||
DRAMA(R.string.type_drama), | ||
ENTERTAINMENT(R.string.type_entertainment), | ||
MOVIE(R.string.type_movie), | ||
ANIMATION(R.string.type_animation), | ||
ABROAD_SERIES(R.string.type_abroad_series), | ||
INFORMATION_CULTURE(R.string.type_information_culture), | ||
KIDS(R.string.type_kids), | ||
MOVIE_PLUS(R.string.type_movie_plus), | ||
} |
41 changes: 41 additions & 0 deletions
41
app/src/main/java/org/sopt/and/core/component/CloseTopBar.kt
This file contains 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,41 @@ | ||
package org.sopt.and.core.component | ||
|
||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.Close | ||
import androidx.compose.material3.CenterAlignedTopAppBar | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.IconButton | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.TopAppBarDefaults | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.graphics.Color.Companion.White | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.unit.sp | ||
import org.sopt.and.R | ||
import org.sopt.and.ui.theme.WavveBg | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun CloseTopBar( | ||
title: String, | ||
onCloseClicked: () -> Unit) { | ||
CenterAlignedTopAppBar( | ||
title = { | ||
Text(text = title, fontSize = 20.sp) | ||
}, | ||
actions = { | ||
IconButton(onClick = onCloseClicked) { | ||
Icon( | ||
imageVector = Icons.Default.Close, | ||
contentDescription = stringResource(R.string.close_top_bar_icon_description_close), | ||
tint = White | ||
) | ||
} | ||
}, | ||
colors = TopAppBarDefaults.centerAlignedTopAppBarColors( | ||
containerColor = WavveBg, | ||
titleContentColor = White | ||
) | ||
) | ||
} |
44 changes: 44 additions & 0 deletions
44
app/src/main/java/org/sopt/and/core/component/HomeTobBar.kt
This file contains 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,44 @@ | ||
package org.sopt.and.core.component | ||
|
||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.IconButton | ||
import androidx.compose.material3.TopAppBar | ||
import androidx.compose.material3.TopAppBarDefaults | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.graphics.Color.Companion.White | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.res.vectorResource | ||
import org.sopt.and.R | ||
import org.sopt.and.ui.theme.WavveBg | ||
|
||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun HomeTopBar( | ||
onLiveButtonClick: () -> Unit | ||
) { | ||
TopAppBar( | ||
title = { | ||
Icon( | ||
imageVector = ImageVector.vectorResource(R.drawable.wavve_logo), | ||
contentDescription = stringResource(R.string.back_button_top_bar_icon_description_logo), | ||
tint = White | ||
) | ||
}, | ||
actions = { | ||
IconButton(onClick = onLiveButtonClick) { | ||
Icon( | ||
imageVector = ImageVector.vectorResource(R.drawable.ic_cast_24), | ||
contentDescription = stringResource(R.string.common_top_bar_icon_description_live), | ||
tint = White | ||
) | ||
} | ||
}, | ||
colors = TopAppBarDefaults.centerAlignedTopAppBarColors( | ||
containerColor = WavveBg, | ||
titleContentColor = White | ||
) | ||
) | ||
} |
44 changes: 44 additions & 0 deletions
44
app/src/main/java/org/sopt/and/core/component/HomeTopBar.kt
This file contains 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,44 @@ | ||
package org.sopt.and.core.component | ||
|
||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.IconButton | ||
import androidx.compose.material3.TopAppBar | ||
import androidx.compose.material3.TopAppBarDefaults | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.graphics.Color.Companion.White | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.res.vectorResource | ||
import org.sopt.and.R | ||
import org.sopt.and.ui.theme.WavveBg | ||
|
||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun HomeTopBar( | ||
onLiveButtonClick: () -> Unit | ||
) { | ||
TopAppBar( | ||
title = { | ||
Icon( | ||
imageVector = ImageVector.vectorResource(R.drawable.wavve_logo), | ||
contentDescription = stringResource(R.string.back_button_top_bar_icon_description_logo), | ||
tint = White | ||
) | ||
}, | ||
actions = { | ||
IconButton(onClick = onLiveButtonClick) { | ||
Icon( | ||
imageVector = ImageVector.vectorResource(R.drawable.ic_cast_24), | ||
contentDescription = stringResource(R.string.common_top_bar_icon_description_live), | ||
tint = White | ||
) | ||
} | ||
}, | ||
colors = TopAppBarDefaults.centerAlignedTopAppBarColors( | ||
containerColor = WavveBg, | ||
titleContentColor = White | ||
) | ||
) | ||
} |
This file contains 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,8 @@ | ||
package org.sopt.and.data.common | ||
|
||
|
||
object APICallType { | ||
const val REGISTER_USER = "registerUser" | ||
const val LOGIN_USER = "loginUser" | ||
const val GET_MY_HOBBY = "getMyHobby" | ||
} |
10 changes: 0 additions & 10 deletions
10
app/src/main/java/org/sopt/and/data/datasource/MyHobbyDataSource.kt
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
app/src/main/java/org/sopt/and/data/datasource/SignInDataSource.kt
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
app/src/main/java/org/sopt/and/data/datasource/SignUpDataSource.kt
This file was deleted.
Oops, something went wrong.
This file contains 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 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,32 @@ | ||
package org.sopt.and.data.mapper | ||
|
||
import org.sopt.and.data.common.APICallType | ||
|
||
object ErrorMapper { | ||
private val errorMapByApi = mapOf( | ||
APICallType.REGISTER_USER to mapOf( | ||
Pair(400, "01") to "잘못된 요청입니다.", | ||
Pair(400, "01") to "아이디, 비밀번호, 취미를 올바르게 입력해주세요.", | ||
Pair(404, null) to "잘못된 요청입니다.", | ||
Pair(409, "00") to "중복된 아이디입니다." | ||
), | ||
APICallType.LOGIN_USER to mapOf( | ||
Pair(400, "01") to "비밀번호를 올바르게 입력해주세요.", | ||
Pair(400, "02") to "비밀번호를 올바르게 입력해주세요.", | ||
Pair(403, "01") to "아이디 혹은 비밀번호가 틀렸습니다.", | ||
Pair(404, "00") to "잘못된 요청입니다." | ||
), | ||
APICallType.GET_MY_HOBBY to mapOf( | ||
Pair(401, "00") to "잘못된 요청입니다.", | ||
Pair(403, "00") to "잘못된 요청입니다.", | ||
Pair(404, "00") to "잘못된 요청입니다." | ||
), | ||
|
||
) | ||
fun getErrorMessage(apiName: String, statusCode: Int?, errorCode: String?): String { | ||
val apiErrorMap = errorMapByApi[apiName] | ||
val message = apiErrorMap?.get(Pair(statusCode, errorCode)) | ||
|
||
return message ?: "알 수 없는 에러" | ||
} | ||
} |
This file contains 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 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,25 @@ | ||
package org.sopt.and.data.model | ||
|
||
import kotlinx.serialization.Serializable | ||
import org.sopt.and.domain.entity.BaseResult | ||
|
||
@Serializable | ||
sealed class BaseResponse<out T> { | ||
data class Success<out T>(val data: T) : BaseResponse<T>() | ||
data class Failure( | ||
val statusCode: Int?, | ||
val errorCode: String?, | ||
val message: String | ||
) : BaseResponse<Nothing>() | ||
} | ||
@Serializable | ||
data class ErrorResponse( | ||
val code: String | ||
) | ||
|
||
fun <T> BaseResponse<T>.toBaseResult(): BaseResult<T> { | ||
return when (this) { | ||
is BaseResponse.Success -> BaseResult.Success(this.data) | ||
is BaseResponse.Failure -> BaseResult.Error(this.message, this.errorCode) | ||
} | ||
} |
Oops, something went wrong.