diff --git a/SOPT-iOS/Projects/Core/Sources/Enum/ServiceType.swift b/SOPT-iOS/Projects/Core/Sources/Enum/ServiceType.swift index 22a1b5dc..ef2b4cf9 100644 --- a/SOPT-iOS/Projects/Core/Sources/Enum/ServiceType.swift +++ b/SOPT-iOS/Projects/Core/Sources/Enum/ServiceType.swift @@ -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 { diff --git a/SOPT-iOS/Projects/Features/AuthFeature/Sources/SignInScene/VC/SignInVC.swift b/SOPT-iOS/Projects/Features/AuthFeature/Sources/SignInScene/VC/SignInVC.swift index e3363ef7..40e0a1d7 100644 --- a/SOPT-iOS/Projects/Features/AuthFeature/Sources/SignInScene/VC/SignInVC.swift +++ b/SOPT-iOS/Projects/Features/AuthFeature/Sources/SignInScene/VC/SignInVC.swift @@ -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() diff --git a/SOPT-iOS/Projects/Features/MainFeature/Sources/MainScene/VC/MainVC.swift b/SOPT-iOS/Projects/Features/MainFeature/Sources/MainScene/VC/MainVC.swift index c6aa8b08..db89f9d7 100644 --- a/SOPT-iOS/Projects/Features/MainFeature/Sources/MainScene/VC/MainVC.swift +++ b/SOPT-iOS/Projects/Features/MainFeature/Sources/MainScene/VC/MainVC.swift @@ -7,6 +7,7 @@ // import UIKit +import SafariServices import Core import Domain @@ -21,12 +22,14 @@ import MainFeatureInterface import StampFeatureInterface import SettingFeatureInterface import AppMyPageFeatureInterface +import AttendanceFeatureInterface public class MainVC: UIViewController, MainViewControllable { public typealias factoryType = AuthFeatureViewBuildable & StampFeatureViewBuildable & SettingFeatureViewBuildable & AppMyPageFeatureViewBuildable + & AttendanceFeatureViewBuildable // MARK: - Properties @@ -163,10 +166,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 + } } }