Skip to content

Commit

Permalink
Merge pull request #69 from devxsby/feat/#63-설정뷰서비스이용방침
Browse files Browse the repository at this point in the history
[Feat] #63 - 설정뷰 서비스 이용 방침 추가
  • Loading branch information
devxsby authored Jan 1, 2023
2 parents 87863c1 + d1c03cb commit 0c01f6a
Show file tree
Hide file tree
Showing 6 changed files with 449 additions and 2 deletions.
267 changes: 267 additions & 0 deletions SOPT-Stamp-iOS/Projects/Core/Sources/Literals/StringLiterals.swift

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ public protocol ModuleFactoryInterface {
func makeRankingVC() -> RankingVC
func makeSettingVC() -> SettingVC
func makePasswordChangeVC() -> PasswordChangeVC
func makePrivacyPolicyVC() -> PrivacyPolicyVC
func makeTermsOfServiceVC() -> TermsOfServiceVC
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
//
// PrivacyPolicyVC.swift
// Presentation
//
// Created by devxsby on 2022/12/29.
// Copyright © 2022 SOPT-Stamp-iOS. All rights reserved.
//

import UIKit
import DSKit

import Core

import SnapKit
import Then

public class PrivacyPolicyVC: UIViewController {

// MARK: - UI Components

private lazy var naviBar = CustomNavigationBar(self, type: .titleWithLeftButton)
.setTitle(I18N.Setting.personalInfoPolicy)
.setRightButton(.none)

private let textView = UITextView().then {
$0.text = I18N.serviceUsagePolicy.privacyPolicy
$0.isEditable = false
$0.showsVerticalScrollIndicator = false
$0.setLineSpacing(lineSpacing: 5)
}

// MARK: - View Life Cycle

public override func viewDidLoad() {
super.viewDidLoad()
self.setUI()
self.setLayout()
self.setDelegate()
}
}

// MARK: - UI & Layout

extension PrivacyPolicyVC {

private func setUI() {
self.view.backgroundColor = DSKitAsset.Colors.white.color
}

private func setLayout() {
self.view.addSubviews(naviBar, textView)

naviBar.snp.makeConstraints { make in
make.leading.top.trailing.equalTo(view.safeAreaLayoutGuide)
}

textView.snp.makeConstraints { make in
make.top.equalTo(naviBar.snp.bottom).offset(8)
make.leading.trailing.equalTo(view.safeAreaInsets).inset(20)
make.bottom.equalToSuperview()
}
}
}

// MARK: - Methods

extension PrivacyPolicyVC {

private func setDelegate() {
textView.delegate = self
}
}

extension PrivacyPolicyVC: UITextViewDelegate {

public func textViewDidChangeSelection(_ textView: UITextView) {
textView.selectedTextRange = nil
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ extension SettingVC {
let passwordChangeVC = self.factory.makePasswordChangeVC()
navigationController?.pushViewController(passwordChangeVC, animated: true)
}

private func showPrivacyPolicyView() {
let privacyPolicyVC = self.factory.makePrivacyPolicyVC()
navigationController?.pushViewController(privacyPolicyVC, animated: true)
}

private func showTermsOfServieView() {
let termsOfServiceVC = self.factory.makeTermsOfServiceVC()
navigationController?.pushViewController(termsOfServiceVC, animated: true)
}
}

// MARK: - UI & Layout
Expand Down Expand Up @@ -137,9 +147,9 @@ extension SettingVC: UICollectionViewDelegate {
case 1:
switch indexPath.row {
case 0:
print("개인정보처리방침")
showPrivacyPolicyView()
case 1:
print("서비스 이용 약관")
showTermsOfServieView()
default:
print("서비스 의견 제안")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
//
// TermsOfServiceVC.swift
// Presentation
//
// Created by devxsby on 2022/12/29.
// Copyright © 2022 SOPT-Stamp-iOS. All rights reserved.
//

import UIKit
import DSKit

import Core

import SnapKit
import Then

public class TermsOfServiceVC: UIViewController {

// MARK: - UI Components

private lazy var naviBar = CustomNavigationBar(self, type: .titleWithLeftButton)
.setTitle(I18N.Setting.serviceTerm)
.setRightButton(.none)

private let textView = UITextView().then {
$0.text = I18N.serviceUsagePolicy.termsOfService
$0.isEditable = false
$0.showsVerticalScrollIndicator = false
$0.setLineSpacing(lineSpacing: 5)
}

// MARK: - View Life Cycle

public override func viewDidLoad() {
super.viewDidLoad()
self.setUI()
self.setLayout()
self.setDelegate()
}
}

// MARK: - UI & Layout

extension TermsOfServiceVC {

private func setUI() {
self.view.backgroundColor = DSKitAsset.Colors.white.color
}

private func setLayout() {
self.view.addSubviews(naviBar, textView)

naviBar.snp.makeConstraints { make in
make.leading.top.trailing.equalTo(view.safeAreaLayoutGuide)
}

textView.snp.makeConstraints { make in
make.top.equalTo(naviBar.snp.bottom).offset(8)
make.leading.trailing.equalTo(view.safeAreaInsets).inset(20)
make.bottom.equalToSuperview()
}
}
}

// MARK: - Methods

extension TermsOfServiceVC {

private func setDelegate() {
textView.delegate = self
}
}

extension TermsOfServiceVC: UITextViewDelegate {

public func textViewDidChangeSelection(_ textView: UITextView) {
textView.selectedTextRange = nil
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,14 @@ extension ModuleFactory: ModuleFactoryInterface {
passwordChangeVC.viewModel = viewModel
return passwordChangeVC
}

public func makePrivacyPolicyVC() -> Presentation.PrivacyPolicyVC {
let privacyPolicyVC = PrivacyPolicyVC()
return privacyPolicyVC
}

public func makeTermsOfServiceVC() -> Presentation.TermsOfServiceVC {
let termsOfServiceVC = TermsOfServiceVC()
return termsOfServiceVC
}
}

0 comments on commit 0c01f6a

Please sign in to comment.