Skip to content

Commit

Permalink
[Feat] sopt-makers#179 - 플그 프로필 등록 Alert 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
lsj8706 committed Apr 18, 2023
1 parent 22dc16b commit f396d3f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
4 changes: 2 additions & 2 deletions SOPT-iOS/Projects/Core/Sources/Enum/UserType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import Foundation

public enum UserType: String {
case visitor = "VISITOR" // 비회원
case visitor = "UNAUTHENTICATED" // 비회원
case active = "ACTIVE" // 활동 회원
case inactive = "INACTIVE" // 비활동 회원
case unregisteredInactive // 비활동 회원 + 플그 프로필 미등록
case unregisteredInactive = "UNREGISTERED" // 비활동 회원 + 플그 프로필 미등록

public func makeDescription(recentHistory: Int) -> String {
switch self {
Expand Down
2 changes: 2 additions & 0 deletions SOPT-iOS/Projects/Core/Sources/Literals/StringLiterals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ public struct I18N {
public static let encourage = "안녕하세요, \nSOPT의 열정이 되어주세요!"
public static let hello = "안녕하세요"
public static let welcome = "안녕하세요, \nSOPT에 오신 것을 환영합니다!"
public static let failedToGetUserInfo = "활동 정보를 가져올 수 없어요."
public static let needToRegisterPlayground = "플레이그라운드에서 프로필을 업데이트하면\n 서비스를 원활하게 사용할 수 있어요."

public static func userHistory(name: String, months: String) -> String {
return "\(name) 님은 \nSOPT와 \(months)개월째"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,19 @@ extension MainVC {
}
self?.collectionView.reloadData()
}.store(in: self.cancelBag)

output.isServiceAvailable
.sink { isServiceAvailable in
print("현재 앱 서비스 사용 가능(심사 X)?: \(isServiceAvailable)")
}.store(in: self.cancelBag)

// 플그 프로필 미등록 유저 알림
output.needPlaygroundProfileRegistration
.sink { [weak self] needRegistration in
if needRegistration {
self?.presentPlaygroundRegisterationAlertVC()
}
}.store(in: self.cancelBag)
}

private func bindViews() {
Expand Down Expand Up @@ -174,6 +182,19 @@ extension MainVC {

self.present(networkAlertVC, animated: false)
}

private func presentPlaygroundRegisterationAlertVC() {
let alertVC = self.factory.makeAlertVC(
type: .networkErr,
theme: .main,
title: I18N.Main.failedToGetUserInfo,
description: I18N.Main.needToRegisterPlayground,
customButtonTitle: "",
customAction: nil)
.viewController

self.present(alertVC, animated: false)
}
}

// MARK: - UICollectionViewDelegate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,12 @@ extension MainViewModel {
private func bindOutput(output: Output, cancelBag: CancelBag) {
useCase.userMainInfo.asDriver()
.sink { [weak self] userMainInfo in
self?.userMainInfo = userMainInfo
self?.userType = userMainInfo?.userType ?? .unregisteredInactive
guard let self = self else { return }
self.userMainInfo = userMainInfo
self.userType = userMainInfo?.userType ?? .unregisteredInactive
self.setServiceList(with: self.userType)
output.getUserMainInfoDidComplete.send()
if self?.userType == .unregisteredInactive {
if self.userType == .unregisteredInactive {
output.needPlaygroundProfileRegistration.send(true)
}
}.store(in: self.cancelBag)
Expand Down

0 comments on commit f396d3f

Please sign in to comment.