Skip to content

Commit

Permalink
Merge pull request #196 from L-j-h-c/feature/#195-unregisteredWithdrawal
Browse files Browse the repository at this point in the history
[Feat] #195 - 미등록 비활동 유저 회원탈퇴 처리
  • Loading branch information
L-j-h-c authored Apr 20, 2023
2 parents 319dcf6 + d06320b commit 3578d6b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ public final class AppMyPageVC: UIViewController, AppMyPageViewControllable {
headerTitle: I18N.MyPage.etcSectionGroupTitle,
subviews: [
self.logoutListItem,
self.withDrawalListItem
],
frame: self.view.frame
)
Expand Down Expand Up @@ -280,7 +281,9 @@ extension AppMyPageVC {
}

self.withDrawalListItem.addTapGestureRecognizer {
let viewController = self.factory.makeWithdrawalVC().viewController
let viewController = self.factory.makeWithdrawalVC(
userType: self.userType
).viewController
self.navigationController?.pushViewController(viewController, animated: true)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// Copyright © 2023 SOPT-iOS. All rights reserved.
//

import Core

import BaseFeatureDependency

public protocol SettingViewControllable: ViewControllable { }
Expand All @@ -18,13 +20,15 @@ public protocol PrivacyPolicyViewControllable: ViewControllable { }

public protocol TermsOfServiceViewControllable: ViewControllable { }

public protocol WithdrawalViewControllable: ViewControllable { }
public protocol WithdrawalViewControllable: ViewControllable {
var userType: UserType { get set }
}

public protocol SettingFeatureViewBuildable {
func makeSettingVC() -> SettingViewControllable
func makeNicknameEditVC() -> NicknameEditViewControllable
func makeSentenceEditVC() -> SentenceEditViewControllable
func makePrivacyPolicyVC() -> PrivacyPolicyViewControllable
func makeTermsOfServiceVC() -> TermsOfServiceViewControllable
func makeWithdrawalVC() -> WithdrawalViewControllable
func makeWithdrawalVC(userType: UserType) -> WithdrawalViewControllable
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ extension SettingVC {

extension SettingVC: WithdrawButtonDelegate {
func withdrawButtonTapped() {
let withdrawalVC = factory.makeWithdrawalVC().viewController
let withdrawalVC = factory.makeWithdrawalVC(userType: .visitor).viewController
navigationController?.pushViewController(withdrawalVC, animated: true)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import UIKit
import DSKit
import SafariServices
import Combine

import Core

Expand All @@ -23,6 +24,7 @@ public class WithdrawalVC: UIViewController, WithdrawalViewControllable {
public var viewModel: WithdrawalViewModel!
public var factory: (AuthFeatureViewBuildable & AlertViewBuildable)!
private let cancelBag = CancelBag()
public var userType: UserType = .active

// MARK: - UI Components

Expand Down Expand Up @@ -119,6 +121,18 @@ extension WithdrawalVC {

let withdrawalButtonTapped = self.withdrawalButton
.publisher(for: .touchUpInside)
.withUnretained(self)
.filter({ owner, _ in
guard owner.userType != .unregisteredInactive else {
owner.showLoading()
DispatchQueue.main.asyncAfter(deadline: .now() + 0.8) {
owner.showToastAndChangeRootView()
owner.stopLoading()
}
return false
}
return true
})
.mapVoid()
.asDriver()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,14 @@ extension DIContainer: Features {
return termsOfServiceVC
}

func makeWithdrawalVC() -> WithdrawalViewControllable {
func makeWithdrawalVC(userType: UserType) -> WithdrawalViewControllable {
let withdrawalVC = WithdrawalVC()
let repository = SettingRepository(authService: authService, stampService: stampService, userService: userService)
let useCase = DefaultSettingUseCase(repository: repository)
let viewModel = WithdrawalViewModel(useCase: useCase)
withdrawalVC.viewModel = viewModel
withdrawalVC.factory = self
withdrawalVC.userType = userType
return withdrawalVC
}

Expand Down

0 comments on commit 3578d6b

Please sign in to comment.