Skip to content

Commit

Permalink
[Merge] #192 - 4차 스프린트 QA-신고하기 후 구글폼 이동, 알림 설정으로 이동 추가
Browse files Browse the repository at this point in the history
Feat [#192] 4차 스프린트 QA-신고하기 후 구글폼 이동, 알림 설정으로 이동 추가
  • Loading branch information
boogios authored Jul 1, 2024
2 parents f289df0 + 642dcb8 commit 98fef74
Show file tree
Hide file tree
Showing 7 changed files with 190 additions and 10 deletions.
12 changes: 8 additions & 4 deletions DontBe-iOS/DontBe-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
objects = {

/* Begin PBXBuildFile section */
052555BC2C1218A800D38E34 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 052555BB2C1218A800D38E34 /* GoogleService-Info.plist */; };
052555BF2C121A5200D38E34 /* FirebaseMessaging in Frameworks */ = {isa = PBXBuildFile; productRef = 052555BE2C121A5200D38E34 /* FirebaseMessaging */; };
052555C42C187A7400D38E34 /* DontBePushAlarmHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 052555C32C187A7400D38E34 /* DontBePushAlarmHelper.swift */; };
05D2B97F2C0A3D8400453615 /* Config.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 05D2B97E2C0A3D8400453615 /* Config.xcconfig */; };
Expand Down Expand Up @@ -123,6 +122,8 @@
3C2F54522B51224500E7BF01 /* MyPageAccountInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C2F54512B51224500E7BF01 /* MyPageAccountInfoViewController.swift */; };
3C2F54542B5126C600E7BF01 /* UIBarButtonItem+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C2F54532B5126C600E7BF01 /* UIBarButtonItem+.swift */; };
3C35565B2B494F0A0016BA49 /* UIColor+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C35565A2B494F0A0016BA49 /* UIColor+.swift */; };
3C44589B2C228FFD0079643E /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3C44589A2C228FFD0079643E /* GoogleService-Info.plist */; };
3C44589D2C2291F00079643E /* MyPageSettingAlarmViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C44589C2C2291F00079643E /* MyPageSettingAlarmViewController.swift */; };
3C4993652B4F2471002A99CF /* MyPageSegmentedControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C4993642B4F2471002A99CF /* MyPageSegmentedControl.swift */; };
3C4993672B4F2644002A99CF /* MyPageContentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C4993662B4F2644002A99CF /* MyPageContentViewController.swift */; };
3C4993692B4F2653002A99CF /* MyPageCommentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C4993682B4F2653002A99CF /* MyPageCommentViewController.swift */; };
Expand Down Expand Up @@ -173,7 +174,6 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
052555BB2C1218A800D38E34 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
052555C32C187A7400D38E34 /* DontBePushAlarmHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DontBePushAlarmHelper.swift; sourceTree = "<group>"; };
05D2B97E2C0A3D8400453615 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; };
2A0A73092B541555004478C1 /* HttpMethod.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HttpMethod.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -286,6 +286,8 @@
3C2F54512B51224500E7BF01 /* MyPageAccountInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageAccountInfoViewController.swift; sourceTree = "<group>"; };
3C2F54532B5126C600E7BF01 /* UIBarButtonItem+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIBarButtonItem+.swift"; sourceTree = "<group>"; };
3C35565A2B494F0A0016BA49 /* UIColor+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+.swift"; sourceTree = "<group>"; };
3C44589A2C228FFD0079643E /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../GoogleService-Info.plist"; sourceTree = "<group>"; };
3C44589C2C2291F00079643E /* MyPageSettingAlarmViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageSettingAlarmViewController.swift; sourceTree = "<group>"; };
3C4993642B4F2471002A99CF /* MyPageSegmentedControl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageSegmentedControl.swift; sourceTree = "<group>"; };
3C4993662B4F2644002A99CF /* MyPageContentViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageContentViewController.swift; sourceTree = "<group>"; };
3C4993682B4F2653002A99CF /* MyPageCommentViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageCommentViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -802,7 +804,7 @@
3C6192EB2B3A719A00220CEB /* DontBe-iOS */ = {
isa = PBXGroup;
children = (
052555BB2C1218A800D38E34 /* GoogleService-Info.plist */,
3C44589A2C228FFD0079643E /* GoogleService-Info.plist */,
2AE95D702B81EC52009C6336 /* DontBe-iOS.entitlements */,
3C6193002B3A771E00220CEB /* Application */,
3C6193012B3A772B00220CEB /* Global */,
Expand Down Expand Up @@ -1184,6 +1186,7 @@
3C4993682B4F2653002A99CF /* MyPageCommentViewController.swift */,
3C2F544F2B51223200E7BF01 /* MyPageEditProfileViewController.swift */,
3C2F54512B51224500E7BF01 /* MyPageAccountInfoViewController.swift */,
3C44589C2C2291F00079643E /* MyPageSettingAlarmViewController.swift */,
3C4F5BB42B7A49A500B21C45 /* MyPageSignOutViewController.swift */,
3C1ABD882B8F083C00ADF97B /* MyPageSignOutConfirmViewController.swift */,
);
Expand Down Expand Up @@ -1293,7 +1296,7 @@
2A6D54C72B493E3F00F9891E /* Pretendard-Regular.otf in Resources */,
2A6D54C62B493E3F00F9891E /* Pretendard-SemiBold.otf in Resources */,
2FD9276E2B9225EE0046193D /* loading_yesbe.json in Resources */,
052555BC2C1218A800D38E34 /* GoogleService-Info.plist in Resources */,
3C44589B2C228FFD0079643E /* GoogleService-Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -1430,6 +1433,7 @@
2A2845462B532BCB0023F9B5 /* SocialLoginRequestDTO.swift in Sources */,
2AF069B42B5194F300CA3E48 /* MyPageIntroductionEditView.swift in Sources */,
3C1ABD852B8DB52E00ADF97B /* DontBePopupReasonListCustomView.swift in Sources */,
3C44589D2C2291F00079643E /* MyPageSettingAlarmViewController.swift in Sources */,
2A2672052B4C3C00009D214F /* CancelBag.swift in Sources */,
2F05B1AA2B579DED00AC368D /* PostDetailViewModel.swift in Sources */,
2FB818D92B5186FC00B7498F /* PostReplyCollectionView.swift in Sources */,
Expand Down
2 changes: 2 additions & 0 deletions DontBe-iOS/DontBe-iOS/Global/Literals/StringLiterals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ enum StringLiterals {
static let MyPageNavigationTitle = "마이"
static let MyPageEditNavigationTitle = "프로필 편집"
static let MyPageAccountInfoNavigationTitle = "계정 정보"
static let MyPageSettingAlarmNavigationTitle = "알림"
static let MyPageSignOutNavigationTitle = "계정 삭제"
static let myPageEditIntroduction = "한줄 소개"
static let myPageEditIntroductionPlease = "한 줄로 자신을 소개해주세요."
Expand Down Expand Up @@ -156,6 +157,7 @@ enum StringLiterals {
static let warnLabel = "신고하기"
static let profileEdit = "프로필 편집"
static let accountInfo = "계정 정보"
static let settingAlarm = "알림설정"
static let feedback = "피드백 남기기"
static let customerCenter = "고객센터"
static let logout = "로그아웃"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ final class DontBeBottomSheetView: UIView {

let accountInfoButton = DontBeBottomSheetButton(title: StringLiterals.BottomSheet.accountInfo)

let settingAlarmButton = DontBeBottomSheetButton(title: StringLiterals.BottomSheet.settingAlarm)

let feedbackButton = DontBeBottomSheetButton(title: StringLiterals.BottomSheet.feedback)

let customerCenterButton = DontBeBottomSheetButton(title: StringLiterals.BottomSheet.customerCenter)
Expand Down Expand Up @@ -130,14 +132,15 @@ extension DontBeBottomSheetView {
bottomsheetView.addSubviews(dragIndicatorView,
profileEditButton,
accountInfoButton,
settingAlarmButton,
feedbackButton,
customerCenterButton,
logoutButton)
}

private func setMultiButtonLayout() {
bottomsheetView.snp.makeConstraints {
$0.height.equalTo(434.adjusted)
$0.height.equalTo(506.adjusted)
}

dragIndicatorView.snp.makeConstraints {
Expand All @@ -159,12 +162,18 @@ extension DontBeBottomSheetView {
$0.top.equalTo(profileEditButton.snp.bottom).offset(10.adjusted)
}

feedbackButton.snp.makeConstraints {
settingAlarmButton.snp.makeConstraints {
$0.centerX.equalToSuperview()
$0.leading.trailing.equalToSuperview().inset(15.adjusted)
$0.top.equalTo(accountInfoButton.snp.bottom).offset(10.adjusted)
}

feedbackButton.snp.makeConstraints {
$0.centerX.equalToSuperview()
$0.leading.trailing.equalToSuperview().inset(15.adjusted)
$0.top.equalTo(settingAlarmButton.snp.bottom).offset(10.adjusted)
}

customerCenterButton.snp.makeConstraints {
$0.centerX.equalToSuperview()
$0.leading.trailing.equalToSuperview().inset(15.adjusted)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ final class HomeViewController: UIViewController {
var hasAppearedBefore = false
var reportTargetNickname: String = ""
var relateText: String = ""
let warnUserURL = URL(string: StringLiterals.Network.warnUserGoogleFormURL)

var transparentReasonView = DontBePopupReasonView()
var deletePostPopupVC = DeletePopupViewController(viewModel: DeletePostViewModel(networkProvider: NetworkService()))
Expand All @@ -44,8 +45,6 @@ final class HomeViewController: UIViewController {
private lazy var fifthReason = self.transparentReasonView.fifthReasonView.radioButton.publisher(for: .touchUpInside).map { _ in }.eraseToAnyPublisher()
private lazy var sixthReason = self.transparentReasonView.sixthReasonView.radioButton.publisher(for: .touchUpInside).map { _ in }.eraseToAnyPublisher()
private lazy var isPushAllowed = PassthroughSubject<Bool, Never>()

let warnUserURL = NSURL(string: "\(StringLiterals.Network.warnUserGoogleFormURL)")

// MARK: - UI Components

Expand Down Expand Up @@ -745,6 +744,12 @@ extension HomeViewController: DontBePopupDelegate {
func confirmButtonTapped() {
reportPopupView.removeFromSuperview()

let warnView: SFSafariViewController
if let warnURL = self.warnUserURL {
warnView = SFSafariViewController(url: warnURL)
self.present(warnView, animated: true, completion: nil)
}

Task {
do {
if let accessToken = KeychainWrapper.loadToken(forKey: "accessToken") {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
//
// MyPageSettingAlarmViewController.swift
// DontBe-iOS
//
// Created by 변상우 on 6/19/24.
//

import UIKit

final class MyPageSettingAlarmViewController: UIViewController {

// MARK: - Properties

// MARK: - UI Components

private let topDivisionLine = UIView().makeDivisionLine()

private let pushAlarmSettingView: UIView = {
let view = UIView()
return view
}()

private let pushAlarmTitle: UILabel = {
let label = UILabel()
label.text = "푸시 알림"
label.font = .font(.body3)
label.textColor = .donBlack
return label
}()

private let pushAlarmSettingLabel: UILabel = {
let label = UILabel()
label.font = .font(.body4)
label.textColor = .donGray7
return label
}()

// MARK: - Life Cycles

override func viewDidLoad() {
super.viewDidLoad()

setUI()
setHierarchy()
setLayout()
setAddTarget()
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.tabBarController?.tabBar.isHidden = true
self.tabBarController?.tabBar.isTranslucent = true
self.navigationItem.hidesBackButton = true
self.navigationController?.navigationBar.isHidden = false
self.navigationController?.navigationBar.backgroundColor = .clear
self.navigationController?.navigationBar.titleTextAttributes = [.foregroundColor: UIColor.donBlack]

let backButton = UIBarButtonItem.backButton(target: self, action: #selector(backButtonTapped))
self.navigationItem.leftBarButtonItem = backButton

isNotificationEnabled { isEnabled in
if isEnabled {
self.pushAlarmSettingLabel.text = "on >"
} else {
self.pushAlarmSettingLabel.text = "off >"
}
}
}
}

// MARK: - Extensions

extension MyPageSettingAlarmViewController {
private func setUI() {
self.title = StringLiterals.MyPage.MyPageSettingAlarmNavigationTitle
self.view.backgroundColor = .donWhite

self.navigationController?.navigationBar.backgroundColor = .donWhite
self.navigationController?.navigationBar.titleTextAttributes = [.foregroundColor: UIColor.donBlack]
}

private func setHierarchy() {
self.view.addSubviews(topDivisionLine,
pushAlarmSettingView)

pushAlarmSettingView.addSubviews(pushAlarmTitle,
pushAlarmSettingLabel)
}

private func setLayout() {
topDivisionLine.snp.makeConstraints {
$0.top.equalTo(self.view.safeAreaLayoutGuide)
$0.leading.trailing.equalToSuperview()
$0.height.equalTo(1.adjusted)
}

pushAlarmSettingView.snp.makeConstraints {
$0.top.equalTo(self.view.safeAreaLayoutGuide)
$0.leading.trailing.equalToSuperview()
$0.height.equalTo(48.adjusted)
}

pushAlarmTitle.snp.makeConstraints {
$0.centerY.equalToSuperview()
$0.leading.equalToSuperview().inset(16.adjusted)
}

pushAlarmSettingLabel.snp.makeConstraints {
$0.centerY.equalToSuperview()
$0.trailing.equalToSuperview().inset(15.adjusted)
}
}

private func setAddTarget() {
pushAlarmSettingView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(pushAlarmSettingButtonTapped)))
}

// 알림 설정을 확인하는 함수
@objc
private func isNotificationEnabled(completion: @escaping (Bool) -> Void) {
UNUserNotificationCenter.current().getNotificationSettings { settings in
DispatchQueue.main.async {
completion(settings.authorizationStatus == .authorized)
}
}
}

@objc
private func pushAlarmSettingButtonTapped() {
if let alarmSettings = URL(string: UIApplication.openSettingsURLString) {
if UIApplication.shared.canOpenURL(alarmSettings) {
UIApplication.shared.open(alarmSettings, options: [:], completionHandler: nil)
}
}
}

@objc
private func backButtonTapped() {
self.navigationController?.popViewController(animated: false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ extension MyPageViewController {
rootView.myPageContentViewController.firstContentButton.addTarget(self, action: #selector(goToWriteViewController), for: .touchUpInside)
rootView.myPageBottomsheet.profileEditButton.addTarget(self, action: #selector(profileEditButtonTapped), for: .touchUpInside)
rootView.myPageBottomsheet.accountInfoButton.addTarget(self, action: #selector(accountInfoButtonTapped), for: .touchUpInside)
rootView.myPageBottomsheet.settingAlarmButton.addTarget(self, action: #selector(settingAlarmButtonTapped), for: .touchUpInside)
rootView.myPageBottomsheet.feedbackButton.addTarget(self, action: #selector(feedbackButtonTapped), for: .touchUpInside)
rootView.myPageBottomsheet.customerCenterButton.addTarget(self, action: #selector(customerCenterButtonTapped), for: .touchUpInside)
rootView.myPageBottomsheet.logoutButton.addTarget(self, action: #selector(logoutButtonTapped), for: .touchUpInside)
Expand Down Expand Up @@ -571,6 +572,13 @@ extension MyPageViewController {
self.navigationController?.pushViewController(vc, animated: false)
}

@objc
private func settingAlarmButtonTapped() {
rootView.myPageBottomsheet.handleDismiss()
let vc = MyPageSettingAlarmViewController()
self.navigationController?.pushViewController(vc, animated: false)
}

@objc
private func customerCenterButtonTapped() {
rootView.myPageBottomsheet.handleDismiss()
Expand Down Expand Up @@ -810,6 +818,12 @@ extension MyPageViewController: DontBePopupDelegate {
} else {
rootView.reportPopupView.removeFromSuperview()

let warnView: SFSafariViewController
if let warnURL = self.warnUserURL {
warnView = SFSafariViewController(url: warnURL)
self.present(warnView, animated: true, completion: nil)
}

Task {
do {
if let accessToken = KeychainWrapper.loadToken(forKey: "accessToken") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ final class PostDetailViewController: UIViewController {

var collectionHeaderView: PostDetailCollectionHeaderView?

let warnUserURL = NSURL(string: "\(StringLiterals.Network.warnUserGoogleFormURL)")

let viewModel: PostDetailViewModel
private var cancelBag = CancelBag()

Expand All @@ -55,6 +53,7 @@ final class PostDetailViewController: UIViewController {
var contentText: String = ""
var reportTargetNickname: String = ""
var relateText: String = ""
let warnUserURL = URL(string: StringLiterals.Network.warnUserGoogleFormURL)

// MARK: - UI Components

Expand Down Expand Up @@ -1071,6 +1070,12 @@ extension PostDetailViewController: DontBePopupDelegate {
func confirmButtonTapped() {
reportPopupView.removeFromSuperview()

let warnView: SFSafariViewController
if let warnURL = self.warnUserURL {
warnView = SFSafariViewController(url: warnURL)
self.present(warnView, animated: true, completion: nil)
}

Task {
do {
if let accessToken = KeychainWrapper.loadToken(forKey: "accessToken") {
Expand Down

0 comments on commit 98fef74

Please sign in to comment.