Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
2663acd
feat: notice_detail xml 파일 삭제
librarywon Jan 20, 2025
0f667b1
refactor: notificationDetail로 엑티비티 이름 수정
librarywon Jan 20, 2025
9605a5f
feat: HyperlinkBlue 추가
librarywon Jan 20, 2025
01fcadf
feat: navigateToNoticeDetail 이름 수정
librarywon Jan 20, 2025
e937da4
refactor: headline -> headline1 이름 수정
librarywon Jan 20, 2025
5b6dcb0
refactor: NoticeDetailActivity 삭제
librarywon Jan 20, 2025
874a5ce
feat: NotificationDetail data layer 구현
librarywon Jan 20, 2025
5076a7a
feat: HyperlinkText 컴포넌트 구현
librarywon Jan 20, 2025
df0f0d0
feat: NotificationDetailResponseDto 수정
librarywon Jan 20, 2025
7ef751f
feat: NotificationDetailViewModel 구현
librarywon Jan 20, 2025
976fd2e
feat: NotificationDetailActivity 구현
librarywon Jan 20, 2025
758f7d0
feat: NotificationDetailUiState 구현
librarywon Jan 20, 2025
a9bc482
feat: NotificationDetail compose ui 구현
librarywon Jan 20, 2025
71c22fb
feat: HyperlinkText 로직 수정
librarywon Jan 20, 2025
91cc1e8
feat: NotificationDetailEntity 기본값 수정
librarywon Jan 20, 2025
d0d340c
refactor: exported false 처리
librarywon Jan 20, 2025
c71ccdd
refactor: modifier 기본 파라미터 추가
librarywon Jan 20, 2025
869c9b8
refactor: getNotificationDetail 이름 변경
librarywon Jan 20, 2025
c57d50b
refactor: NOTIFICATION ID 기본값 상수화
librarywon Jan 21, 2025
434c3f9
refactor: NotificationDetailBody -> NotificationDetailContent 이름 변경
librarywon Jan 21, 2025
84bf4e1
refactor: HyperlinkText 컴포넌트 디렉토리 위치 변경
librarywon Jan 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.noticeDetail.NoticeDetailActivity"
android:name=".ui.notificationDetail.NotificationDetailActivity"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a: 기존에 notice라 되어 있어서 저도 notice를 유지했는데 notification 좋은 것 같아요 👍

android:exported="false"
android:screenOrientation="portrait" />
<activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ val BgGradientGray = Brush.linearGradient(
start = Offset(0f, 0f),
end = Offset(0f, Float.POSITIVE_INFINITY),
)

val HyperlinkBlue = Color(0xFF0645AD)
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ val PretendardRegular = FontFamily(Font(R.font.pretendard_regular, FontWeight.No

@Stable
class WebsosoTypography internal constructor(
headline: TextStyle,
headline1: TextStyle,
title1: TextStyle,
title2: TextStyle,
title3: TextStyle,
Expand All @@ -35,7 +35,7 @@ class WebsosoTypography internal constructor(
label1: TextStyle,
label2: TextStyle,
) {
var headline: TextStyle by mutableStateOf(headline)
var headline1: TextStyle by mutableStateOf(headline1)
private set
var title1: TextStyle by mutableStateOf(title1)
private set
Expand Down Expand Up @@ -63,7 +63,7 @@ class WebsosoTypography internal constructor(
private set

fun copy(
headline: TextStyle = this.headline,
headline1: TextStyle = this.headline1,
title1: TextStyle = this.title1,
title2: TextStyle = this.title2,
title3: TextStyle = this.title3,
Expand All @@ -78,7 +78,7 @@ class WebsosoTypography internal constructor(
label2: TextStyle = this.label2,
): WebsosoTypography =
WebsosoTypography(
headline,
headline1,
title1,
title2,
title3,
Expand All @@ -94,7 +94,7 @@ class WebsosoTypography internal constructor(
)

fun update(other: WebsosoTypography) {
headline = other.headline
headline1 = other.headline1
title1 = other.title1
title2 = other.title2
title3 = other.title3
Expand Down Expand Up @@ -128,7 +128,7 @@ fun websosoTypography(): WebsosoTypography {
)

return WebsosoTypography(
headline = textStyle(PretendardBold, FontWeight.Bold, 20.dp, 28.dp),
headline1 = textStyle(PretendardBold, FontWeight.Bold, 20.dp, 28.dp),
title1 = textStyle(PretendardBold, FontWeight.Bold, 18.dp, 25.dp),
title2 = textStyle(PretendardSemiBold, FontWeight.SemiBold, 16.dp, 22.dp),
title3 = textStyle(PretendardMedium, FontWeight.Medium, 14.dp, 14.dp),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.into.websoso.data.mapper

import com.into.websoso.data.model.NotificationDetailEntity
import com.into.websoso.data.model.NotificationEntity
import com.into.websoso.data.model.NotificationsEntity
import com.into.websoso.data.remote.response.NotificationDetailResponseDto
import com.into.websoso.data.remote.response.NotificationsResponseDto

fun NotificationsResponseDto.toData(): NotificationsEntity =
Expand All @@ -20,3 +22,10 @@ fun NotificationsResponseDto.toData(): NotificationsEntity =
)
},
)

fun NotificationDetailResponseDto.toData(): NotificationDetailEntity =
NotificationDetailEntity(
notificationTitle = notificationTitle,
notificationCreatedDate = notificationCreatedDate,
notificationDetail = notificationDetail,
)
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(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r: val인데 uppercase로 두신 이유가 궁금합니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

상수라서 그렇게 두었는데 val랑 uppercase랑 연관이 있었나요?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

노란줄뜨지 않나용?! 다른 케이스로 권장한다구

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 일단 안뜨네요!

notificationTitle = "웹소소 공지입니다",
notificationCreatedDate = LocalDate.now().toString(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c: 저희가 가공하는 날짜 형태가 LocalDate 형태가 맞나용? 아니면 서버에서 오는 데이터를 LocalDate로 다시 가공하는 로직이 어딘가에 있는데 제가 못찾고 있나요?!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아니요 저건 프리뷰에 보이는 기본값을 오늘 날짜로 보였으면 해서 저렇게 반영했습니다 toString을 보시면 String 타입인걸 아실 수 있어요

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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c: 그러면 요 api 네이밍도 NotificationApi는 어떤가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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,
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.into.websoso.data.repository

import com.into.websoso.data.mapper.toData
import com.into.websoso.data.model.NotificationDetailEntity
import com.into.websoso.data.model.NotificationsEntity
import com.into.websoso.data.remote.api.NoticeApi
import javax.inject.Inject
Expand All @@ -14,4 +15,7 @@ class NoticeRepository
lastNotificationId: Long,
size: Int,
): NotificationsEntity = noticeApi.getNotices(lastNotificationId, size).toData()

suspend fun fetchNotificationDetail(notificationId: Long): NotificationDetailEntity =
noticeApi.getNotificationDetail(notificationId).toData()
}
10 changes: 5 additions & 5 deletions app/src/main/java/com/into/websoso/ui/notice/NoticeActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import androidx.activity.viewModels
import com.into.websoso.core.designsystem.theme.WebsosoTheme
import com.into.websoso.domain.model.Notice
import com.into.websoso.ui.feedDetail.FeedDetailActivity
import com.into.websoso.ui.noticeDetail.NoticeDetailActivity
import com.into.websoso.ui.notificationDetail.NotificationDetailActivity
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
Expand All @@ -23,17 +23,17 @@ class NoticeActivity : ComponentActivity() {
WebsosoTheme {
NoticeScreen(
viewModel = noticeViewModel,
onNoticeDetailClick = ::navigateToNoticeDetail,
onNoticeDetailClick = ::navigateToNotificationDetail,
onFeedDetailClick = ::navigateToFeedDetail,
onBackButtonClick = { finish() },
)
}
}
}

private fun navigateToNoticeDetail(notice: Notice) {
noticeViewModel.updateReadNotice(notice.id)
startActivity(NoticeDetailActivity.getIntent(this, notice.intrinsicId))
private fun navigateToNotificationDetail(notification: Notice) {
noticeViewModel.updateReadNotice(notification.id)
startActivity(NotificationDetailActivity.getIntent(this, notification.intrinsicId))
}

private fun navigateToFeedDetail(notice: Notice) {
Expand Down

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c: 이미 onBackButtonClick이 있는데 따로 두신 이유가 있으신가요?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

화면에 보여지는 Back Button이 아닌 기기 자체의 뒤로가기 기능을 위한 코드인 것 같아요

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분이 없어도 뒤로가기를 하면 finish가 동작되지 않나?! 라는 생각이 들었어요!!

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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)
Copy link
Member

Choose a reason for hiding this comment

The 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,
)
}
}
}
Loading
Loading