Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions MLS/Data/Data/Network/DTO/AlarmDTO/AlarmResponseDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public struct AlarmResponseDTO: Decodable {
}

public struct NormalContent: Decodable {
public let id: Int
public let type: String
public let title: String
public let link: String
Expand All @@ -50,13 +51,15 @@ public extension AlarmResponseDTO {
switch content {
case .normal(let normal):
return AlarmResponse(
id: normal.id,
type: normal.type,
title: normal.title,
link: normal.link,
date: normal.date
)
case .all(let all):
return AlarmResponse(
id: all.alrim.id,
type: all.alrim.type,
title: all.alrim.title,
link: all.alrim.link,
Expand All @@ -72,6 +75,7 @@ public extension AlarmResponseDTO {
switch content {
case .all(let all):
return AllAlarmResponse(
id: all.alrim.id,
type: all.alrim.type,
title: all.alrim.title,
link: all.alrim.link,
Expand Down
10 changes: 5 additions & 5 deletions MLS/Data/Data/Network/Endpoints/AlarmEndPoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public enum AlarmEndPoint {
public static func fetchPatchNotes(query: Encodable) -> ResponsableEndPoint<AlarmResponseDTO> {
.init(
baseURL: base,
path: "/api/v1/alrim/list/patch-notes",
path: "/api/v2/alrim/list/patch-notes",
method: .GET,
query: query
)
Expand All @@ -15,7 +15,7 @@ public enum AlarmEndPoint {
public static func fetchNotices(query: Encodable) -> ResponsableEndPoint<AlarmResponseDTO> {
.init(
baseURL: base,
path: "/api/v1/alrim/list/notices",
path: "/api/v2/alrim/list/notices",
method: .GET,
query: query
)
Expand All @@ -24,7 +24,7 @@ public enum AlarmEndPoint {
public static func fetchOutdatedEvents(query: Encodable) -> ResponsableEndPoint<AlarmResponseDTO> {
.init(
baseURL: base,
path: "/api/v1/alrim/list/events/outdated",
path: "/api/v2/alrim/list/events/outdated",
method: .GET,
query: query
)
Expand All @@ -33,7 +33,7 @@ public enum AlarmEndPoint {
public static func fetchOngoingEvents(query: Encodable) -> ResponsableEndPoint<AlarmResponseDTO> {
.init(
baseURL: base,
path: "/api/v1/alrim/list/events/ongoing",
path: "/api/v2/alrim/list/events/ongoing",
method: .GET,
query: query
)
Expand All @@ -42,7 +42,7 @@ public enum AlarmEndPoint {
public static func fetchAll(query: Encodable) -> ResponsableEndPoint<AlarmResponseDTO> {
.init(
baseURL: base,
path: "/api/v1/alrim/all",
path: "/api/v2/alrim/all",
method: .GET,
query: query
)
Expand Down
12 changes: 6 additions & 6 deletions MLS/Data/Data/Repository/AlarmAPIRepositoryImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@ public class AlarmAPIRepositoryImpl: AlarmAPIRepository {
self.tokenInterceptor = interceptor
}

public func fetchPatchNotes(cursor: String?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>> {
public func fetchPatchNotes(cursor: Int?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>> {
let endpoint = AlarmEndPoint.fetchPatchNotes(query: AlarmQuery(cursor: cursor, pageSize: pageSize))
return provider.requestData(endPoint: endpoint, interceptor: tokenInterceptor)
.map { $0.toAlarmDomain() }
}

public func fetchNotices(cursor: String?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>> {
public func fetchNotices(cursor: Int?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>> {
let endpoint = AlarmEndPoint.fetchNotices(query: AlarmQuery(cursor: cursor, pageSize: pageSize))
return provider.requestData(endPoint: endpoint, interceptor: tokenInterceptor)
.map { $0.toAlarmDomain() }
}

public func fetchOutdatedEvents(cursor: String?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>> {
public func fetchOutdatedEvents(cursor: Int?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>> {
let endpoint = AlarmEndPoint.fetchOutdatedEvents(query: AlarmQuery(cursor: cursor, pageSize: pageSize))
return provider.requestData(endPoint: endpoint, interceptor: tokenInterceptor)
.map { $0.toAlarmDomain() }
}

public func fetchOngoingEvents(cursor: String?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>> {
public func fetchOngoingEvents(cursor: Int?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>> {
let endpoint = AlarmEndPoint.fetchOngoingEvents(query: AlarmQuery(cursor: cursor, pageSize: pageSize))
return provider.requestData(endPoint: endpoint, interceptor: tokenInterceptor)
.map { $0.toAlarmDomain() }
}

public func fetchAll(cursor: String?, pageSize: Int) -> Observable<PagedEntity<AllAlarmResponse>> {
public func fetchAll(cursor: Int?, pageSize: Int) -> Observable<PagedEntity<AllAlarmResponse>> {
let endpoint = AlarmEndPoint.fetchAll(query: AlarmQuery(cursor: cursor, pageSize: pageSize))
return provider.requestData(endPoint: endpoint, interceptor: tokenInterceptor)
.map { $0.toAllAlarmDomain() }
Expand All @@ -52,7 +52,7 @@ public class AlarmAPIRepositoryImpl: AlarmAPIRepository {

private extension AlarmAPIRepositoryImpl {
struct AlarmQuery: Encodable {
let cursor: String?
let cursor: Int?
let pageSize: Int
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class FetchAllAlarmUseCaseImpl: FetchAllAlarmUseCase {
self.repository = repository
}

public func execute(cursor: String?, pageSize: Int) -> Observable<PagedEntity<AllAlarmResponse>> {
return repository.fetchAll(cursor: cursor, pageSize: pageSize)
public func execute(id: Int?, pageSize: Int) -> Observable<PagedEntity<AllAlarmResponse>> {
return repository.fetchAll(cursor: id, pageSize: pageSize)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class FetchNoticesUseCaseImpl: FetchNoticesUseCase {
self.repository = repository
}

public func execute(cursor: String?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>> {
return repository.fetchNotices(cursor: cursor, pageSize: pageSize)
public func execute(id: Int?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>> {
return repository.fetchNotices(cursor: id, pageSize: pageSize)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class FetchOngoingEventsUseCaseImpl: FetchOngoingEventsUseCase {
self.repository = repository
}

public func execute(cursor: String?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>> {
return repository.fetchOngoingEvents(cursor: cursor, pageSize: pageSize)
public func execute(id: Int?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>> {
return repository.fetchOngoingEvents(cursor: id, pageSize: pageSize)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class FetchOutdatedEventsUseCaseImpl: FetchOutdatedEventsUseCase {
self.repository = repository
}

public func execute(cursor: String?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>> {
return repository.fetchOutdatedEvents(cursor: cursor, pageSize: pageSize)
public func execute(id: Int?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>> {
return repository.fetchOutdatedEvents(cursor: id, pageSize: pageSize)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class FetchPatchNotesUseCaseImpl: FetchPatchNotesUseCase {
self.repository = repository
}

public func execute(cursor: String?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>> {
return repository.fetchPatchNotes(cursor: cursor, pageSize: pageSize)
public func execute(id: Int?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>> {
return repository.fetchPatchNotes(cursor: id, pageSize: pageSize)
}
}
8 changes: 6 additions & 2 deletions MLS/Domain/DomainInterface/Entity/Alarm/AlarmResponse.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import Foundation

public struct AlarmResponse: Equatable {
public let id: Int
public let type: String
public let title: String
public let link: String
public let date: String

public init(type: String, title: String, link: String, date: String) {
public init(id: Int, type: String, title: String, link: String, date: String) {
self.id = id
self.type = type
self.title = title
self.link = link
Expand All @@ -15,13 +17,15 @@ public struct AlarmResponse: Equatable {
}

public struct AllAlarmResponse: Equatable {
public let id: Int
public let type: String
public let title: String
public let link: String
public let date: String
public var alreadyRead: Bool

public init(type: String, title: String, link: String, date: String, alreadyRead: Bool) {
public init(id: Int, type: String, title: String, link: String, date: String, alreadyRead: Bool) {
self.id = id
self.type = type
self.title = title
self.link = link
Expand Down
10 changes: 5 additions & 5 deletions MLS/Domain/DomainInterface/Repository/AlarmAPIRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import Foundation
import RxSwift

public protocol AlarmAPIRepository {
func fetchPatchNotes(cursor: String?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>>
func fetchPatchNotes(cursor: Int?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>>

func fetchNotices(cursor: String?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>>
func fetchNotices(cursor: Int?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>>

func fetchOutdatedEvents(cursor: String?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>>
func fetchOutdatedEvents(cursor: Int?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>>

func fetchOngoingEvents(cursor: String?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>>
func fetchOngoingEvents(cursor: Int?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>>

func fetchAll(cursor: String?, pageSize: Int) -> Observable<PagedEntity<AllAlarmResponse>>
func fetchAll(cursor: Int?, pageSize: Int) -> Observable<PagedEntity<AllAlarmResponse>>

func setRead(alarmLink: String) -> Completable
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import RxSwift

public protocol FetchAllAlarmUseCase {
func execute(cursor: String?, pageSize: Int) -> Observable<PagedEntity<AllAlarmResponse>>
func execute(id: Int?, pageSize: Int) -> Observable<PagedEntity<AllAlarmResponse>>
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import RxSwift

public protocol FetchNoticesUseCase {
func execute(cursor: String?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>>
func execute(id: Int?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>>
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import RxSwift

public protocol FetchOngoingEventsUseCase {
func execute(cursor: String?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>>
func execute(id: Int?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>>
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import RxSwift

public protocol FetchOutdatedEventsUseCase {
func execute(cursor: String?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>>
func execute(id: Int?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>>
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import RxSwift

public protocol FetchPatchNotesUseCase {
func execute(cursor: String?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>>
func execute(id: Int?, pageSize: Int) -> Observable<PagedEntity<AlarmResponse>>
}
6 changes: 4 additions & 2 deletions MLS/MLS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,7 @@
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = W5QTRMS954;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = MLS/Resource/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "메랜사";
INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
Expand All @@ -693,7 +694,7 @@
"@executable_path/Frameworks",
);
MACH_O_TYPE = mh_execute;
MARKETING_VERSION = 3.0.2;
MARKETING_VERSION = 3.0.3;
PRODUCT_BUNDLE_IDENTIFIER = com.donggle.MLS;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -723,6 +724,7 @@
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = W5QTRMS954;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = MLS/Resource/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "메랜사";
INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
Expand All @@ -735,7 +737,7 @@
"@executable_path/Frameworks",
);
MACH_O_TYPE = mh_execute;
MARKETING_VERSION = 3.0.2;
MARKETING_VERSION = 3.0.3;
PRODUCT_BUNDLE_IDENTIFIER = com.donggle.MLS;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public final class DictionaryNotificationReactor: Reactor {

let notificationStream: Observable<Mutation> = Observable.concat([
Observable<Mutation>.just(.setLoading(true)),
fetchAllAlarmUseCase.execute(cursor: nil, pageSize: 20)
fetchAllAlarmUseCase.execute(id: nil, pageSize: 20)
.map { paged in
Mutation.setNotifications(paged.items, hasMore: paged.hasMore, reset: true)
},
Expand All @@ -78,11 +78,11 @@ public final class DictionaryNotificationReactor: Reactor {

case .loadMore:
guard currentState.hasMore, !currentState.isLoading else { return .empty() }
let cursor = currentState.notifications.last?.date
let cursor = currentState.notifications.last?.id

return Observable.concat([
Observable<Mutation>.just(.setLoading(true)),
fetchAllAlarmUseCase.execute(cursor: cursor, pageSize: 20)
fetchAllAlarmUseCase.execute(id: cursor, pageSize: 20)
.map { paged in
Mutation.setNotifications(paged.items, hasMore: paged.hasMore, reset: false)
},
Expand Down
Loading