Skip to content

Commit

Permalink
Merge pull request #206 from lsj8706/feat/#202-1차QA-UI반영
Browse files Browse the repository at this point in the history
[Feat] #202 - 1차 QA UI반영
  • Loading branch information
lsj8706 authored Apr 24, 2023
2 parents ac27a3c + 995c72f commit c0f67a7
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class MainVC: UIViewController, MainViewControllable {
public var factory: factoryType!
private var cancelBag = CancelBag()

private var requestUserInfo = CurrentValueSubject<Void, Never>(())
private var requestUserInfo = PassthroughSubject<Void, Never>()

// MARK: - UI Components

Expand All @@ -66,6 +66,11 @@ public class MainVC: UIViewController, MainViewControllable {
self.setDelegate()
self.registerCells()
}

public override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.requestUserInfo.send(())
}
}

// MARK: - UI & Layout
Expand All @@ -74,10 +79,6 @@ extension MainVC {
private func setUI() {
self.navigationController?.isNavigationBarHidden = true
view.backgroundColor = DSKitAsset.Colors.black100.color

if viewModel.userType == .visitor {
self.naviBar.setRightButtonImage(image: DSKitAsset.Assets.btnLogout.image)
}
}

private func setLayout() {
Expand Down Expand Up @@ -127,6 +128,11 @@ extension MainVC {
self?.presentPlaygroundRegisterationAlertVC()
}
}.store(in: self.cancelBag)

output.isLoading
.sink { [weak self] isLoading in
isLoading ? self?.showLoading() : self?.stopLoading()
}.store(in: self.cancelBag)
}

private func bindViews() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class MainViewModel: ViewModelType {
// MARK: - Inputs

public struct Input {
let requestUserInfo: CurrentValueSubject<Void, Never>
let requestUserInfo: PassthroughSubject<Void, Never>
}

// MARK: - Outputs
Expand All @@ -37,6 +37,7 @@ public class MainViewModel: ViewModelType {
var getUserMainInfoDidComplete = PassthroughSubject<Void, Never>()
var isServiceAvailable = PassthroughSubject<Bool, Never>()
var needPlaygroundProfileRegistration = PassthroughSubject<Bool, Never>()
var isLoading = PassthroughSubject<Bool, Never>()
}

// MARK: - init
Expand All @@ -57,6 +58,7 @@ extension MainViewModel {

input.requestUserInfo
.sink { [weak self] _ in
output.isLoading.send(true)
guard let self = self else { return }
if self.userType != .visitor {
self.useCase.getUserMainInfo()
Expand All @@ -70,6 +72,7 @@ extension MainViewModel {
private func bindOutput(output: Output, cancelBag: CancelBag) {
useCase.userMainInfo.asDriver()
.sink { [weak self] userMainInfo in
output.isLoading.send(false)
guard let self = self else { return }
self.userMainInfo = userMainInfo
self.userType = userMainInfo?.userType ?? .unregisteredInactive
Expand All @@ -82,6 +85,7 @@ extension MainViewModel {

useCase.serviceState.asDriver()
.sink { serviceState in
output.isLoading.send(false)
output.isServiceAvailable.send(serviceState.isAvailable)
}.store(in: self.cancelBag)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public class SentenceEditVC: UIViewController, SentenceEditViewControllable {
tv.setTypoStyle(DSKitFontFamily.Suit.medium.font(size: 16))
tv.layer.cornerRadius = 9.adjustedH
tv.layer.borderWidth = 1.adjustedH
tv.layer.borderColor = DSKitAsset.Colors.purple100.color.cgColor
tv.isEditable = true
tv.textContainerInset = UIEdgeInsets(top: 13, left: 16, bottom: 13, right: 16)
tv.delegate = self
Expand Down Expand Up @@ -155,8 +154,17 @@ extension SentenceEditVC {

extension SentenceEditVC: UITextViewDelegate {
public func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
guard text != "\n" else { return false }
guard let str = textView.text else { return true }
let newLength = str.count + text.count - range.length
return newLength <= 42
}

public func textViewDidBeginEditing(_ textView: UITextView) {
textView.layer.borderColor = DSKitAsset.Colors.purple100.color.cgColor
}

public func textViewDidEndEditing(_ textView: UITextView) {
textView.layer.borderColor = nil
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public class NoticePopUpVC: UIViewController, NoticePopUpViewControllable {
attributes: [.font: UIFont.SoptampFont.caption3,
.foregroundColor: DSKitAsset.Colors.white.color]),
for: .normal)
$0.titleLabel?.adjustsFontSizeToFitWidth = true
}

private let updateButton = UIButton(type: .custom).then {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class StampGuideVC: UIViewController, StampGuideViewControllable {
collectionView.isScrollEnabled = true
collectionView.isPagingEnabled = true
collectionView.showsHorizontalScrollIndicator = false
collectionView.backgroundColor = .clear
return collectionView
}()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ extension STNavigationBar {
titleButton.setImage(DSKitAsset.Assets.icDownArrow.image, for: .normal)
titleButton.setTitleColor(.black, for: .normal)
titleButton.semanticContentAttribute = .forceRightToLeft
titleButton.titleLabel?.adjustsFontSizeToFitWidth = true
case .titleWithLeftButton:
rightButton.isHidden = true
leftButton.setImage(UIImage(asset: DSKitAsset.Assets.icArrow), for: .normal)
Expand Down

0 comments on commit c0f67a7

Please sign in to comment.