-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fix: iOS 백그라운드가 아닐 때도 알림을 클릭하면 DB에 저장되도록 수정 * feat: 공지 알림 저장 로직을 로컬에서 서버로 마이그레이션 * feat: 공지보관함 타이틀 하단에 `공지는 최대 한 달간 보관돼요!` 문구 추가 * fix: iOS DaoModule에서 NotificationDao 의존성 제거하지 않았던 문제 해결 * chore: iOS BGTaskSchedulerPermittedIdentifiers 추가 * chore: iOS 버전 정보 추가 * chore: iOS 권한 설명 추가 * refactor: NotificationDto 프로퍼티 notificationContent를 notificationMessage로 변경 * fix: 대학 공지와 학과 공지 중복 처리 버그 수정 * feat: NoticeEntity의 id, url을 기본키(복합키)로 사용하도록 변경 * refactor: 알림 읽기 API를 호출할 때 memberId를 함께 전달하도록 변경 * refactor: 공지 DTO에서 공지 등록 시간을 제외한 Date만 받도록 변경
- Loading branch information
Showing
20 changed files
with
194 additions
and
155 deletions.
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
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
36 changes: 36 additions & 0 deletions
36
WhatCampus/composeApp/src/commonMain/kotlin/core/data/mapper/NotificationMapper.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,36 @@ | ||
package core.data.mapper | ||
|
||
import core.common.util.parse | ||
import core.data.model.NotificationDto | ||
import core.data.model.NotificationsDto | ||
import core.model.Notice | ||
import core.model.Notification | ||
import kotlinx.collections.immutable.PersistentList | ||
import kotlinx.collections.immutable.toPersistentList | ||
import kotlinx.datetime.LocalDateTime | ||
import kotlinx.datetime.format.FormatStringsInDatetimeFormats | ||
import kotlinx.datetime.format.byUnicodePattern | ||
|
||
@OptIn(FormatStringsInDatetimeFormats::class) | ||
private val notificationDateTimeFormatter = LocalDateTime.Format { | ||
byUnicodePattern("yyyyMMdd HHmmss") | ||
} | ||
|
||
internal fun NotificationsDto.toNotifications(): PersistentList<Notification> = notifications | ||
.map { it.toNotification() } | ||
.toPersistentList() | ||
|
||
private fun NotificationDto.toNotification(): Notification = Notification.NewNotice( | ||
notificationId = notificationId, | ||
content = notificationMessage, | ||
isRead = isRead, | ||
receivedDatetime = sendDateTime.parse(notificationDateTimeFormatter), | ||
notice = Notice( | ||
id = noticeId, | ||
title = noticeTitle, | ||
datetime = noticeDate.paddingTime().parse(notificationDateTimeFormatter), | ||
url = noticeUrl, | ||
), | ||
) | ||
|
||
private fun String.paddingTime(): String = "$this 000000" |
20 changes: 20 additions & 0 deletions
20
WhatCampus/composeApp/src/commonMain/kotlin/core/data/model/NotificationDto.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,20 @@ | ||
package core.data.model | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
internal data class NotificationsDto( | ||
val notifications: List<NotificationDto>, | ||
) | ||
|
||
@Serializable | ||
internal data class NotificationDto( | ||
val notificationId: Long, | ||
val notificationMessage: String, | ||
val isRead: Boolean, | ||
val sendDateTime: String, | ||
val noticeId: Long, | ||
val noticeTitle: String, | ||
val noticeDate: String, | ||
val noticeUrl: 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
25 changes: 0 additions & 25 deletions
25
WhatCampus/composeApp/src/commonMain/kotlin/core/database/dao/NotificationDao.kt
This file was deleted.
Oops, something went wrong.
8 changes: 5 additions & 3 deletions
8
WhatCampus/composeApp/src/commonMain/kotlin/core/database/entity/NoticeEntity.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
28 changes: 0 additions & 28 deletions
28
WhatCampus/composeApp/src/commonMain/kotlin/core/database/entity/NotificationEntity.kt
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
WhatCampus/composeApp/src/commonMain/kotlin/core/database/mapper/NotificationMapper.kt
This file was deleted.
Oops, something went wrong.
12 changes: 8 additions & 4 deletions
12
WhatCampus/composeApp/src/commonMain/kotlin/core/domain/repository/NotificationRepository.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 |
---|---|---|
@@ -1,17 +1,21 @@ | ||
package core.domain.repository | ||
|
||
import core.model.Notification | ||
import core.model.Response | ||
import kotlinx.collections.immutable.PersistentList | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
interface NotificationRepository { | ||
fun flowNotifications(): Flow<PersistentList<Notification>> | ||
|
||
suspend fun addNotification(notification: Notification) | ||
fun flowNotifications( | ||
userId: Long, | ||
): Flow<Response<PersistentList<Notification>>> | ||
|
||
fun flowHasNewNotification(): Flow<Boolean> | ||
|
||
suspend fun updateHasNewNotification(hasNewNotification: Boolean) | ||
|
||
suspend fun readNotification(notificationId: Long) | ||
suspend fun readNotification( | ||
userId: Long, | ||
notificationId: Long, | ||
) | ||
} |
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
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.