Skip to content

Commit

Permalink
[Feat] sopt-makers#174 - 메인 뷰 화면 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
elesahich committed Apr 17, 2023
1 parent 4e394c6 commit 8ef4313
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 8 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 @@ -14,6 +14,7 @@ import Core

import Domain

import SafariServices
import Combine
import SnapKit
import Then
Expand Down Expand Up @@ -213,9 +214,15 @@ extension SignInVC {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyyMMddHHmmss"
let state = dateFormatter.string(from: Date())
UserDefaultKeyList.Auth.requestState = state
openExternalLink(urlStr: ExternalURL.Playground.login(state: state)) {
print("플레이그라운드 Open URL")
}

UserDefaultKeyList.Auth.requestState = state
let safariviewController = SFSafariViewController(url: URL(string: ExternalURL.Playground.login(state: state))!)
safariviewController.modalPresentationStyle = .formSheet
self.present(safariviewController, animated: true)
//
// UserDefaultKeyList.Auth.requestState = state
// openExternalLink(urlStr: ExternalURL.Playground.login(state: state)) {
// print("플레이그라운드 Open URL")
// }
}
}
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 }

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 8ef4313

Please sign in to comment.