-
Notifications
You must be signed in to change notification settings - Fork 0
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
#138: 로그인후 이용제한 확인하기 #144
Merged
Merged
#138: 로그인후 이용제한 확인하기 #144
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
bb3bbca
[FEAT]#138: 이용 제한 model 추가
flash159483 98b93f5
[FEAT]#138: 서버 연동
flash159483 1c30c50
[FEAT]#138: 학교 paging 문제 해결
flash159483 6d0ca29
[FEAT]#138: 투표 문제 해결
flash159483 bc8e91e
[FEAT]#138: 신고 바텀 시트 구현
flash159483 d4f570d
[FEAT]#138: Lint 형식대로 수정
flash159483 5b4121c
[FEAT]#138: 서버에 맞게 수정
flash159483 79f7121
Merge branch 'develop' of https://github.com/YAPP-Github/24th-App-Tea…
flash159483 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -8,6 +8,7 @@ import androidx.activity.ComponentActivity | |
import androidx.activity.compose.setContent | ||
import androidx.activity.result.contract.ActivityResultContracts | ||
import androidx.activity.viewModels | ||
import androidx.annotation.StringRes | ||
import androidx.compose.animation.AnimatedContent | ||
import androidx.compose.animation.core.tween | ||
import androidx.compose.animation.fadeIn | ||
|
@@ -17,6 +18,7 @@ import androidx.compose.foundation.Image | |
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.RowScope | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
|
@@ -29,6 +31,7 @@ import androidx.compose.material3.IconButton | |
import androidx.compose.material3.NavigationBar | ||
import androidx.compose.material3.Scaffold | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.rememberModalBottomSheetState | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.CompositionLocalProvider | ||
import androidx.compose.runtime.DisposableEffect | ||
|
@@ -38,10 +41,12 @@ import androidx.compose.runtime.State | |
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.rememberCoroutineScope | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.painter.Painter | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.unit.dp | ||
|
@@ -52,28 +57,34 @@ import androidx.navigation.compose.rememberNavController | |
import com.bff.wespot.analytic.AnalyticsHelper | ||
import com.bff.wespot.analytic.LocalAnalyticsHelper | ||
import com.bff.wespot.designsystem.R | ||
import com.bff.wespot.designsystem.component.button.WSButton | ||
import com.bff.wespot.designsystem.component.button.WSButtonType | ||
import com.bff.wespot.designsystem.component.header.WSTopBar | ||
import com.bff.wespot.designsystem.theme.StaticTypeScale | ||
import com.bff.wespot.designsystem.theme.WeSpotTheme | ||
import com.bff.wespot.designsystem.theme.WeSpotThemeManager | ||
import com.bff.wespot.entire.screen.destinations.SettingScreenDestination | ||
import com.bff.wespot.model.ToastState | ||
import com.bff.wespot.model.common.RestrictionType | ||
import com.bff.wespot.model.notification.NotificationType | ||
import com.bff.wespot.model.notification.convertNotificationType | ||
import com.bff.wespot.navigation.Navigator | ||
import com.bff.wespot.navigation.util.EXTRA_DATE | ||
import com.bff.wespot.navigation.util.EXTRA_TARGET_ID | ||
import com.bff.wespot.navigation.util.EXTRA_TYPE | ||
import com.bff.wespot.notification.screen.NotificationNavigator | ||
import com.bff.wespot.state.MainAction | ||
import com.bff.wespot.state.MainUiState | ||
import com.bff.wespot.R.string | ||
import com.bff.wespot.ui.TopToast | ||
import com.bff.wespot.state.MainAction | ||
import com.bff.wespot.ui.WSBottomSheet | ||
import com.bff.wespot.util.clickableSingle | ||
import com.bff.wespot.viewmodel.MainViewModel | ||
import com.ramcosta.composedestinations.dynamic.within | ||
import com.ramcosta.composedestinations.navigation.navigate | ||
import com.ramcosta.composedestinations.spec.NavGraphSpec | ||
import dagger.hilt.android.AndroidEntryPoint | ||
import kotlinx.coroutines.launch | ||
import org.orbitmvi.orbit.compose.collectAsState | ||
import timber.log.Timber | ||
import javax.inject.Inject | ||
|
@@ -274,6 +285,19 @@ private fun MainScreen( | |
toast = toast.copy(show = false) | ||
} | ||
|
||
if (state.restriction.restrictionType != RestrictionType.NONE) { | ||
RestrictionBottomSheet( | ||
content = when (state.restriction.restrictionType) { | ||
RestrictionType.TEMPORARY_BAN_MESSAGE_REPORT -> RestrictionContent.TYPE1 | ||
RestrictionType.PERMANENT_BAN_MESSAGE_REPORT -> RestrictionContent.TYPE2 | ||
RestrictionType.PERMANENT_BAN_VOTE_REPORT -> RestrictionContent.TYPE3 | ||
else -> RestrictionContent.TYPE1 | ||
}, | ||
state = state, | ||
navigator = navigator, | ||
) | ||
} | ||
|
||
LaunchedEffect(Unit) { | ||
action(MainAction.OnMainScreenEntered) | ||
} | ||
|
@@ -390,7 +414,10 @@ private fun RowScope.TabItem( | |
} | ||
} | ||
|
||
private fun navigateScreenFromNavArgs(navArgs: MainScreenNavArgs, navigator: NotificationNavigator) { | ||
private fun navigateScreenFromNavArgs( | ||
navArgs: MainScreenNavArgs, | ||
navigator: NotificationNavigator | ||
) { | ||
when (navArgs.type) { | ||
NotificationType.MESSAGE -> { | ||
navigator.navigateToReceiverSelectionScreen() | ||
|
@@ -423,3 +450,156 @@ private fun NavController.navigateToNavGraph(navGraph: NavGraphSpec) { | |
popUpTo([email protected]().id) | ||
} | ||
} | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
private fun RestrictionBottomSheet( | ||
content: RestrictionContent, | ||
state: MainUiState, | ||
navigator: Navigator, | ||
) { | ||
val context = LocalContext.current | ||
val bottomSheetState = rememberModalBottomSheetState() | ||
val coroutineScope = rememberCoroutineScope() | ||
|
||
WSBottomSheet( | ||
sheetState = bottomSheetState, | ||
closeSheet = { | ||
coroutineScope.launch { | ||
bottomSheetState.hide() | ||
} | ||
} | ||
) { | ||
Column( | ||
modifier = Modifier.padding(28.dp), | ||
verticalArrangement = Arrangement.spacedBy(6.dp), | ||
) { | ||
Text( | ||
text = stringResource(content.title), | ||
style = StaticTypeScale.Default.body1, | ||
modifier = Modifier.padding(bottom = 10.dp), | ||
color = WeSpotThemeManager.colors.txtTitleColor, | ||
) | ||
|
||
BulletPoint(text = stringResource(content.body1)) | ||
|
||
BulletPoint( | ||
text = stringResource( | ||
content.body2, | ||
state.restriction.toKoreanDate() | ||
), | ||
) | ||
|
||
BulletPoint(text = stringResource(content.body3)) | ||
|
||
if (content.body4 != null) { | ||
BulletPoint(text = stringResource(content.body4)) | ||
} | ||
|
||
if (content.buttonNumber == 1) { | ||
WSButton( | ||
onClick = { | ||
coroutineScope.launch { | ||
bottomSheetState.hide() | ||
} | ||
}, | ||
text = stringResource(com.bff.wespot.auth.R.string.confirm), | ||
paddingValues = PaddingValues( | ||
start = 0.dp, | ||
end = 0.dp, | ||
top = 24.dp, | ||
bottom = 10.dp | ||
), | ||
) { | ||
it.invoke() | ||
} | ||
} else { | ||
Row( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(top = 20.dp), | ||
horizontalArrangement = Arrangement.spacedBy(10.dp), | ||
) { | ||
Box(modifier = Modifier.weight(1f)) { | ||
WSButton( | ||
onClick = { | ||
coroutineScope.launch { | ||
bottomSheetState.hide() | ||
} | ||
}, | ||
buttonType = WSButtonType.Secondary, | ||
text = stringResource(R.string.close), | ||
paddingValues = PaddingValues(0.dp), | ||
) { | ||
it() | ||
} | ||
} | ||
|
||
Box(modifier = Modifier.weight(1f)) { | ||
WSButton( | ||
onClick = { | ||
navigator.navigateToWebLink(context, state.kakaoChannel) | ||
}, | ||
text = stringResource(com.bff.wespot.R.string.one_on_one), | ||
paddingValues = PaddingValues(0.dp), | ||
) { | ||
it() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
private fun BulletPoint(text: String) { | ||
Row( | ||
horizontalArrangement = Arrangement.spacedBy(6.dp) | ||
) { | ||
Text( | ||
text = "•", | ||
style = StaticTypeScale.Default.body6, | ||
color = WeSpotThemeManager.colors.txtSubColor, | ||
) | ||
|
||
Text( | ||
text = text, | ||
style = StaticTypeScale.Default.body6, | ||
color = WeSpotThemeManager.colors.txtSubColor, | ||
) | ||
} | ||
} | ||
|
||
private enum class RestrictionContent( | ||
@StringRes val title: Int, | ||
@StringRes val body1: Int, | ||
@StringRes val body2: Int, | ||
@StringRes val body3: Int, | ||
@StringRes val body4: Int? = null, | ||
val buttonNumber: Int = 1, | ||
) { | ||
TYPE1( | ||
com.bff.wespot.R.string.restriction_title, | ||
com.bff.wespot.R.string.restriction_type1_body1, | ||
com.bff.wespot.R.string.restriction_type1_body2, | ||
com.bff.wespot.R.string.restriction_type1_body3, | ||
com.bff.wespot.R.string.restriction_type1_body4, | ||
), | ||
|
||
TYPE2( | ||
com.bff.wespot.R.string.restriction_title, | ||
com.bff.wespot.R.string.restriction_type1_body1, | ||
com.bff.wespot.R.string.restriction_type2_body2, | ||
com.bff.wespot.R.string.restriction_type2_body3, | ||
), | ||
|
||
TYPE3( | ||
com.bff.wespot.R.string.restriction_title, | ||
com.bff.wespot.R.string.restriction_type1_body1, | ||
com.bff.wespot.R.string.restriction_type3_body2, | ||
com.bff.wespot.R.string.restriction_type3_body3, | ||
null, | ||
2, | ||
); | ||
} | ||
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 |
---|---|---|
@@ -1,6 +1,10 @@ | ||
package com.bff.wespot.state | ||
|
||
import com.bff.wespot.model.common.Restriction | ||
|
||
data class MainUiState ( | ||
val isPushNotificationNavigation: Boolean = true, | ||
val userId: String = "", | ||
val restriction: Restriction = Restriction.Empty, | ||
val kakaoChannel: String, | ||
) |
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
19 changes: 19 additions & 0 deletions
19
core/model/src/main/kotlin/com/bff/wespot/model/common/Restriction.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,19 @@ | ||
package com.bff.wespot.model.common | ||
|
||
import java.time.LocalDate | ||
|
||
data class Restriction( | ||
val restrictionType: RestrictionType, | ||
val releaseDate: LocalDate, | ||
) { | ||
fun toKoreanDate(): String { | ||
return "${releaseDate.year}년 ${releaseDate.monthValue}월 ${releaseDate.dayOfMonth}일" | ||
} | ||
|
||
companion object { | ||
val Empty = Restriction( | ||
restrictionType = RestrictionType.NONE, | ||
releaseDate = LocalDate.now(), | ||
) | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
core/model/src/main/kotlin/com/bff/wespot/model/common/RestrictionType.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,8 @@ | ||
package com.bff.wespot.model.common | ||
|
||
enum class RestrictionType { | ||
NONE, | ||
PERMANENT_BAN_VOTE_REPORT, | ||
TEMPORARY_BAN_MESSAGE_REPORT, | ||
PERMANENT_BAN_MESSAGE_REPORT, | ||
} |
17 changes: 17 additions & 0 deletions
17
data-remote/src/main/kotlin/com/bff/wespot/data/remote/model/common/RestrictionDto.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,17 @@ | ||
package com.bff.wespot.data.remote.model.common | ||
|
||
import com.bff.wespot.data.remote.extensions.toLocalDateFromDashPattern | ||
import com.bff.wespot.model.common.Restriction | ||
import com.bff.wespot.model.common.RestrictionType | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class RestrictionDto( | ||
val restrictionType: String, | ||
val releaseDate: String, | ||
) { | ||
fun toRestriction(): Restriction = Restriction( | ||
restrictionType = RestrictionType.valueOf(restrictionType), | ||
releaseDate = releaseDate.toLocalDateFromDashPattern(), | ||
) | ||
} |
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MainActivity가 계속계속 커지는 느낌이라, 따로 앱 모듈 내에 component 패키지 만들어서 컴포저블 함수 옮기는 건 어떨까요 ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
귀찮으니 다음에 해야겠다