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

Refactor/#861 network view model 적용 #873

Merged
merged 100 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
56bff1e
feat: NetworkViewModel 구현
ki960213 Dec 1, 2023
061c01b
refactor : 스크랩 화면 NetworkViewModel 적용
chws0508 Dec 1, 2023
d20c051
refactor : 스크랩 화면 NetworkViewModel 적용
chws0508 Dec 1, 2023
4e2c97a
Merge remote-tracking branch 'origin/Refactor/#861-NetworkViewModel_적…
chws0508 Dec 1, 2023
1da13e2
refactor(ChildCommentViewModel): NetworkViewModel 적용
ki960213 Dec 2, 2023
38bfe43
feat(NetworkViewModel): command와 commandAndRefresh에 onStart와 onFinish…
ki960213 Dec 2, 2023
f9440e2
feat(ChildCommentViewModel): 댓글 게시 요청의 응답을 받지 않았다면 댓글을 추가적으로 보낼 수 없도록 변경
ki960213 Dec 2, 2023
b7717c8
refactor(ChildCommentActivity): NetworkActivity 적용
ki960213 Dec 2, 2023
1fe4bf1
Merge remote-tracking branch 'origin/Refactor/#861-NetworkViewModel_적…
ki960213 Dec 2, 2023
25f0070
refactor(NetworkActivity): BaseActivity 분리
ki960213 Dec 2, 2023
75b3485
feat(NetworkFragment): NetworkFragment 구현
ki960213 Dec 2, 2023
1ac8989
refactor(MyProfileViewModel): NetworkViewModel 적용
ki960213 Dec 2, 2023
a5192ef
refactor(NetworkActivity): 메서드명 오타 수정
ki960213 Dec 2, 2023
3acf57e
refactor(FeedDetailViewModel): NetworkViewModel 적용
ki960213 Dec 2, 2023
493b8cc
refactor(ChildCommentsUiState): ChildCommentsUiState 클래스 제거
ki960213 Dec 2, 2023
8574e50
feat(activity_feed_detail.xml): SwipeRefreshLayout 아이콘 색상을 primary co…
ki960213 Dec 2, 2023
2a9d64c
feat(NetworkViewModel): requestNetwork 메서드 구현
ki960213 Dec 4, 2023
05f13c4
feat(NetworkViewModel): requestNetwork 메서드의 onStart와 onFinish에 기본값 설정
ki960213 Dec 4, 2023
7d58ea4
feat(BaseActivity): onCreate에서 바인딩 객체의 생명주기 주인 설정
ki960213 Dec 4, 2023
b51baeb
refactor(ProfileViewModel): NetworkViewModel 적용
ki960213 Dec 4, 2023
b32f50b
feat(FeedDetailActivity): 다른 화면 갔다오면 새로고침하도록 변경
ki960213 Dec 4, 2023
aee573a
refactor(EditMyProfileViewModel): NetworkViewModel 적용
ki960213 Dec 5, 2023
08d4c4b
refactor(EditMyProfile): UiState, UiEvent, Activity 리팩터링
ki960213 Dec 5, 2023
aeb5778
refactor(MyCommentsUiState): 불필요한 MyCommentsUiState 클래스 제거
ki960213 Dec 5, 2023
3c72da7
fix(FeedDetailViewModel): 댓글 개수 로직 수정
ki960213 Dec 5, 2023
1bb8ce8
refactor(MemberBlockViewModel): NetworkViewModel 적용
ki960213 Dec 5, 2023
1a0eefa
refactor(ScrappedEvent): UiState 제거 및 NetworkFragment 적용
ki960213 Dec 5, 2023
c103280
refactor(FeedListViewModel): NetworkFragment 적용
ki960213 Dec 5, 2023
c6dd1ee
refactor(ScrappedEventViewModel): 새로고침 로직 리팩터링
ki960213 Dec 5, 2023
7743112
refactor(EventRecruitmentViewModel): NetworkViewModel 적용
ki960213 Dec 5, 2023
ac0b97f
refactor(RecruitmentPostDetailViewModel): NetworkViewModel 적용
ki960213 Dec 5, 2023
35ab002
refactor(RefreshableViewModel): NetworkViewModel에서 RefreshableViewMod…
ki960213 Dec 5, 2023
39389e0
refactor(RecruitmentPostWritingViewModel): NetworkViewModel 적용
ki960213 Dec 6, 2023
4401dcf
refactor(BasicTextInputWindow, SubTextInputWindow): BindingMethods를 사…
ki960213 Dec 6, 2023
fa1c0cd
feat(RecruitmentPostWritingActivity): 사용성 증가
ki960213 Dec 6, 2023
33fd2ad
Merge remote-tracking branch 'origin/android-main' into Refactor/#861…
ki960213 Dec 6, 2023
6052c98
refactor(FeedWritingViewModel): NetworkViewModel 적용
ki960213 Dec 6, 2023
febe610
refactor(RecruitmentPostWriting): 코드 리팩터링
ki960213 Dec 6, 2023
6877b59
feat(RecruitmentPostDetailActivity): 모집글 삭제 후 스낵바 띄우지 않도록 변경
ki960213 Dec 6, 2023
6da1293
refactor(EventDetailViewModel): RefreshableViewModel 적용
ki960213 Dec 6, 2023
fbc44d3
style: ktlint 적용
ki960213 Dec 6, 2023
f7936c0
refactor(NotificationsViewModel): RefreshableViewModel 적용
ki960213 Dec 7, 2023
305f1ea
refactor(SettingViewModel): RefreshableViewModel 적용
ki960213 Dec 7, 2023
6871886
refactor(NotificationConfigViewModel): RefreshableViewModel 적용
ki960213 Dec 7, 2023
099a5d2
fix(EventDetailViewModel): 행사 정보 불러올 때 로딩 바 보이도록 수정
ki960213 Dec 7, 2023
4418322
refactor(NotificationTagConfigViewModel): RefreshableViewModel 적용
ki960213 Dec 7, 2023
f909f98
fix(themes.xml): 다크 모드일 때도 툴바 스타일이 적용되도록 수정
ki960213 Dec 7, 2023
2504ed7
refactor(NetworkActivity, NetworkFragment): 데이터 불러오기가 실패할 경우 보여주는 다이얼…
ki960213 Dec 7, 2023
23edd16
refactor: 불필요한 UiState 제거
ki960213 Dec 7, 2023
cce76a2
refactor(MemberBlockActivity): 코드 리팩터링
ki960213 Dec 8, 2023
b1e9c28
refactor(ChildCommentsActivity): 코드 리팩터링
ki960213 Dec 8, 2023
1bbeec3
refactor(EditMyProfileActivity): 코드 리팩터링
ki960213 Dec 8, 2023
9df1450
refactor(EventDetailActivity): 코드 리팩터링
ki960213 Dec 8, 2023
46997a9
refactor(EventFragment): 코드 리팩터링
ki960213 Dec 8, 2023
ed325f2
refactor(FeedDetailActivity): 코드 리팩터링
ki960213 Dec 8, 2023
e418d80
refactor(FeedListFragment): 코드 리팩터링
ki960213 Dec 8, 2023
cb38a7d
refactor(MyCommentsActivity): 코드 리팩터링
ki960213 Dec 8, 2023
19cdb47
refactor(MyProfileFragment): 코드 리팩터링
ki960213 Dec 8, 2023
b1a51df
refactor(ProfileActivity): 코드 리팩터링
ki960213 Dec 8, 2023
accd75d
refactor(RecruitmentPostDetailActivity): 코드 리팩터링
ki960213 Dec 8, 2023
2e27953
refactor(RecruitmentsFragment): 코드 리팩터링
ki960213 Dec 8, 2023
b5cef55
refactor(FeedDetailActivity): 코드 리팩터링
ki960213 Dec 8, 2023
4bc3390
refactor(ScrappedEventFragment): 코드 리팩터링
ki960213 Dec 8, 2023
e1ffb0c
refactor(SettingFragment): 코드 리팩터링
ki960213 Dec 8, 2023
11c81d7
refactor(HorizontalDivider): AppCompatImageView를 상속하도록 바꾸고 클래스명 변경
ki960213 Dec 8, 2023
b72104b
refactor: 수평 구분선을 HorizontalDivider로 구현하도록 변경
ki960213 Dec 8, 2023
0d72212
refactor: 불필요한 layout 파일 제거
ki960213 Dec 8, 2023
4796711
feat(FeedListFragment): 피드 사이에만 구분선이 그려지도록 변경
ki960213 Dec 8, 2023
0d91479
feat(RecruitmentsFragment): 모집글 사이에만 구분선이 그려지도록 변경
ki960213 Dec 8, 2023
16dd2bf
feat(FeedWritingActivity): 이미지 삭제 아이콘 변경, 이미지 클릭 시 크게 보기 기능 추가, 이미지 사…
ki960213 Dec 8, 2023
e970506
feat(activity_feed_writing.xml): 레이아웃 변경
ki960213 Dec 8, 2023
7d5858b
refactor(MessageListViewModel): RefreshableViewModel 적용
ki960213 Dec 8, 2023
1cf85cc
refactor(NetworkViewModel): onStart 메서드 실행을 맨 처음으로 옮김
ki960213 Dec 8, 2023
bc14c5a
fix(FeedDetailViewModel, NotificationTagConfigViewModel): 요청 실패 시 화면 …
ki960213 Dec 8, 2023
23e0557
refactor(MessagesUiState): Message ui 상태를 변경하는 로직을 MessagesUiState로 옮김
ki960213 Dec 8, 2023
e7779f7
refactor(MessageListActivity): 코드 리팩터링
ki960213 Dec 8, 2023
fb71967
feat(MessageListActivity): 아래로 스크롤 할 수 없을 때 새로운 메세지가 오면 새 메세지 알림 뷰를 보…
ki960213 Dec 8, 2023
e7e1856
feat(MessageListActivity): MessageListActivity가 화면에 보여질 때 다른 채팅방의 메세지…
ki960213 Dec 8, 2023
ed28b73
fix(ic_all_close.xml): 원래대로 x 아이콘만 그리고 게시글 이미지 작성 화면에서 사용할 이미지 제거 아이콘…
ki960213 Dec 8, 2023
157fb5a
refactor(MessageRoomViewModel): RefreshableViewModel 적용
ki960213 Dec 8, 2023
d5903fe
feat(NetworkActivity, NetworkFragment): 알 수 없는 에러 발생 시 다이얼로그를 띄우고 화면을…
ki960213 Dec 9, 2023
8c83b33
refactor(NetworkViewModel, RefreshableViewModel): 모든 메서드의 모든 매개변수를 su…
ki960213 Dec 9, 2023
f01ae67
refactor(LoginViewModel): NetworkViewModel 적용
ki960213 Dec 9, 2023
816f861
refactor(SplashActivity): 코드 리팩터링
ki960213 Dec 9, 2023
cc89f9b
fix(img_profile_image_decoration.xml): 깨지지 않은 이미지로 변경
ki960213 Oct 31, 2023
9afc27a
refactor(BaseFragment): 생성자에서 레이아웃 리소스를 받도록 변경
ki960213 Dec 10, 2023
b8e49a7
refactor(OnboardingViewModel): RefreshableViewModel 적용
ki960213 Dec 10, 2023
57d18a5
refactor(FeedDetailActivity): ConcatAdapter 대신 멀티 뷰 타입을 사용하도록 변경
ki960213 Dec 10, 2023
a15bb50
feat(FeedDetailActivity): 피드 댓글 하이라이팅 기능 구현
ki960213 Dec 10, 2023
1f3a71f
feat(item_all_comment.xml): 댓글 메뉴 크기 늘림
ki960213 Dec 11, 2023
8aa71be
feat(MyCommentsViewModel): 댓글 작성 날짜 역순으로 정렬
ki960213 Dec 11, 2023
9a8374f
refactor(FeedDetailActivity): 메서드 위치 변경
ki960213 Dec 11, 2023
fc0928f
refactor(EventDetailViewModel): 모집글 작성했는지 확인하는 로직 리팩터링
ki960213 Dec 12, 2023
1a9b039
refactor(FeedDetailViewModel): 댓글 수정 중일 때 댓글 배경색 변화가 유지되도록 변경
ki960213 Dec 12, 2023
16603a6
refactor: RecruitmentPost -> Recruitment
ki960213 Dec 12, 2023
16f3f69
refactor(KerdyFirebaseMessagingService): 코드 리팩터링
ki960213 Dec 12, 2023
443dbb2
feat(FeedDetailViewModel): 하이라이팅 된 댓글을 다시 하이라이팅 할 수 있도록 변경
ki960213 Dec 12, 2023
1e47656
chore(proguard-rules.pro): ApiResponse 클래스를 절대 축소되지 않게 하는 게 아니라 이름이 유…
ki960213 Dec 12, 2023
6d21c67
fix(MyProfileActivity): 프로필 수정하고 오면 화면이 새로고침 되도록 변경
ki960213 Dec 12, 2023
b9b27c6
fix(SplashActivity): 플레이스토어가 설치되지 않았다면 플레이스토어로 이동하도록 수정
ki960213 Dec 12, 2023
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 android/2023-emmsale/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation

# ApiResponse 클래스 축소 및 난독화 해제하여 CallAdapter에서 retrofit2.Call<ApiResponse>를 반환하는 CallAdapter 만들 수 있도록 변경
-keep class com.emmsale.data.common.retrofit.callAdapter.ApiResponse
-keepnames class com.emmsale.data.common.retrofit.callAdapter.ApiResponse
12 changes: 7 additions & 5 deletions android/2023-emmsale/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@
</activity>
<activity android:name=".presentation.ui.myRecruitmentList.MyRecruitmentActivity" />
<activity android:name=".presentation.ui.notificationTagConfig.NotificationTagConfigActivity" />
<activity android:name=".presentation.ui.notificationList.NotificationsActivity" />
<activity android:name=".presentation.ui.myCommentList.MyCommentsActivity" />
<activity android:name=".presentation.ui.blockMemberList.MemberBlockActivity" />
<activity android:name=".presentation.ui.blockMemberList.BlockedMembersActivity" />
<activity android:name=".presentation.ui.notificationConfig.NotificationConfigActivity" />
<activity android:name=".presentation.ui.recruitmentWriting.RecruitmentPostWritingActivity" />
<activity android:name=".presentation.ui.recruitmentDetail.RecruitmentPostDetailActivity" />
<activity
android:name=".presentation.ui.recruitmentWriting.RecruitmentWritingActivity"
android:windowSoftInputMode="adjustResize" />
<activity android:name=".presentation.ui.recruitmentDetail.RecruitmentDetailActivity" />
<activity android:name=".presentation.ui.editMyProfile.EditMyProfileActivity" />
<activity android:name=".presentation.ui.profile.ProfileActivity" />
<activity android:name=".presentation.ui.notificationPageList.NotificationBoxActivity" />
<activity android:name=".presentation.ui.childCommentList.ChildCommentActivity" />
<activity android:name=".presentation.ui.childCommentList.ChildCommentsActivity" />
<activity android:name=".presentation.ui.useTerm.UseTermWebViewActivity" />
<activity android:name=".presentation.ui.conferenceFilter.ConferenceFilterActivity" />
<activity android:name=".presentation.ui.competitionFilter.CompetitionFilterActivity" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import kotlinx.serialization.Serializable
@Serializable
data class BlockedMemberResponse(
@SerialName("blockMemberId")
val id: Long,
val blockedMemberId: Long,
@SerialName("id")
val blockId: Long,
@SerialName("memberName")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class KerdyCall<T : Any>(
val apiResult = when {
!result.isSuccessful -> Failure(result.code(), result.errorBody()?.string())
responseType == Unit::class.java -> Success(Unit as T, result.headers())
result.body() == null -> Unexpected(IllegalStateException(NOT_EXIST_BODY))
result.body() == null -> Unexpected(Throwable(NOT_EXIST_BODY))
else -> Success(result.body()!!, result.headers())
}
callback.onResponse(this@KerdyCall, Response.success(apiResult))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.emmsale.data.model.BlockedMember
fun List<BlockedMemberResponse>.toData(): List<BlockedMember> = map(BlockedMemberResponse::toData)

fun BlockedMemberResponse.toData(): BlockedMember = BlockedMember(
id = id,
blockedMemberId = blockedMemberId,
memberName = memberName,
blockId = blockId,
profileImageUrl = profileImageUrl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,34 @@ import com.emmsale.data.apiModel.response.CommentTypeNotificationResponse
import com.emmsale.data.apiModel.response.EventTypeNotificationResponse
import com.emmsale.data.apiModel.response.NotificationResponse
import com.emmsale.data.apiModel.response.NotificationResponse.NotificationType
import com.emmsale.data.model.updatedNotification.ChildCommentNotification
import com.emmsale.data.model.updatedNotification.InterestEventNotification
import com.emmsale.data.model.updatedNotification.UpdatedNotification
import com.emmsale.data.model.Comment
import com.emmsale.data.model.Event
import com.emmsale.data.model.Feed
import com.emmsale.data.model.Member
import com.emmsale.data.model.notification.ChildCommentNotification
import com.emmsale.data.model.notification.InterestEventNotification
import com.emmsale.data.model.notification.Notification
import kotlinx.serialization.json.Json
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

@JvmName("NotificationResponse")
fun List<NotificationResponse>.toData(): List<UpdatedNotification> = map { it.toData() }
fun List<NotificationResponse>.toData(): List<Notification> = map { it.toData() }

fun NotificationResponse.toData(): UpdatedNotification = when (notificationType) {
fun NotificationResponse.toData(): Notification = when (notificationType) {
NotificationType.EVENT -> {
val eventNotificationInformation = Json.decodeFromString<EventTypeNotificationResponse>(
requireNotNull(extraNotificationInformation) { "이벤트 알림에 추가 정보가 없어요" },
)
InterestEventNotification(
id = notificationId,
receiverId = receiverId,
eventId = redirectId,
createdAt = createdAt.toLocalDateTime(),
isRead = isRead,
eventTitle = eventNotificationInformation.eventTitle,
event = Event(
id = redirectId,
name = eventNotificationInformation.eventTitle,
),
)
}

Expand All @@ -40,11 +46,13 @@ fun NotificationResponse.toData(): UpdatedNotification = when (notificationType)
receiverId = receiverId,
createdAt = createdAt.toLocalDateTime(),
isRead = isRead,
parentCommentId = commentNotificationInformation.parentId,
childCommentId = redirectId,
childCommentContent = commentNotificationInformation.content,
feedId = commentNotificationInformation.feedId,
commentProfileImageUrl = commentNotificationInformation.writerProfileImageUrl,
comment = Comment(
id = redirectId,
content = commentNotificationInformation.content,
parentCommentId = commentNotificationInformation.parentId,
feed = Feed(id = commentNotificationInformation.feedId),
writer = Member(profileImageUrl = commentNotificationInformation.writerProfileImageUrl),
),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.emmsale.data.model

data class BlockedMember(
val id: Long,
val blockedMemberId: Long,
val memberName: String,
val blockId: Long,
val profileImageUrl: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ data class Comment(
val updatedAt: LocalDateTime = LocalDateTime.MAX,
val isDeleted: Boolean = false,
val childComments: List<Comment> = emptyList(),
)
) {
val isUpdated: Boolean = createdAt != updatedAt
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.emmsale.data.model

data class Config(
val isNotificationReceive: Boolean,
val isFollowNotificationReceive: Boolean,
val isCommentNotificationReceive: Boolean,
val isInterestEventNotificationReceive: Boolean,
val isMessageNotificationReceive: Boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.emmsale.data.model
import java.time.LocalDateTime

data class Event(
val id: Long,
val id: Long = -1,
val name: String = "",
val informationUrl: String = "",
val organization: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ data class Feed(
val updatedAt: LocalDateTime = LocalDateTime.MAX,
) {
val titleImageUrl = imageUrls.firstOrNull()

val isUpdated = createdAt != updatedAt
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package com.emmsale.data.model
import java.time.LocalDate

data class Recruitment(
val id: Long,
val writer: Member,
val event: Event,
val content: String,
val updatedDate: LocalDate,
val id: Long = -1,
val writer: Member = Member(),
val event: Event = Event(),
val content: String = "",
val updatedDate: LocalDate = LocalDate.MAX,
)
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
package com.emmsale.data.model.updatedNotification
package com.emmsale.data.model.notification

import com.emmsale.data.model.Comment
import java.time.LocalDateTime

class ChildCommentNotification(
id: Long,
receiverId: Long,
createdAt: LocalDateTime,
isRead: Boolean,
val parentCommentId: Long,
val childCommentId: Long,
val childCommentContent: String,
val feedId: Long,
val commentProfileImageUrl: String,
) : UpdatedNotification(
val comment: Comment,
) : Notification(
id = id,
receiverId = receiverId,
createdAt = createdAt,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.emmsale.data.model.updatedNotification
package com.emmsale.data.model.notification

import com.emmsale.data.model.Event
import java.time.LocalDateTime

class InterestEventNotification(
id: Long,
receiverId: Long,
createdAt: LocalDateTime,
isRead: Boolean,
val eventId: Long,
val eventTitle: String,
) : UpdatedNotification(
val event: Event,
) : Notification(
id = id,
receiverId = receiverId,
createdAt = createdAt,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.emmsale.data.model.notification

import java.time.LocalDateTime

sealed class Notification(
val id: Long,
val receiverId: Long,
val createdAt: LocalDateTime,
val isRead: Boolean,
) {

fun read(): Notification = when (this) {
is ChildCommentNotification -> ChildCommentNotification(
id = id,
receiverId = receiverId,
createdAt = createdAt,
isRead = true,
comment = comment,
)

is InterestEventNotification -> InterestEventNotification(
id = id,
receiverId = receiverId,
createdAt = createdAt,
isRead = true,
event = event,
)
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ class DefaultConfigRepository @Inject constructor(
KEY_NOTIFICATION_RECEIVE,
DEFAULT_VALUE_NOTIFICATION_RECEIVE,
),
isFollowNotificationReceive = preference.getBoolean(
KEY_FOLLOW_NOTIFICATION_RECEIVE,
DEFAULT_VALUE_FOLLOW_NOTIFICATION_RECEIVE,
),
isCommentNotificationReceive = preference.getBoolean(
KEY_CHILD_COMMENT_NOTIFICATION_RECEIVE,
DEFAULT_VALUE_CHILD_COMMENT_NOTIFICATION_RECEIVE,
Expand All @@ -41,10 +37,6 @@ class DefaultConfigRepository @Inject constructor(
preferenceEditor.putBoolean(KEY_NOTIFICATION_RECEIVE, isReceive).commit()
}

override fun saveFollowNotificationReceiveConfig(isReceive: Boolean) {
preferenceEditor.putBoolean(KEY_FOLLOW_NOTIFICATION_RECEIVE, isReceive).commit()
}

override fun saveCommentNotificationReceiveConfig(isReceive: Boolean) {
preferenceEditor.putBoolean(KEY_CHILD_COMMENT_NOTIFICATION_RECEIVE, isReceive).commit()
}
Expand All @@ -68,9 +60,6 @@ class DefaultConfigRepository @Inject constructor(
private const val KEY_AUTO_LOGIN = "auto_login_key"
private const val DEFAULT_VALUE_AUTO_LOGIN = false

private const val KEY_FOLLOW_NOTIFICATION_RECEIVE = "follow_notification_receive_key"
private const val DEFAULT_VALUE_FOLLOW_NOTIFICATION_RECEIVE = true

private const val KEY_CHILD_COMMENT_NOTIFICATION_RECEIVE =
"child_comment_notification_receive_key"
private const val DEFAULT_VALUE_CHILD_COMMENT_NOTIFICATION_RECEIVE = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class DefaultEventRepository @Inject constructor(
)
}

override suspend fun deleteScrap(eventId: Long): ApiResponse<Unit> {
override suspend fun scrapOffEvent(eventId: Long): ApiResponse<Unit> {
return eventService.deleteScrap(eventId)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.emmsale.data.repository.concretes

import com.emmsale.data.apiModel.request.NotificationListDeleteRequest
import com.emmsale.data.apiModel.request.RecruitmentNotificationReportCreateRequest
import com.emmsale.data.apiModel.response.NotificationResponse
import com.emmsale.data.common.retrofit.callAdapter.ApiResponse
import com.emmsale.data.mapper.toData
import com.emmsale.data.model.updatedNotification.UpdatedNotification
import com.emmsale.data.model.notification.Notification
import com.emmsale.data.repository.interfaces.NotificationRepository
import com.emmsale.data.service.NotificationService
import com.emmsale.di.modules.other.IoDispatcher
Expand All @@ -18,45 +17,25 @@ class DefaultNotificationRepository @Inject constructor(
private val notificationService: NotificationService,
) : NotificationRepository {

override suspend fun updateNotificationReadStatus(
notificationId: Long,
): ApiResponse<Unit> = withContext(dispatcher) {
notificationService.updateRecruitmentNotificationReadStatus(notificationId)
}

override suspend fun getUpdatedNotifications(
override suspend fun getNotifications(
memberId: Long,
): ApiResponse<List<UpdatedNotification>> = withContext(dispatcher) {
): ApiResponse<List<Notification>> = withContext(dispatcher) {
notificationService
.getNotifications(memberId)
.map(List<NotificationResponse>::toData)
}

override suspend fun updateUpdatedNotificationReadStatus(
override suspend fun readNotification(
notificationId: Long,
): ApiResponse<Unit> = withContext(dispatcher) {
notificationService.updateNotificationReadStatus(notificationId)
notificationService.readNotification(notificationId)
}

override suspend fun deleteUpdatedNotifications(
override suspend fun deleteNotifications(
notificationIds: List<Long>,
): ApiResponse<Unit> = withContext(dispatcher) {
notificationService.deleteNotification(
NotificationListDeleteRequest(notificationIds),
)
}

override suspend fun reportRecruitmentNotification(
recruitmentNotificationId: Long,
senderId: Long,
reporterId: Long,
): ApiResponse<Unit> = withContext(dispatcher) {
notificationService.reportRecruitmentNotification(
RecruitmentNotificationReportCreateRequest.create(
recruitmentNotificationId = recruitmentNotificationId,
senderId = senderId,
reporterId = reporterId,
),
).map { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ interface ConfigRepository {

fun saveAutoLoginConfig(isAutoLogin: Boolean)

fun saveFollowNotificationReceiveConfig(isReceive: Boolean)

fun saveCommentNotificationReceiveConfig(isReceive: Boolean)

fun saveInterestEventNotificationReceiveConfig(isReceive: Boolean)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ interface EventRepository {

suspend fun scrapEvent(eventId: Long): ApiResponse<Unit>

suspend fun deleteScrap(eventId: Long): ApiResponse<Unit>
suspend fun scrapOffEvent(eventId: Long): ApiResponse<Unit>

suspend fun isScraped(eventId: Long): ApiResponse<Boolean>
}
Loading
Loading