-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 알림 단건 api 로 알림 상세 뷰 로직 수정 #555
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
Changes from all commits
2663acd
0f667b1
9605a5f
01fcadf
e937da4
5b6dcb0
874a5ce
5076a7a
df0f0d0
7ef751f
976fd2e
758f7d0
a9bc482
71c22fb
91cc1e8
d0d340c
c71ccdd
869c9b8
c57d50b
434c3f9
84bf4e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package com.into.websoso.data.model | ||
|
|
||
| import java.time.LocalDate | ||
|
|
||
| data class NotificationDetailEntity( | ||
| val notificationTitle: String, | ||
| val notificationCreatedDate: String, | ||
| val notificationDetail: String, | ||
| ) { | ||
| companion object { | ||
| val DEFAULT = NotificationDetailEntity( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. r: val인데 uppercase로 두신 이유가 궁금합니다!
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 상수라서 그렇게 두었는데 val랑 uppercase랑 연관이 있었나요?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 노란줄뜨지 않나용?! 다른 케이스로 권장한다구
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 저는 일단 안뜨네요! |
||
| notificationTitle = "웹소소 공지입니다", | ||
| notificationCreatedDate = LocalDate.now().toString(), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. c: 저희가 가공하는 날짜 형태가 LocalDate 형태가 맞나용? 아니면 서버에서 오는 데이터를 LocalDate로 다시 가공하는 로직이 어딘가에 있는데 제가 못찾고 있나요?!
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아니요 저건 프리뷰에 보이는 기본값을 오늘 날짜로 보였으면 해서 저렇게 반영했습니다 toString을 보시면 |
||
| notificationDetail = "안녕하세요, 웹소소입니다.\n" + | ||
| "\n" + | ||
| "웹소설을 애정하는 팀원들이 모여,\n" + | ||
| "‘웹소설에 푹 빠지는 곳, 웹소소’를 만들었습니다.\n" + | ||
| "\n" + | ||
| "웹소소가 여러분의 소소한 즐거움이 되면 좋겠습니다.\n" + | ||
| "함께 해주셔서 감사합니다.\n" + | ||
| "\n" + | ||
| "웹소소 드림 www.websoso.kr", | ||
| ) | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,20 @@ | ||
| package com.into.websoso.data.remote.api | ||
|
|
||
| import com.into.websoso.data.remote.response.NotificationDetailResponseDto | ||
| import com.into.websoso.data.remote.response.NotificationsResponseDto | ||
| import retrofit2.http.GET | ||
| import retrofit2.http.Path | ||
| import retrofit2.http.Query | ||
|
|
||
| interface NoticeApi { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. c: 그러면 요 api 네이밍도 NotificationApi는 어떤가요?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이건 준서가 해결할 예정입니다. |
||
|
|
||
| @GET("notifications") | ||
| suspend fun getNotices( | ||
| @Query("lastNotificationId") lastNotificationId: Long, | ||
| @Query("size") size: Int, | ||
| ): NotificationsResponseDto | ||
|
|
||
| @GET("notifications/{notificationId}") | ||
| suspend fun getNotificationDetail( | ||
| @Path("notificationId") notificationId: Long, | ||
| ): NotificationDetailResponseDto | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package com.into.websoso.data.remote.response | ||
|
|
||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class NotificationDetailResponseDto( | ||
| @SerialName("notificationTitle") | ||
| val notificationTitle: String, | ||
| @SerialName("notificationCreatedDate") | ||
| val notificationCreatedDate: String, | ||
| @SerialName("notificationDetail") | ||
| val notificationDetail: String, | ||
| ) |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| package com.into.websoso.ui.notificationDetail | ||
|
|
||
| import android.content.Context | ||
| import android.content.Intent | ||
| import android.os.Bundle | ||
| import androidx.activity.ComponentActivity | ||
| import androidx.activity.addCallback | ||
| import androidx.activity.compose.setContent | ||
| import androidx.activity.viewModels | ||
| import com.into.websoso.core.designsystem.theme.WebsosoTheme | ||
| import dagger.hilt.android.AndroidEntryPoint | ||
|
|
||
| @AndroidEntryPoint | ||
| class NotificationDetailActivity : ComponentActivity() { | ||
| private val notificationDetailViewModel: NotificationDetailViewModel by viewModels() | ||
|
|
||
| override fun onCreate(savedInstanceState: Bundle?) { | ||
| super.onCreate(savedInstanceState) | ||
| handleBackPressed() | ||
|
|
||
| setContent { | ||
| WebsosoTheme { | ||
| NotificationDetailScreen( | ||
| viewModel = notificationDetailViewModel, | ||
| onBackButtonClick = { finish() }, | ||
| ) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private fun handleBackPressed() { | ||
| onBackPressedDispatcher.addCallback(this) { | ||
| finish() | ||
| } | ||
|
Comment on lines
+32
to
+34
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. c: 이미 onBackButtonClick이 있는데 따로 두신 이유가 있으신가요?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 화면에 보여지는 Back Button이 아닌 기기 자체의 뒤로가기 기능을 위한 코드인 것 같아요
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이 부분이 없어도 뒤로가기를 하면 finish가 동작되지 않나?! 라는 생각이 들었어요!!
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 사용자 편의성 증가 목적입니다 소프트 버튼 혹은 뒤로가기 제스쳐에 반응하게 만들어준거라 |
||
| } | ||
|
|
||
| companion object { | ||
| const val NOTIFICATION_DETAIL_KEY = "NOTIFICATION_DETAIL_KEY" | ||
|
|
||
| fun getIntent( | ||
| context: Context, | ||
| notificationId: Long, | ||
| ): Intent = | ||
| Intent(context, NotificationDetailActivity::class.java).apply { | ||
| putExtra(NOTIFICATION_DETAIL_KEY, notificationId) | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| package com.into.websoso.ui.notificationDetail | ||
|
|
||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.getValue | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.lifecycle.compose.collectAsStateWithLifecycle | ||
| import com.into.websoso.core.designsystem.theme.WebsosoTheme | ||
| import com.into.websoso.data.model.NotificationDetailEntity | ||
| import com.into.websoso.ui.notice.component.NoticeAppBar | ||
| import com.into.websoso.ui.notificationDetail.component.NotificationDetailContent | ||
| import com.into.websoso.ui.notificationDetail.model.NotificationDetailUiState | ||
|
|
||
| @Composable | ||
| fun NotificationDetailScreen( | ||
| viewModel: NotificationDetailViewModel, | ||
| onBackButtonClick: () -> Unit, | ||
| modifier: Modifier = Modifier, | ||
| ) { | ||
| val uiState by viewModel.notificationDetailUiState.collectAsStateWithLifecycle() | ||
|
|
||
| Column(modifier = modifier.fillMaxSize()) { | ||
| NoticeAppBar(onBackButtonClick) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. c: 이 부분 Notification으로 제가 바꾸겠습니다! |
||
| NotificationDetailContent( | ||
| uiState = uiState, | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| @Preview(showBackground = true) | ||
| @Composable | ||
| fun NotificationDetailScreenPreview() { | ||
| val uiState = NotificationDetailUiState( | ||
| noticeDetail = NotificationDetailEntity.DEFAULT, | ||
| ) | ||
|
|
||
| WebsosoTheme { | ||
| Column(modifier = Modifier.fillMaxSize()) { | ||
| NoticeAppBar(onBackButtonClick = {}) | ||
| NotificationDetailContent( | ||
| uiState, | ||
| ) | ||
| } | ||
| } | ||
| } | ||
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.
a: 기존에 notice라 되어 있어서 저도 notice를 유지했는데 notification 좋은 것 같아요 👍