Skip to content

Commit

Permalink
[Merge] sopt-makers#170 - merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
lsj8706 committed Apr 17, 2023
2 parents 6ffe481 + f890d4e commit 60a0dcb
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 5 deletions.
14 changes: 14 additions & 0 deletions SOPT-iOS/Projects/Core/Sources/Enum/ServiceType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ public enum ServiceType {
case member
case notice
case crew

public var serviceDomainLink: String {
switch self {
case .officialHomepage: return "https://sopt.org"
case .review: return "https://sopt.org/review"
case .project: return "https://playground.sopt.org/projects"
case .faq: return "https://sopt.org/FAQ"
case .youtube: return "https://m.youtube.com/@SOPTMEDIA"
case .attendance: return ""
case .member: return "https://playground.sopt.org/members"
case .notice: return ""
case .crew: return "https://playground.sopt.org/group"
}
}
}

public enum AppServiceType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ extension SignInVC {
)
let output = self.viewModel.transform(from: input, cancelBag: cancelBag)

output.isSignInSuccess.sink { [weak self] isSuccessed in
output.isSignInSuccess
.removeDuplicates()
.sink { [weak self] isSuccessed in
guard let self = self else { return }
if isSuccessed {
self.setRootViewToMain()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import UIKit
import SafariServices

import Core
import Domain
Expand All @@ -22,12 +23,14 @@ import MainFeatureInterface
import StampFeatureInterface
import SettingFeatureInterface
import AppMyPageFeatureInterface
import AttendanceFeatureInterface

public class MainVC: UIViewController, MainViewControllable {
public typealias factoryType = AuthFeatureViewBuildable
& StampFeatureViewBuildable
& SettingFeatureViewBuildable
& AppMyPageFeatureViewBuildable
& AttendanceFeatureViewBuildable
& AlertViewBuildable

// MARK: - Properties
Expand Down Expand Up @@ -177,10 +180,31 @@ extension MainVC {

extension MainVC: UICollectionViewDelegate {
public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
if indexPath.section == 3 {
guard viewModel.userType != .visitor else { return }
presentSoptampFeature()
}
switch (indexPath.section, indexPath.row) {
case (0, _): break
case (1, _):
guard let service = viewModel.mainServiceList[safe: indexPath.item - 1] else { return }

guard service != .attendance else {
let viewController = factory.makeShowAttendanceVC().viewController
self.navigationController?.pushViewController(viewController, animated: true)
return
}

let safariViewController = SFSafariViewController(url: URL(string: service.serviceDomainLink)!)
self.present(safariViewController, animated: true)

case (2, _):
guard let service = viewModel.otherServiceList[safe: indexPath.item] else { return }

let safariViewController = SFSafariViewController(url: URL(string: service.serviceDomainLink)!)
self.present(safariViewController, animated: true)
case(3, _):
guard viewModel.userType != .visitor else { return }

presentSoptampFeature()
default: break
}
}
}

Expand Down

0 comments on commit 60a0dcb

Please sign in to comment.