Skip to content

Commit

Permalink
[FEATURE] #63 : Role 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Dec 23, 2023
1 parent 0506617 commit 83b4c3d
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 52 deletions.
36 changes: 18 additions & 18 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@ dependencies {
androidTestImplementation(libs.androidx.test.espresso)
}

tasks.getByPath(":app:preBuild").dependsOn("installGitHook")

tasks.register<Copy>("installGitHook") {
dependsOn("deletePreviousGitHook")
from("${rootProject.rootDir}/script/pre-commit")
into("${rootProject.rootDir}/.git/hooks")
eachFile {
fileMode = 777
}
}

tasks.register<Delete>("deletePreviousGitHook") {

val prePush = "${rootProject.rootDir}/.git/hooks/pre-commit"
if (file(prePush).exists()) {
delete(prePush)
}
}
// tasks.getByPath(":app:preBuild").dependsOn("installGitHook")
//
// tasks.register<Copy>("installGitHook") {
// dependsOn("deletePreviousGitHook")
// from("${rootProject.rootDir}/script/pre-commit")
// into("${rootProject.rootDir}/.git/hooks")
// eachFile {
// fileMode = 777
// }
// }
//
// tasks.register<Delete>("deletePreviousGitHook") {
//
// val prePush = "${rootProject.rootDir}/.git/hooks/pre-commit"
// if (file(prePush).exists()) {
// delete(prePush)
// }
// }
2 changes: 1 addition & 1 deletion app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fun WappNavHost(
)
noticeScreen()
surveyNavGraph(
navigateToSurvey = navController::navigateToSurvey ,
navigateToSurvey = navController::navigateToSurvey,
navigateToSurveyAnswer = navController::navigateToSurveyAnswer,
)
surveyCheckScreen(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ internal fun ProfileScreen(
)
}

WappProfileCard(isManager = true, userName = "태규")
WappProfileCard(role = Role.NORMAL, userName = "태규")

Box(
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.wap.wapp.feature.profile

enum class Role {
MANAGER, NORMAL, GUEST
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,57 @@ import androidx.compose.ui.unit.sp
import com.wap.designsystem.WappTheme
import com.wap.wapp.core.designresource.R.drawable
import com.wap.wapp.feature.profile.R
import com.wap.wapp.feature.profile.Role

@Composable
internal fun WappProfileCard(
isManager: Boolean,
role: Role,
userName: String,
) {
var position = stringResource(R.string.normal)
var githubImage = drawable.ic_normal_github
var catImage = drawable.ic_normal_cat
var brush = Brush.horizontalGradient(
listOf(
WappTheme.colors.yellow3C,
WappTheme.colors.yellow34,
WappTheme.colors.yellowA4,
),
)
var position: String? = null
var githubImage: Int? = null
var catImage: Int? = null
var brush: Brush? = null

if (isManager) {
position = stringResource(R.string.manager)
githubImage = drawable.ic_manager_github
catImage = drawable.ic_manager_cat
brush = Brush.horizontalGradient(
listOf(
WappTheme.colors.blue2FF,
WappTheme.colors.blue4FF,
WappTheme.colors.blue1FF,
),
)
when (role) {
Role.MANAGER -> {
position = stringResource(R.string.manager)
githubImage = drawable.ic_manager_github
catImage = drawable.ic_manager_cat
brush = Brush.horizontalGradient(
listOf(
WappTheme.colors.blue2FF,
WappTheme.colors.blue4FF,
WappTheme.colors.blue1FF,
),
)
}

Role.NORMAL -> {
position = stringResource(R.string.normal)
githubImage = drawable.ic_normal_github
catImage = drawable.ic_normal_cat
brush = Brush.horizontalGradient(
listOf(
WappTheme.colors.yellow3C,
WappTheme.colors.yellow34,
WappTheme.colors.yellowA4,
),
)
}

Role.GUEST -> {
position = stringResource(R.string.manager)
githubImage = drawable.ic_manager_github
catImage = drawable.ic_manager_cat
brush = Brush.horizontalGradient(
listOf(
WappTheme.colors.blue2FF,
WappTheme.colors.blue4FF,
WappTheme.colors.blue1FF,
),
)
}
}

Card(
Expand Down Expand Up @@ -108,11 +131,11 @@ internal fun WappProfileCard(
@Preview
@Composable
private fun NormalProfileCard() {
WappProfileCard(isManager = false, userName = "WAPP")
WappProfileCard(role = Role.NORMAL, userName = "WAPP")
}

@Preview
@Composable
private fun ManagerProfileCard() {
WappProfileCard(isManager = true, userName = "WAPP")
WappProfileCard(role = Role.MANAGER, userName = "WAPP")
}
1 change: 1 addition & 0 deletions feature/profile/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<string name="profile_setting_description">마이 페이지 설정으로 가는 톱니바퀴 모양 버튼입니다.</string>
<string name="normal">일반 회원</string>
<string name="manager">운영진</string>
<string name="guest">게스티</string>
<string name="profile">프로필</string>
<string name="attendance">출석</string>
<string name="absent">결석</string>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.wap.wapp.feature.survey.answer

import android.media.Rating
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ class SurveyAnswerViewModel @Inject constructor(

when (surveyQuestion.questionType) {
QuestionType.SUBJECTIVE -> {
surveyAnswerList.value.add( // 현재 질문 답변 리스트에 저장
surveyAnswerList.value.add(
// 현재 질문 답변 리스트에 저장
SurveyAnswer(
questionType = surveyQuestion.questionType,
questionTitle = surveyQuestion.questionTitle,
Expand All @@ -87,7 +88,7 @@ class SurveyAnswerViewModel @Inject constructor(
val currentQuestionNumber = _questionNumber.value
val lastQuestionNumber = surveyAnswerList.value.size

if(currentQuestionNumber == lastQuestionNumber) { // 마지막 질문일 경우 제출
if (currentQuestionNumber == lastQuestionNumber) { // 마지막 질문일 경우 제출
submitSurvey()
return
}
Expand All @@ -97,19 +98,28 @@ class SurveyAnswerViewModel @Inject constructor(

private fun submitSurvey() {
viewModelScope.launch {

}
}

fun setSubjectiveAnswer(answer: String) { _subjectiveAnswer.value = answer }
fun setSubjectiveAnswer(answer: String) {
_subjectiveAnswer.value = answer
}

fun setObjectiveAnswer(answer: Rating) { _objectiveAnswer.value = answer }
fun setObjectiveAnswer(answer: Rating) {
_objectiveAnswer.value = answer
}

private fun addQuestionNumber() { _questionNumber.value += 1 }
private fun addQuestionNumber() {
_questionNumber.value += 1
}

private fun clearSubjectiveAnswer() { _subjectiveAnswer.value = "" }
private fun clearSubjectiveAnswer() {
_subjectiveAnswer.value = ""
}

private fun clearObjectiveAnswer() { _objectiveAnswer.value = Rating.GOOD }
private fun clearObjectiveAnswer() {
_objectiveAnswer.value = Rating.GOOD
}

sealed class SurveyFormUiState {
data object Init : SurveyFormUiState()
Expand Down

0 comments on commit 83b4c3d

Please sign in to comment.