-
Notifications
You must be signed in to change notification settings - Fork 1
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
15 changed files
with
212 additions
and
43 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
2 changes: 1 addition & 1 deletion
2
core/data/src/main/java/com/wap/wapp/core/data/repository/management/ManagementRepository.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
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
36 changes: 36 additions & 0 deletions
36
core/domain/src/main/java/com/wap/wapp/core/domain/usecase/user/GetUserRoleUseCase.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,36 @@ | ||
package com.wap.wapp.core.domain.usecase.user | ||
|
||
import com.wap.wapp.core.data.repository.management.ManagementRepository | ||
import com.wap.wapp.core.data.repository.user.UserRepository | ||
import com.wap.wapp.core.model.user.UserRole | ||
import javax.inject.Inject | ||
|
||
class GetUserRoleUseCase @Inject constructor( | ||
private val userRepository: UserRepository, | ||
private val managementRepository: ManagementRepository, | ||
) { | ||
suspend operator fun invoke(): Result<UserRole> { | ||
return runCatching { | ||
val userId = userRepository.getUserId() | ||
.getOrElse { exception -> | ||
if (exception is IllegalStateException) { // 회원이 아닌 경우 | ||
return@runCatching UserRole.GUEST | ||
} | ||
throw exception | ||
} | ||
|
||
managementRepository.isManager(userId) | ||
.fold( | ||
onSuccess = { isManager -> | ||
if (isManager) { // 매니저인 경우 | ||
return@fold UserRole.MANAGER | ||
} | ||
UserRole.MEMBER | ||
}, | ||
onFailure = { exception -> | ||
throw exception | ||
}, | ||
) | ||
} | ||
} | ||
} |
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
5 changes: 5 additions & 0 deletions
5
core/model/src/main/java/com/wap/wapp/core/model/user/UserRole.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,5 @@ | ||
package com.wap.wapp.core.model.user | ||
|
||
enum class UserRole { | ||
GUEST, MEMBER, MANAGER | ||
} |
2 changes: 1 addition & 1 deletion
2
...network/src/main/java/com/wap/wapp/core/network/source/management/ManagementDataSource.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
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
59 changes: 59 additions & 0 deletions
59
feature/survey/src/main/java/com/wap/wapp/feature/survey/SurveyGuestDialog.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,59 @@ | ||
package com.wap.wapp.feature.survey | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.AlertDialog | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.unit.dp | ||
import com.wap.designsystem.WappTheme | ||
import com.wap.designsystem.component.WappButton | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
internal fun SurveyGuestDialog( | ||
onDismissRequest: () -> Unit, | ||
onButtonClicked: () -> Unit, | ||
) { | ||
AlertDialog( | ||
onDismissRequest = { onDismissRequest() }, | ||
modifier = Modifier | ||
.padding(16.dp) | ||
.fillMaxWidth(), | ||
) { | ||
Column( | ||
verticalArrangement = Arrangement.spacedBy(16.dp), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
modifier = Modifier.fillMaxWidth(), | ||
) { | ||
Column { | ||
Text( | ||
text = stringResource(R.string.survey_guset_title), | ||
style = WappTheme.typography.titleBold, | ||
color = WappTheme.colors.white, | ||
modifier = Modifier.fillMaxWidth(), | ||
textAlign = TextAlign.Center, | ||
) | ||
Text( | ||
text = stringResource(R.string.survey_guest_content), | ||
style = WappTheme.typography.captionMedium, | ||
color = WappTheme.colors.white, | ||
modifier = Modifier.fillMaxWidth(), | ||
textAlign = TextAlign.Center, | ||
) | ||
} | ||
|
||
WappButton( | ||
textRes = R.string.go_to_signin, | ||
onClick = onButtonClicked, | ||
) | ||
} | ||
} | ||
} |
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
Oops, something went wrong.