Skip to content

Commit

Permalink
๐Ÿ›  :: ์ปดํ”Œ๋ฆญํŠธ
Browse files Browse the repository at this point in the history
  • Loading branch information
ray3238 committed Aug 31, 2024
1 parent 2a9c905 commit 75f9198
Show file tree
Hide file tree
Showing 11 changed files with 313 additions and 1 deletion.
21 changes: 20 additions & 1 deletion Projects/Data/Sources/DI/UseCaseAssembly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public final class UseCaseAssembly: Assembly {
)
}

// Students
// Studentsz
container.register(ChangePasswordUseCase.self) { reslover in
ChangePasswordUseCase(
studentsRepository: reslover.resolve(StudentsRepository.self)!
Expand Down Expand Up @@ -228,6 +228,11 @@ public final class UseCaseAssembly: Assembly {
notificationsRepository: resolver.resolve(NotificationsRepository.self)!
)
}
<<<<<<< Updated upstream
=======
<<<<<<< Updated upstream
=======
>>>>>>> Stashed changes
container.register(SubscribeNotificationUseCase.self) { resolver in
SubscribeNotificationUseCase(
notificationsRepository: resolver.resolve(NotificationsRepository.self)!
Expand All @@ -238,5 +243,19 @@ public final class UseCaseAssembly: Assembly {
notificationsRepository: resolver.resolve(NotificationsRepository.self)!
)
}
<<<<<<< Updated upstream
=======
container.register(UnsubscribeNotificationUseCase.self) { resolver in
UnsubscribeNotificationUseCase(
notificationsRepository: resolver.resolve(NotificationsRepository.self)!
)
}
container.register(UnsubscribeAllNotificationUseCase.self) { resolver in
UnsubscribeAllNotificationUseCase(
notificationsRepository: resolver.resolve(NotificationsRepository.self)!
)
}
>>>>>>> Stashed changes
>>>>>>> Stashed changes
}
}
63 changes: 63 additions & 0 deletions Projects/Data/Sources/DataSource/API/NotificationsAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,18 @@ import Domain
public enum NotificationsAPI {
case fetchNotificationList
case patchReadNotification(id: Int)
<<<<<<< Updated upstream
case subscriptNotification(token: String, notificationType: NotificationType)
case subscriptAllNotification(token: String)
=======
<<<<<<< Updated upstream
=======
case subscriptNotification(token: String, notificationType: NotificationType)
case subscriptAllNotification(token: String)
case unsubscriptNotification(token: String, notificationType: NotificationType)
case unsubscriptAllNotification(token: String)
>>>>>>> Stashed changes
>>>>>>> Stashed changes
}

extension NotificationsAPI: JobisAPI {
Expand All @@ -23,12 +33,27 @@ extension NotificationsAPI: JobisAPI {

case let .patchReadNotification(id):
return "/\(id)"
<<<<<<< Updated upstream
=======
<<<<<<< Updated upstream
=======
>>>>>>> Stashed changes

case .subscriptNotification:
return "/topic"

case .subscriptAllNotification:
return ""
<<<<<<< Updated upstream
=======

case .unsubscriptNotification:
return "/topic"

case .unsubscriptAllNotification:
return ""
>>>>>>> Stashed changes
>>>>>>> Stashed changes
}
}

Expand All @@ -39,9 +64,21 @@ extension NotificationsAPI: JobisAPI {

case .patchReadNotification:
return .patch
<<<<<<< Updated upstream

case .subscriptNotification, .subscriptAllNotification:
return .post
=======
<<<<<<< Updated upstream
=======

case .subscriptNotification, .subscriptAllNotification:
return .post

case .unsubscriptNotification, .unsubscriptAllNotification:
return .delete
>>>>>>> Stashed changes
>>>>>>> Stashed changes
}
}

Expand All @@ -53,6 +90,11 @@ extension NotificationsAPI: JobisAPI {
// // TODO: ์ถ”ํ›„ ์ฝ์Œ์™€ ์•ˆ์ฝ์Œ ๋ถ„๊ธฐ์ฒ˜๋ฆฌ ํ•„์š”
["is_new": ""],
encoding: URLEncoding.queryString)
<<<<<<< Updated upstream
=======
<<<<<<< Updated upstream
=======
>>>>>>> Stashed changes

case let .subscriptNotification(token, notificationType):
return .requestParameters(
Expand All @@ -71,6 +113,27 @@ extension NotificationsAPI: JobisAPI {
encoding: URLEncoding.queryString
)

<<<<<<< Updated upstream
=======
case let .unsubscriptNotification(token, notificationType):
return .requestParameters(
parameters: [
"token": token,
"topic": notificationType.rawValue
],
encoding: URLEncoding.queryString
)

case let .unsubscriptAllNotification(token):
return .requestParameters(
parameters: [
"token": token
],
encoding: URLEncoding.queryString
)

>>>>>>> Stashed changes
>>>>>>> Stashed changes
default:
return .requestPlain
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,18 @@ import Domain
public protocol RemoteNotificationsDataSource {
func fetchNotificationList() -> Single<[NotificationEntity]>
func patchReadNotification(id: Int) -> Completable
<<<<<<< Updated upstream
func subscriptNotification(token: String, notificationType: NotificationType) -> Completable
func subscriptAllNotification(token: String) -> Completable
=======
<<<<<<< Updated upstream
=======
func subscriptNotification(token: String, notificationType: NotificationType) -> Completable
func subscriptAllNotification(token: String) -> Completable
func unsubscriptNotification(token: String, notificationType: NotificationType) -> Completable
func unsubscriptAllNotification(token: String) -> Completable
>>>>>>> Stashed changes
>>>>>>> Stashed changes
}

final class RemoteNotificationsDataSourceImpl: RemoteBaseDataSource<NotificationsAPI>, RemoteNotificationsDataSource {
Expand All @@ -20,14 +30,37 @@ final class RemoteNotificationsDataSourceImpl: RemoteBaseDataSource<Notification
request(.patchReadNotification(id: id))
.asCompletable()
}
<<<<<<< Updated upstream
=======
<<<<<<< Updated upstream
=======
>>>>>>> Stashed changes

func subscriptNotification(token: String, notificationType: NotificationType) -> Completable {
request(.subscriptNotification(token: token, notificationType: notificationType))
.asCompletable()
}
<<<<<<< Updated upstream

=======

>>>>>>> Stashed changes
func subscriptAllNotification(token: String) -> Completable {
request(.subscriptAllNotification(token: token))
.asCompletable()
}
<<<<<<< Updated upstream
=======

func unsubscriptNotification(token: String, notificationType: Domain.NotificationType) -> RxSwift.Completable {
request(.subscriptNotification(token: token, notificationType: notificationType))
.asCompletable()
}

func unsubscriptAllNotification(token: String) -> RxSwift.Completable {
request(.unsubscriptAllNotification(token: token))
.asCompletable()
}
>>>>>>> Stashed changes
>>>>>>> Stashed changes
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,33 @@ struct NotificationsRepositoryImpl: NotificationsRepository {
func patchReadNotification(id: Int) -> Completable {
remoteNotificationsDataSource.patchReadNotification(id: id)
}
<<<<<<< Updated upstream
=======
<<<<<<< Updated upstream
=======
>>>>>>> Stashed changes

func subscriptNotification(token: String, notificationType: NotificationType) -> Completable {
remoteNotificationsDataSource.subscriptNotification(token: token, notificationType: notificationType)
}
<<<<<<< Updated upstream

func subscriptAllNotification(token: String) -> Completable {
remoteNotificationsDataSource.subscriptAllNotification(token: token)
}
=======

func subscriptAllNotification(token: String) -> Completable {
remoteNotificationsDataSource.subscriptAllNotification(token: token)
}

func unsubscriptNotification(token: String, notificationType: NotificationType) -> Completable {
remoteNotificationsDataSource.unsubscriptNotification(token: token, notificationType: notificationType)
}

func unsubscriptAllNotification(token: String) -> Completable {
remoteNotificationsDataSource.unsubscriptAllNotification(token: token)
}
>>>>>>> Stashed changes
>>>>>>> Stashed changes
}
10 changes: 10 additions & 0 deletions Projects/Domain/Sources/Repositories/NotificationsRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ import RxSwift
public protocol NotificationsRepository {
func fetchNotificationsList() -> Single<[NotificationEntity]>
func patchReadNotification(id: Int) -> Completable
<<<<<<< Updated upstream
func subscriptNotification(token: String, notificationType: NotificationType) -> Completable
func subscriptAllNotification(token: String) -> Completable
=======
<<<<<<< Updated upstream
=======
func subscriptNotification(token: String, notificationType: NotificationType) -> Completable
func subscriptAllNotification(token: String) -> Completable
func unsubscriptNotification(token: String, notificationType: NotificationType) -> Completable
func unsubscriptAllNotification(token: String) -> Completable
>>>>>>> Stashed changes
>>>>>>> Stashed changes
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import RxSwift

public struct UnsubscribeAllNotificationUseCase {
private let notificationsRepository: NotificationsRepository

public init(notificationsRepository: NotificationsRepository) {
self.notificationsRepository = notificationsRepository
}

public func execute(token: String) -> Completable {
notificationsRepository.unsubscriptAllNotification(token: token)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import RxSwift

public struct UnsubscribeNotificationUseCase {
private let notificationsRepository: NotificationsRepository

public init(notificationsRepository: NotificationsRepository) {
self.notificationsRepository = notificationsRepository
}

public func execute(token: String, notificationType: NotificationType) -> Completable {
notificationsRepository.unsubscriptNotification(token: token, notificationType: notificationType)
}
}
18 changes: 18 additions & 0 deletions Projects/Presentation/Sources/DI/PresentationAssembly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ public final class PresentationAssembly: Assembly {
RenewalPasswordViewController(resolver.resolve(RenewalPasswordViewModel.self)!)
}

<<<<<<< Updated upstream
=======
<<<<<<< Updated upstream
=======
>>>>>>> Stashed changes
container.register(WritableReviewViewModel.self) { resolver in
WritableReviewViewModel(
postReviewUseCase: resolver.resolve(PostReviewUseCase.self)!
Expand All @@ -165,13 +170,26 @@ public final class PresentationAssembly: Assembly {
}

container.register(NotificationSettingViewModel.self) { resolver in
<<<<<<< Updated upstream
NotificationSettingViewModel()
=======
NotificationSettingViewModel(
subscribeNotificationUseCase: resolver.resolve(SubscribeNotificationUseCase.self)!,
subscribeAllNotificationUseCase: resolver.resolve(SubscribeAllNotificationUseCase.self)!,
unsubscribeNotificationUseCase: resolver.resolve(UnsubscribeNotificationUseCase.self)!,
unsubscribeAllNotificationUseCase: resolver.resolve(UnsubscribeAllNotificationUseCase.self)!
)
>>>>>>> Stashed changes
}

container.register(NotificationSettingViewController.self) { resolver in
NotificationSettingViewController(resolver.resolve(NotificationSettingViewModel.self)!)
}

<<<<<<< Updated upstream
=======
>>>>>>> Stashed changes
>>>>>>> Stashed changes
container.register(NoticeViewModel.self) { resolver in
NoticeViewModel(
fetchNoticeListUseCase: resolver.resolve(FetchNoticeListUseCase.self)!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import DesignSystem

public final class NotificationSectionView: BaseView {
public var disposeBag = DisposeBag()
<<<<<<< Updated upstream
=======
public let switchButtonIsToggle = PublishRelay<Bool>()
>>>>>>> Stashed changes

private let notificationTitleLabel = UILabel().then {
$0.setJobisText(
Expand Down Expand Up @@ -46,10 +50,17 @@ public final class NotificationSectionView: BaseView {
self.notificationSwitchButton.isOn.toggle()
if self.notificationSwitchButton.isOn {
self.notificationSwitchButton.thumbTintColor = .white
<<<<<<< Updated upstream
print("์˜จ!!")
} else {
self.notificationSwitchButton.thumbTintColor = nil
print("์˜คํ”„!!")
=======
self.switchButtonIsToggle.accept(true)
} else {
self.notificationSwitchButton.thumbTintColor = nil
self.switchButtonIsToggle.accept(false)
>>>>>>> Stashed changes
}
})
.disposed(by: disposeBag)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ public final class NotificationSettingViewController: BaseViewController<Notific

public override func addView() {
[
<<<<<<< Updated upstream
// noticeSwitchButton
=======
>>>>>>> Stashed changes
titleLabel,
allNotificationSwitchView,
lineView,
Expand Down Expand Up @@ -89,6 +92,7 @@ public final class NotificationSettingViewController: BaseViewController<Notific

public override func bind() {
let input = NotificationSettingViewModel.Input(
<<<<<<< Updated upstream

)
let ouput = viewModel.transform(input)
Expand All @@ -104,6 +108,19 @@ public final class NotificationSettingViewController: BaseViewController<Notific

public override func configureNavigation() {
// self.setLargeTitle(title: "์•Œ๋ฆผ ์„ค์ •")
=======
allSwitchButtonIsTrue: allNotificationSwitchView.switchButtonIsToggle,
noticeSwitchButtonIsTrue: noticeSwitchView.switchButtonIsToggle,
applicationSwitchButtonIsTrue: applicationSwitchView.switchButtonIsToggle,
recruitmentSwitchButtonIsTrue: recruitmentSwitchView.switchButtonIsToggle
)
let _ = viewModel.transform(input)
}

public override func configureViewController() { }

public override func configureNavigation() {
>>>>>>> Stashed changes
self.navigationController?.navigationBar.prefersLargeTitles = false
self.hideTabbar()
}
Expand Down
Loading

0 comments on commit 75f9198

Please sign in to comment.