diff --git a/app/src/main/java/com/doyoonkim/knutice/fcm/PushNotificationHandler.kt b/app/src/main/java/com/doyoonkim/knutice/fcm/PushNotificationHandler.kt index 372094e..6d52ba0 100644 --- a/app/src/main/java/com/doyoonkim/knutice/fcm/PushNotificationHandler.kt +++ b/app/src/main/java/com/doyoonkim/knutice/fcm/PushNotificationHandler.kt @@ -5,6 +5,8 @@ import android.app.NotificationChannel import android.app.NotificationManager import android.content.Context import android.content.pm.PackageManager +import android.graphics.Bitmap +import android.graphics.drawable.Icon import android.os.Build import android.util.Log import androidx.core.app.ActivityCompat @@ -54,8 +56,8 @@ class PushNotificationHandler @Inject constructor() : FirebaseMessagingService() val notificationBuilder = NotificationCompat.Builder( applicationContext, getString(R.string.inapp_notification_channel_id) ) - .setSmallIcon(R.mipmap.ic_launcher) - .setContentTitle("New Notice!") + .setLargeIcon(Icon.createWithResource(applicationContext, R.mipmap.ic_launcher)) + .setContentTitle(getString(R.string.new_notice)) .setContentText(this@toPushNotification.notification?.body ?: "No message body") .setPriority(NotificationCompat.PRIORITY_DEFAULT) .setAutoCancel(true) diff --git a/app/src/main/java/com/doyoonkim/knutice/navigation/MainNavigator.kt b/app/src/main/java/com/doyoonkim/knutice/navigation/MainNavigator.kt index e65da38..a805fba 100644 --- a/app/src/main/java/com/doyoonkim/knutice/navigation/MainNavigator.kt +++ b/app/src/main/java/com/doyoonkim/knutice/navigation/MainNavigator.kt @@ -38,28 +38,36 @@ fun MainNavigator( viewModel.updateState( updatedCurrentLocation = Destination.MORE_GENERAL ) - MoreCategorizedNotification(category = NoticeCategory.GENERAL_NEWS) + MoreCategorizedNotification(category = NoticeCategory.GENERAL_NEWS) { + navController.popBackStack() + } } composable(Destination.MORE_ACADEMIC.name) { viewModel.updateState( updatedCurrentLocation = Destination.MORE_ACADEMIC ) - MoreCategorizedNotification(category = NoticeCategory.ACADEMIC_NEWS) + MoreCategorizedNotification(category = NoticeCategory.ACADEMIC_NEWS) { + navController.popBackStack() + } } composable(Destination.MORE_SCHOLARSHIP.name) { viewModel.updateState( updatedCurrentLocation = Destination.MORE_SCHOLARSHIP ) - MoreCategorizedNotification(category = NoticeCategory.SCHOLARSHIP_NEWS) + MoreCategorizedNotification(category = NoticeCategory.SCHOLARSHIP_NEWS) { + navController.popBackStack() + } } composable(Destination.MORE_EVENT.name) { viewModel.updateState( updatedCurrentLocation = Destination.MORE_EVENT ) - MoreCategorizedNotification(category = NoticeCategory.EVENT_NEWS) + MoreCategorizedNotification(category = NoticeCategory.EVENT_NEWS) { + navController.popBackStack() + } } composable(Destination.SETTINGS.name) { diff --git a/app/src/main/java/com/doyoonkim/knutice/presentation/CategorizedNoficiation.kt b/app/src/main/java/com/doyoonkim/knutice/presentation/CategorizedNoficiation.kt index 0d83ba6..511b832 100644 --- a/app/src/main/java/com/doyoonkim/knutice/presentation/CategorizedNoficiation.kt +++ b/app/src/main/java/com/doyoonkim/knutice/presentation/CategorizedNoficiation.kt @@ -1,6 +1,7 @@ package com.doyoonkim.knutice.presentation import android.content.res.Configuration +import androidx.activity.compose.BackHandler import androidx.compose.animation.AnimatedVisibility import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement @@ -14,6 +15,7 @@ import androidx.compose.foundation.verticalScroll import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment @@ -46,6 +48,12 @@ fun CategorizedNotification( ) { val uiState by viewModel.uiState.collectAsState() + // Back button/gesture actions + BackHandler { + if (uiState.isDetailedViewOpened) viewModel.updateState(updatedIsDetailedViewOpened = false) + else navController.popBackStack() + } + Column( modifier = modifier.verticalScroll( rememberScrollState(0) diff --git a/app/src/main/java/com/doyoonkim/knutice/presentation/DetailedNoticeContent.kt b/app/src/main/java/com/doyoonkim/knutice/presentation/DetailedNoticeContent.kt index 5a76a8f..a1de5c1 100644 --- a/app/src/main/java/com/doyoonkim/knutice/presentation/DetailedNoticeContent.kt +++ b/app/src/main/java/com/doyoonkim/knutice/presentation/DetailedNoticeContent.kt @@ -10,7 +10,9 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.foundation.layout.wrapContentSize +import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Button import androidx.compose.material3.ButtonColors import androidx.compose.material3.IconButton @@ -89,13 +91,19 @@ fun DetailedNoticeContent( fontWeight = FontWeight.Normal ) - Text( + Surface( modifier = Modifier.fillMaxWidth() - .weight(8f), - text = requested.fullContent, - fontSize = 18.sp, - fontWeight = FontWeight.Medium, - ) + .weight(8f) + .verticalScroll(rememberScrollState()), + color = MaterialTheme.colorScheme.containerBackground + ) { + Text( + modifier = Modifier.fillMaxWidth(), + text = requested.fullContent, + fontSize = 18.sp, + fontWeight = FontWeight.Medium, + ) + } Button( onClick = { diff --git a/app/src/main/java/com/doyoonkim/knutice/presentation/MoreCategorizedNoticiation.kt b/app/src/main/java/com/doyoonkim/knutice/presentation/MoreCategorizedNoticiation.kt index 4e87fc0..f1de57d 100644 --- a/app/src/main/java/com/doyoonkim/knutice/presentation/MoreCategorizedNoticiation.kt +++ b/app/src/main/java/com/doyoonkim/knutice/presentation/MoreCategorizedNoticiation.kt @@ -1,6 +1,7 @@ package com.doyoonkim.knutice.presentation import android.util.Log +import androidx.activity.compose.BackHandler import androidx.compose.animation.AnimatedVisibility import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement @@ -38,7 +39,8 @@ import com.doyoonkim.knutice.viewModel.MoreCategorizedNotificationViewModel fun MoreCategorizedNotification( modifier: Modifier = Modifier, viewModel: MoreCategorizedNotificationViewModel = hiltViewModel(), - category: NoticeCategory + category: NoticeCategory, + backButtonHandler: () -> Unit = { } ) { val uiState by viewModel.uiState.collectAsStateWithLifecycle() @@ -49,6 +51,11 @@ fun MoreCategorizedNotification( } ) + BackHandler { + if (uiState.isDetailedContentVisible) viewModel.updatedDetailedContentRequest(false) + else backButtonHandler() + } + Box( modifier = modifier.fillMaxWidth() .pullRefresh(pullRefreshState) diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index c4999d7..b10222c 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -12,7 +12,9 @@ 더보기 버전정보 오픈소스 라이센스 - 1.0.0 알파 (내부테스트용) + 1.0.1 알파 (내부테스트용) 알림 설정 + 새로운 알림이 도착했어요! + 신규 공지 알림 \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 79caa34..52711f4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -11,12 +11,13 @@ About Version Open Source License - 1.0.0 Alpha + 1.0.1 Alpha Notification Preference + New Notice has been delivered! knutice_default_fcm_channel knutice default notification channel for FCM knutice_inapp_notification_channel knutice inapp notification channel - knutice inapp notification Channel + KNUTICE In-app Notice \ No newline at end of file