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

점검화면 추가 #356

Merged
merged 16 commits into from
Sep 29, 2024
2 changes: 2 additions & 0 deletions app/src/main/java/com/wafflestudio/snutt2/RemoteConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,6 @@ class RemoteConfig @Inject constructor(
// NOTE: 평상시에는 필드가 null로 내려오고, 이는 로직상 false 취급이다. 지도를 급히 비활성화해야 할 경우 true가 내려온다.
// https://wafflestudio.slack.com/archives/C0PAVPS5T/p1706542084934709?thread_ts=1706451688.745159&cid=C0PAVPS5T
get() = config.map { it.disableMapFeature ?: false }
val noticeConfig: Flow<RemoteConfigDto.NoticeConfig>
get() = config.map { it.noticeConfig ?: RemoteConfigDto.NoticeConfig(false, null, null) }
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ data class RemoteConfigDto(
@Json(name = "vacancySugangSnuUrl") val vacancyUrlConfig: VacancyUrlConfig = VacancyUrlConfig(),
@Json(name = "settingsBadge") val settingsBadgeConfig: SettingsBadgeConfig = SettingsBadgeConfig(),
@Json(name = "disableMapFeature") val disableMapFeature: Boolean? = null,
@Json(name = "notice") val noticeConfig: NoticeConfig? = null,
) {
data class ReactNativeBundleSrc(
@Json(name = "src") val src: Map<String, String>,
Expand All @@ -27,6 +28,12 @@ data class RemoteConfigDto(
data class VacancyUrlConfig(
@Json(name = "url") val url: String? = null,
)

data class NoticeConfig(
@Json(name = "visible") val visible: Boolean = false,
@Json(name = "title") val title: String? = null,
@Json(name = "content") val content: String? = null,
)
}

fun RemoteConfigDtoNetwork.toExternalModel() = RemoteConfigDto(
Expand All @@ -35,6 +42,7 @@ fun RemoteConfigDtoNetwork.toExternalModel() = RemoteConfigDto(
vacancyUrlConfig = this.vacancyUrlConfig.toExternalModel(),
settingsBadgeConfig = this.settingsBadgeConfig.toExternalModel(),
disableMapFeature = this.disableMapFeature,
noticeConfig = this.noticeConfig?.toExternalModel(),
)

fun RemoteConfigDtoNetwork.ReactNativeBundleSrc.toExternalModel() = RemoteConfigDto.ReactNativeBundleSrc(
Expand All @@ -52,3 +60,9 @@ fun RemoteConfigDtoNetwork.VacancyBannerConfig.toExternalModel() = RemoteConfigD
fun RemoteConfigDtoNetwork.VacancyUrlConfig.toExternalModel() = RemoteConfigDto.VacancyUrlConfig(
url = this.url,
)

fun RemoteConfigDtoNetwork.NoticeConfig.toExternalModel() = RemoteConfigDto.NoticeConfig(
visible = visible ?: false,
title = title,
content = content,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.wafflestudio.snutt2.model

data class ImportantNotice(
val title: String?,
val content: String?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ object NavigationDestination {
const val ThemeConfig = "theme_config"
const val ThemeDetail = "theme_detail"
const val SocialLink = "social_link"
const val ImportantNotice = "important_notice"
}
10 changes: 10 additions & 0 deletions app/src/main/java/com/wafflestudio/snutt2/views/RootActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,14 @@ class RootActivity : AppCompatActivity() {
LocalRemoteConfig provides remoteConfig,
LocalNavBottomSheetState provides navBottomSheetState,
) {
LaunchedEffect(Unit) {
remoteConfig.noticeConfig.collect {
if (it.visible) {
navController.navigateAsOrigin(NavigationDestination.ImportantNotice)
}
}
}

InstallInAppDeeplinkExecutor()
ModalBottomSheetLayout(
bottomSheetNavigator = bottomSheetNavigator,
Expand All @@ -247,6 +255,8 @@ class RootActivity : AppCompatActivity() {

composableRoot(NavigationDestination.Home) { HomePage() }

composable2(NavigationDestination.ImportantNotice) { ImportantNoticePage() }

composable2(NavigationDestination.Notification) { NotificationPage() }

composable2(NavigationDestination.LecturesOfTable) { LecturesOfTablePage() }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
package com.wafflestudio.snutt2.views.logged_out

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.wafflestudio.snutt2.R
import com.wafflestudio.snutt2.components.compose.clicks
import com.wafflestudio.snutt2.lib.network.dto.core.RemoteConfigDto
import com.wafflestudio.snutt2.ui.SNUTTColors
import com.wafflestudio.snutt2.ui.SNUTTTypography
import com.wafflestudio.snutt2.views.LocalNavController
import com.wafflestudio.snutt2.views.LocalRemoteConfig
import com.wafflestudio.snutt2.views.NavigationDestination

@Composable
fun ImportantNoticePage() {
val navController = LocalNavController.current
val remoteConfig = LocalRemoteConfig.current
val noticeConfig by remoteConfig.noticeConfig.collectAsState(RemoteConfigDto.NoticeConfig())

Column(
modifier = Modifier
.fillMaxSize()
.padding(vertical = 12.dp, horizontal = 48.dp)
.background(SNUTTColors.White900),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
) {
Image(
painter = painterResource(id = R.drawable.ic_cat_retry),
contentDescription = stringResource(R.string.sign_in_logo_title),
modifier = Modifier.width(55.dp),
)

Spacer(modifier = Modifier.height(32.dp))

Text(
text = noticeConfig.title ?: "",
style = SNUTTTypography.h3.copy(
fontSize = 17.sp,
),
color = SNUTTColors.Black900,
textAlign = TextAlign.Center,
)

Spacer(modifier = Modifier.height(8.dp))

Text(
text = noticeConfig.content ?: "",
style = SNUTTTypography.body1,
textAlign = TextAlign.Center,
)

Spacer(modifier = Modifier.height(20.dp))

Surface(
modifier = Modifier
.size(121.dp, 33.dp)
.clicks {
navController.navigate(NavigationDestination.AppReport)
},
shape = RoundedCornerShape(18.dp),
color = SNUTTColors.SNUTTVacancy,
) {
Box(
contentAlignment = Alignment.Center,
) {
Text(
text = stringResource(R.string.send_report),
style = SNUTTTypography.h4.copy(
color = SNUTTColors.AllWhite,
fontWeight = FontWeight.SemiBold,
),
maxLines = 1,
)
}
}
}
}
4 changes: 3 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<string name="privacy" translatable="false">privacy_policy</string>
<string name="member" translatable="false">member</string>

<string name="send_report">문의사항 보내기</string>

<!-- For sign up fragment -->
<string name="sign_up_terms_1">회원가입을 누르시면</string>
<string name="sign_up_terms_2">일반 이용 약관</string>
Expand Down Expand Up @@ -401,7 +403,7 @@
<string name="settings_app_report_email">이메일</string>
<string name="settings_app_report_detail">내용</string>
<string name="settings_app_report_loading_indicator_title">피드백 전송</string>
<string name="settings_app_report_detail_hint">SNUTT 최고예요</string>
<string name="settings_app_report_detail_hint"> </string>
<string name="settings_app_report_description">불편한 점이나 버그를 제보해주세요.\n더 나은 SNUTT를 위한 아이디어도 환영해요.</string>
<string name="settings_personal_information_policy">개인정보처리방침</string>
<string name="settings_item_vacancy">빈자리 알림</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ data class RemoteConfigDto(
@Json(name = "vacancySugangSnuUrl") val vacancyUrlConfig: VacancyUrlConfig = VacancyUrlConfig(),
@Json(name = "settingsBadge") val settingsBadgeConfig: SettingsBadgeConfig = SettingsBadgeConfig(),
@Json(name = "disableMapFeature") val disableMapFeature: Boolean? = null,
@Json(name = "notice") val noticeConfig: NoticeConfig? = null,
) {
data class ReactNativeBundleSrc(
@Json(name = "src") val src: Map<String, String>,
Expand All @@ -26,4 +27,10 @@ data class RemoteConfigDto(
data class VacancyUrlConfig(
@Json(name = "url") val url: String? = null,
)

data class NoticeConfig(
@Json(name = "visible") val visible: Boolean? = false,
@Json(name = "title") val title: String? = null,
@Json(name = "content") val content: String? = null,
)
}
Loading