Skip to content

Commit

Permalink
Merge pull request sopt-makers#180 from L-j-h-c/feature/sopt-makers#178
Browse files Browse the repository at this point in the history
…-safariVCLogin
  • Loading branch information
L-j-h-c authored Apr 18, 2023
2 parents aa9b004 + 8494dc4 commit ff0420e
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import UIKit

import Combine
import SafariServices
import SnapKit
import Then

Expand All @@ -33,17 +34,17 @@ public final class AppMyPageVC: UIViewController, AppMyPageViewControllable {
private let viewModel: AppMyPageViewModel
private let factory: SettingFeatureViewBuildable & AlertViewBuildable & AuthFeatureViewBuildable
private let userType: UserType

// MARK: Combine
private let resetButtonTapped = PassthroughSubject<Bool, Never>()
private let cancelBag = CancelBag()

// MARK: - Views
private lazy var navigationBar = OPNavigationBar(
self,
type: .oneLeftButton,
backgroundColor: DSKitAsset.Colors.black100.color
)
self,
type: .oneLeftButton,
backgroundColor: DSKitAsset.Colors.black100.color
)
.addMiddleLabel(title: I18N.MyPage.navigationTitle)

private let scrollView = UIScrollView()
Expand Down Expand Up @@ -158,7 +159,7 @@ public final class AppMyPageVC: UIViewController, AppMyPageViewControllable {
extension AppMyPageVC {
public override func viewDidLoad() {
super.viewDidLoad()

self.navigationController?.navigationBar.isHidden = true
self.view.backgroundColor = DSKitAsset.Colors.black100.color

Expand Down Expand Up @@ -206,7 +207,7 @@ extension AppMyPageVC {
$0.bottom.equalToSuperview()
}
}

// TODO: - (@승호): 적절히 객체에 위임하기
private func addTabGestureOnListItems() {
self.servicePolicySectionGroup.addTapGestureRecognizer {
Expand Down Expand Up @@ -292,7 +293,7 @@ extension AppMyPageVC {
UserDefaultKeyList.Auth.appAccessToken = nil
UserDefaultKeyList.Auth.appRefreshToken = nil
UserDefaultKeyList.Auth.playgroundToken = nil

SFSafariViewController.DataStore.default.clearWebsiteData()
}

private func showLoginViewController() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,19 @@
//

import UIKit
import Combine
import SafariServices

import DSKit

import Core

import Domain

import Combine
import SnapKit
import Then

import AuthFeatureInterface
import MainFeatureInterface

import SnapKit
import Then

public class SignInVC: UIViewController, SignInViewControllable {

// MARK: - Properties
Expand Down Expand Up @@ -216,8 +215,9 @@ extension SignInVC {
dateFormatter.dateFormat = "yyyyMMddHHmmss"
let state = dateFormatter.string(from: Date())
UserDefaultKeyList.Auth.requestState = state
openExternalLink(urlStr: ExternalURL.Playground.login(state: state)) {
print("플레이그라운드 Open URL")
}
let safari = SFSafariViewController(url: URL(string: ExternalURL.Playground.login(state: state))!)
safari.modalPresentationStyle = .fullScreen
safari.playgroundStyle()
self.present(safari, animated: true)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,14 @@ extension MainVC: UICollectionViewDelegate {
}

let safariViewController = SFSafariViewController(url: URL(string: service.serviceDomainLink)!)
safariViewController.playgroundStyle()
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)!)
safariViewController.playgroundStyle()
self.present(safariViewController, animated: true)
case(3, _):
guard viewModel.userType != .visitor else { return }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import UIKit
import DSKit
import SafariServices

import Core

Expand Down Expand Up @@ -139,6 +140,7 @@ extension WithdrawalVC {
let window = self.view.window!
let navigation = UINavigationController(rootViewController: factory.makeSignInVC().viewController)
navigation.isNavigationBarHidden = true
SFSafariViewController.DataStore.default.clearWebsiteData()
ViewControllerUtils.setRootViewController(window: window, viewController: navigation, withAnimation: true) { newWindow in
Toast.show(message: I18N.Setting.Withdrawal.withdrawalSuccess,
view: newWindow,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// SFsafariViewController+.swift
// DSKit
//
// Created by Junho Lee on 2023/04/18.
// Copyright © 2023 SOPT-iOS. All rights reserved.
//

import SafariServices

public extension SFSafariViewController {
func playgroundStyle() {
preferredBarTintColor = .black
preferredControlTintColor = .white
dismissButtonStyle = .cancel
}
}

0 comments on commit ff0420e

Please sign in to comment.