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

Feature/deeplink #108

Merged
merged 8 commits into from
Aug 8, 2023
4 changes: 0 additions & 4 deletions App/Sources/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ private extension AppDelegate {
print("πŸ€– FCM registration token: \(token)")
}
}

Messaging.messaging().subscribe(toTopic: "MOIT-80") { error in
print("πŸ€– error", error)
}
}

func configure(_ application: UIApplication) {
Expand Down
3 changes: 0 additions & 3 deletions App/Sources/Workflow/FineWorkflow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ final class FineWorkflow: Workflow<RootActionableItem> {
guard let self else { return .empty() }
return listActionableItem.routeToDetail(id: self.moitID)
})
.onStep { [weak self] detailActionableItem, _ -> Observable<(FineActionableItem, ())> in
return detailActionableItem.routeToFine()
}
.onStep({ [weak self] fineActionableItem, _ -> Observable<(AuthorizePaymentActionableItem, ())> in
guard let self else { return .empty() }
return fineActionableItem.routeToAuthorizePayment(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public final class FineListBuilder: Builder<FineListDependency>, FineListBuildab
public func build(
withListener listener: FineListListener,
moitID: Int
) -> (router: ViewableRouting, actionableItem: FineActionableItem) {
) -> ViewableRouting {
let component = FineListComponent(
dependency: dependency,
moitID: moitID
Expand All @@ -61,10 +61,9 @@ public final class FineListBuilder: Builder<FineListDependency>, FineListBuildab

let authorizePaymentBuildable = AuthorizePaymentBuilder(dependency: component)
let router = FineListRouter(
authorizePaymentBuildable: authorizePaymentBuildable,
interactor: interactor,
viewController: viewController
)
return (router, interactor)
return router
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ import ResourceKit
import MOITFoundation

protocol FineListRouting: ViewableRouting {
@discardableResult
func attachAuthorizePayment(moitID: Int, fineID: Int, isMaster: Bool) -> AuthorizePaymentActionableItem?
func detachAuthorizePayment(completion: (() -> Void)?)
}

protocol FineListPresentable: Presentable {
Expand Down Expand Up @@ -274,17 +271,3 @@ extension FineListInteractor {
}
}
}

// MARK: - FineActionableItem

extension FineListInteractor: FineActionableItem {
func routeToAuthorizePayment(moitID: String, fineID: String) -> Observable<(AuthorizePaymentActionableItem, ())> {
if let actionableItem = self.router?.attachAuthorizePayment(
moitID: Int(moitID) ?? 0,
fineID: Int(fineID) ?? 0,
isMaster: isMaster
) {
return Observable.just((actionableItem, ()))
} else { fatalError() }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,51 +19,11 @@ protocol FineListViewControllable: ViewControllable { }

final class FineListRouter: ViewableRouter<FineListInteractable, FineListViewControllable>, FineListRouting {

private let authorizePaymentBuildable: AuthorizePaymentBuildable
private var authorizePaymentRouters: [ViewableRouting] = []

init(
authorizePaymentBuildable: AuthorizePaymentBuildable,
override init(
interactor: FineListInteractable,
viewController: FineListViewControllable
) {
self.authorizePaymentBuildable = authorizePaymentBuildable
super.init(interactor: interactor, viewController: viewController)
interactor.router = self
}

@discardableResult
func attachAuthorizePayment(
moitID: Int,
fineID: Int,
isMaster: Bool
) -> AuthorizePaymentActionableItem? {
let (router, interactor) = authorizePaymentBuildable.build(
withListener: interactor,
moitID: moitID,
fineID: fineID,
isMaster: isMaster
)
let viewController = router.viewControllable.uiviewController
viewController.modalPresentationStyle = .fullScreen
viewControllable.uiviewController.present(viewController, animated: true)

authorizePaymentRouters.append(router)
attachChild(router)
return interactor
}

func detachAuthorizePayment(completion: (() -> Void)?) {
guard let router = authorizePaymentRouters.popLast() else { return }

viewControllable.uiviewController.dismiss(
animated: true,
completion: {
if let completion {
completion()
}
}
)
detachChild(router)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ public protocol FineListBuildable: Buildable {
func build(
withListener listener: FineListListener,
moitID: Int
) -> (router: ViewableRouting, actionableItem: FineActionableItem)
) -> ViewableRouting
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,6 @@ final class MOITAlarmViewController: UIViewController,
private let disposeBag = DisposeBag()

private var items: [MOITAlarmCollectionViewCellItem] = [
// MOITAlarmCollectionViewCellItem(isRead: true, title: "μΌλ²ˆμ•Œλ¦Ό", description: "μΌλ²ˆμ•Œλ¦Όλ―Έμ΄μ΄λŒœfealfijaelfieajhlfiajflieglaigjaleigaeligalghelighagleiglaihgeilhgleiλŸ¬λ―Έλž΄λ”γ…£λž΄γ…“γ…λž΄γ…£γ„·γ…λ„ˆλ¦¬λ¨€γ…“λž΄γ…£γ„·λŸ¬λ―Έγ…‘γ„·λŸ¬λ―Έγ…‘λŸΌλ””γ…‘λŸΌλ””μ΄μ΄μ΄μ΄μ΄μ΄μ΄", urlScheme: ""),
// MOITAlarmCollectionViewCellItem(isRead: false, title: "μΌλ²ˆμ•Œλ¦Ό", description: "μΌλ²ˆμ•Œλ¦Όλ―Έμ΄μ΄μ΄μ΄μ΄μ΄μ΄μ΄μ΄", urlScheme: ""),
// MOITAlarmCollectionViewCellItem(isRead: true, title: "μΌλ²ˆμ•Œλ¦Ό", description: "μΌλ²ˆμ•Œλ¦Όλ―Έμ΄μ΄μ΄μ΄μ΄μ΄μ΄μ΄μ΄", urlScheme: ""),
// MOITAlarmCollectionViewCellItem(isRead: false, title: "μΌλ²ˆμ•Œλ¦Ό", description: "μΌλ²ˆμ•Œλ¦Όλ―Έμ΄μ΄μ΄μ΄μ΄μ΄μ΄μ΄μ΄", urlScheme: ""),
// MOITAlarmCollectionViewCellItem(isRead: true, title: "μΌλ²ˆμ•Œλ¦Ό", description: "μΌλ²ˆμ•Œλ¦Όλ―Έμ΄μ΄μ΄μ΄μ΄μ΄μ΄μ΄μ΄", urlScheme: ""),
// MOITAlarmCollectionViewCellItem(isRead: false, title: "μΌλ²ˆμ•Œλ¦Ό", description: "μΌλ²ˆμ•Œλ¦Όλ―Έμ΄μ΄μ΄μ΄μ΄μ΄μ΄μ΄μ΄", urlScheme: ""),
// MOITAlarmCollectionViewCellItem(isRead: true, title: "μΌλ²ˆμ•Œλ¦Ό", description: "μΌλ²ˆμ•Œλ¦Όλ―Έμ΄μ΄μ΄μ΄μ΄μ΄μ΄μ΄μ΄", urlScheme: ""),
// MOITAlarmCollectionViewCellItem(isRead: false, title: "μΌλ²ˆμ•Œλ¦Ό", description: "μΌλ²ˆμ•Œλ¦Όλ―Έμ΄μ΄μ΄μ΄μ΄μ΄μ΄μ΄μ΄", urlScheme: ""),
// MOITAlarmCollectionViewCellItem(isRead: true, title: "μΌλ²ˆμ•Œλ¦Ό", description: "μΌλ²ˆμ•Œλ¦Όλ―Έμ΄μ΄μ΄μ΄μ΄μ΄μ΄μ΄μ΄", urlScheme: ""),
// MOITAlarmCollectionViewCellItem(isRead: false, title: "μΌλ²ˆμ•Œλ¦Ό", description: "μΌλ²ˆμ•Œλ¦Όλ―Έμ΄μ΄μ΄μ΄μ΄μ΄μ΄μ΄μ΄", urlScheme: ""),
// MOITAlarmCollectionViewCellItem(isRead: true, title: "μΌλ²ˆμ•Œλ¦Ό", description: "μΌλ²ˆμ•Œλ¦Όλ―Έμ΄μ΄μ΄μ΄μ΄μ΄μ΄μ΄μ΄", urlScheme: ""),
// MOITAlarmCollectionViewCellItem(isRead: false, title: "μΌλ²ˆμ•Œλ¦Ό", description: "μΌλ²ˆμ•Œλ¦Όλ―Έμ΄μ΄μ΄μ΄μ΄μ΄μ΄μ΄μ΄", urlScheme: "")
]
weak var listener: MOITAlarmPresentableListener?

Expand Down
1 change: 1 addition & 0 deletions Features/MOITAlarm/MOITAlarm/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ let project = Project.invertedDualTargetProjectWithDemoApp(
.ResourceKit,
.DesignSystem,
.Core.MOITFoundation,
.Core.Utils
],
isUserInterface: true
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

import Foundation

import MOITNetwork

import RxSwift

public protocol MOITAlarmRepository {
Expand Down
2 changes: 2 additions & 0 deletions Features/MOITAlarm/MOITAlarmData/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import UtilityPlugin
let project = Project.invertedDualTargetProject(
name: "MOITAlarmData",
interfaceDependencies: [
.ThirdParty.RxSwift
],
implementDependencies: [
.MOITNetwork.Interface
]
)

2 changes: 2 additions & 0 deletions Features/MOITAlarm/MOITAlarmDomain/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import UtilityPlugin
let project = Project.invertedDualTargetProject(
name: "MOITAlarmDomain",
interfaceDependencies: [
.ThirdParty.RxSwift,
],
implementDependencies: [
.ThirdParty.RxSwift,
]
)

Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@ import FineDomain

protocol MOITDetailRouting: ViewableRouting {
func attachAttendance(moitID: String)

func attachMOITUsers(moitID: String)
func detachMOITUsers(withPop: Bool)

func attachMOITShare(code: String)
func detachMOITShare()
func attachFineList(moitID: Int)
func attachAuthorizePayment(moitID: Int, fineID: Int, isMaster: Bool)
func detachAuthorizePayment(completion: (() -> Void)?, withPop: Bool)

@discardableResult
func attachFineList(moitID: Int) -> FineActionableItem?
func attachAuthorizePayment(moitID: Int, fineID: Int, isMaster: Bool) -> AuthorizePaymentActionableItem?
func detachAuthorizePayment(completion: (() -> Void)?, withPop: Bool)

func attachFineList(moitID: Int)
}

protocol MOITDetailPresentable: Presentable {
Expand Down Expand Up @@ -81,6 +84,7 @@ final class MOITDetailInteractor: PresentableInteractor<MOITDetailPresentable>,
private let isMasterUsecase: CompareUserIDUseCase
private let moitID: String
private let isMasterRelay: PublishRelay<Bool>
private var isMaster: Bool = false

private var scheduleDescription: String?
private var longRuleDescription: String?
Expand Down Expand Up @@ -123,7 +127,9 @@ final class MOITDetailInteractor: PresentableInteractor<MOITDetailPresentable>,
self.shortRuleDescription = $0.ruleShortDescription
self.periodDescription = $0.periodDescription
self.invitationCode = $0.invitationCode

let isMaster = self.isMasterUsecase.execute(with: Int($0.masterID) ?? 0)
self.isMaster = isMaster
self.isMasterRelay.accept(isMaster)
})
.observe(on: MainScheduler.instance)
Expand Down Expand Up @@ -323,8 +329,12 @@ extension MOITDetailInteractor {

// MARK: - MOITDetailActionableItem
extension MOITDetailInteractor: MOITDetailActionableItem {
func routeToFine() -> Observable<(FineActionableItem, ())> {
if let actionableItem = self.router?.attachFineList(moitID: Int(self.moitID) ?? 0) {
func routeToAuthorizePayment(moitID: String, fineID: String) -> Observable<(AuthorizePaymentActionableItem, ())> {
if let actionableItem = self.router?.attachAuthorizePayment(
moitID: Int(moitID) ?? 0,
fineID: Int(fineID) ?? 0,
isMaster: self.isMaster
) {
return Observable.just((actionableItem, ()))
} else { fatalError() }
}
Expand Down
48 changes: 14 additions & 34 deletions Features/MOITDetail/MOITDetail/Implement/MOITDetailRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,68 +109,48 @@ final class MOITDetailRouter: ViewableRouter<MOITDetailInteractable, MOITDetailV
self.viewController.uiviewController.dismiss(animated: true)
}

// MARK: - FineList

private let fineListBuilder: FineListBuildable
private var fineListRouter: ViewableRouting?

private let fineListBuilder: FineListBuildable
private var fineListRouter: ViewableRouting?

func attachFineList(moitID: Int) {
guard fineListRouter == nil else { return }
let (router, interactor) = fineListBuilder.build(
withListener: interactor,
moitID: moitID
)
fineActionableItem = interactor
fineListRouter = router
attachChild(router)
viewController.addChild(viewController: router.viewControllable)
return interactor
}

private var fineActionableItem: FineActionableItem?
@discardableResult
func attachFineList(moitID: Int) -> FineActionableItem? {
guard fineListRouter == nil else { return self.fineActionableItem }
guard fineListRouter == nil else { return }

let (router, interactor) = fineListBuilder.build(
let router = fineListBuilder.build(
withListener: interactor,
moitID: moitID
)
fineActionableItem = interactor
fineListRouter = router
attachChild(router)
viewController.addChild(viewController: router.viewControllable)
return interactor
}

// MARK: - AuthorizePayment

private let authorizePaymentBuilder: AuthorizePaymentBuildable
private var authorizePaymentRouter: ViewableRouting?

private var authorizePaymentRouters: [ViewableRouting] = []

@discardableResult
func attachAuthorizePayment(
moitID: Int,
fineID: Int,
isMaster: Bool
) {
if authorizePaymentRouter != nil { return }

let router = authorizePaymentBuilder.build(
) -> AuthorizePaymentActionableItem? {
let (router, interactor) = authorizePaymentBuilder.build(
withListener: interactor,
moitID: moitID,
fineID: fineID,
isMaster: isMaster
)
authorizePaymentRouter = router
authorizePaymentRouters.append(router)
attachChild(router)

self.viewController.uiviewController.navigationController?.pushViewController(router.viewControllable.uiviewController, animated: true)
return interactor
}

func detachAuthorizePayment(completion: (() -> Void)?, withPop: Bool) {
guard let router = authorizePaymentRouter else { return }
guard let router = authorizePaymentRouters.popLast() else { return }

authorizePaymentRouter = nil
detachChild(router)

if withPop {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ import FineUserInterface
import RxSwift

public protocol MOITDetailActionableItem: AnyObject {
func routeToFine() -> Observable<(FineActionableItem, ())>
func routeToAuthorizePayment(moitID: String, fineID: String) -> Observable<(AuthorizePaymentActionableItem, ())>
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
// Copyright Β© 2023 chansoo.MOIT. All rights reserved.
//

import UIKit

import MOITListUserInterface
import Utils
import RIBs
import MOITWeb
import MOITDetail
import MOITParticipateUserInterface
import MOITSetting
import MOITAlarm
import Utils

import Foundation
import RIBs

protocol MOITListInteractable: Interactable,
Expand Down Expand Up @@ -75,6 +75,7 @@ final class MOITListRouter: ViewableRouter<MOITListInteractable, MOITListViewCon
viewController.uiviewController.navigationController?.popViewController(animated: true)
}
}

private func getKeyboardHeight() -> CGFloat {
guard let height = UserDefaults.standard.object(forKey: "keyboardHeight") as? CGFloat else {
return 301
Expand Down Expand Up @@ -176,17 +177,7 @@ final class MOITListRouter: ViewableRouter<MOITListInteractable, MOITListViewCon
settingRouter = router
attachChild(router)
viewController.uiviewController.navigationController?.pushViewController(router.viewControllable.uiviewController, animated: true)

// μ„œμ˜μ΄ μ›Ήλ·° ν…ŒμŠ€νŠΈμš© ><
// guard moitWebRouter == nil else { return }
// let router = moitWebBuilder.build(
// withListener: interactor,
// domain: .frontend,
// path: .attendance(keyboardHeight: getKeyboardHeight())
// )
// self.moitWebRouter = router
// attachChild(router)
// viewController.uiviewController.navigationController?.pushViewController(router.viewControllable.uiviewController, animated: true)

}
func detachSetting(withPop: Bool) {
guard let settingRouter else { return }
Expand All @@ -195,14 +186,6 @@ final class MOITListRouter: ViewableRouter<MOITListInteractable, MOITListViewCon
if withPop {
viewController.uiviewController.navigationController?.popViewController(animated: true)
}

// μ„œμ˜μ΄ μ›Ήλ·° ν…ŒμŠ€νŠΈμš© ><
// guard let moitWebRouter else { return }
// self.moitWebRouter = nil
// detachChild(moitWebRouter)
// if withPop {
// viewController.uiviewController.navigationController?.popViewController(animated: true)
// }
}

private let alarmBuilder: MOITAlarmBuildable
Expand Down
Loading
Loading