Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] #174 - 메인 뷰 화면 연결 #175

Merged
merged 2 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍👍

.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 @@ -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

Expand Down Expand Up @@ -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 }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 빼준 것까지 깔끔합니다!!


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