Skip to content

Commit

Permalink
Merge branch 'develop' into feat/#19-challengeViewUI
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoe0929 committed Jan 7, 2024
2 parents e030f5a + 76dcaba commit 29a28b2
Show file tree
Hide file tree
Showing 8 changed files with 401 additions and 12 deletions.
32 changes: 28 additions & 4 deletions HMH_iOS/HMH_iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@
0B8A89B72B369F1100688BA6 /* C.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B8A89B62B369F1100688BA6 /* C.swift */; };
0B8A89BC2B369F2D00688BA6 /* UIView+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B8A89BB2B369F2D00688BA6 /* UIView+.swift */; };
0B8A89C42B369FA000688BA6 /* F.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B8A89C32B369FA000688BA6 /* F.swift */; };
0B8A89C62B369FA800688BA6 /* H.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B8A89C52B369FA800688BA6 /* H.swift */; };
0BC0EBD22B493B6B003EF5D4 /* OnboardingProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BC0EBD12B493B6B003EF5D4 /* OnboardingProgressView.swift */; };
0BC0EBD42B494459003EF5D4 /* OnboardingSwipeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BC0EBD32B494459003EF5D4 /* OnboardingSwipeView.swift */; };
17314F7F2B485E150089A551 /* CustomAlertButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17314F7E2B485E150089A551 /* CustomAlertButton.swift */; };
17314F832B486BEC0089A551 /* AlertViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17314F822B486BEC0089A551 /* AlertViewController.swift */; };
17314F852B497FDE0089A551 /* HMHLogoutAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17314F842B497FDE0089A551 /* HMHLogoutAlert.swift */; };
17314F872B49853C0089A551 /* HMHQuitAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17314F862B49853C0089A551 /* HMHQuitAlert.swift */; };
17314F892B49A8B60089A551 /* AlertDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17314F882B49A8B60089A551 /* AlertDelegate.swift */; };
174AF48E2B447B1F00450D07 /* MyPageCells.swift in Sources */ = {isa = PBXBuildFile; fileRef = 174AF48D2B447B1F00450D07 /* MyPageCells.swift */; };
174AF4902B447B3C00450D07 /* MyPageModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 174AF48F2B447B3C00450D07 /* MyPageModels.swift */; };
174AF4922B447B4600450D07 /* MyPageViews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 174AF4912B447B4600450D07 /* MyPageViews.swift */; };
Expand Down Expand Up @@ -151,9 +155,13 @@
0B8A89B62B369F1100688BA6 /* C.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = C.swift; sourceTree = "<group>"; };
0B8A89BB2B369F2D00688BA6 /* UIView+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+.swift"; sourceTree = "<group>"; };
0B8A89C32B369FA000688BA6 /* F.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = F.swift; sourceTree = "<group>"; };
0B8A89C52B369FA800688BA6 /* H.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = H.swift; sourceTree = "<group>"; };
0BC0EBD12B493B6B003EF5D4 /* OnboardingProgressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingProgressView.swift; sourceTree = "<group>"; };
0BC0EBD32B494459003EF5D4 /* OnboardingSwipeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingSwipeView.swift; sourceTree = "<group>"; };
17314F7E2B485E150089A551 /* CustomAlertButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomAlertButton.swift; sourceTree = "<group>"; };
17314F822B486BEC0089A551 /* AlertViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertViewController.swift; sourceTree = "<group>"; };
17314F842B497FDE0089A551 /* HMHLogoutAlert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HMHLogoutAlert.swift; sourceTree = "<group>"; };
17314F862B49853C0089A551 /* HMHQuitAlert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HMHQuitAlert.swift; sourceTree = "<group>"; };
17314F882B49A8B60089A551 /* AlertDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertDelegate.swift; sourceTree = "<group>"; };
174AF48D2B447B1F00450D07 /* MyPageCells.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageCells.swift; sourceTree = "<group>"; };
174AF48F2B447B3C00450D07 /* MyPageModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageModels.swift; sourceTree = "<group>"; };
174AF4912B447B4600450D07 /* MyPageViews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageViews.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -371,7 +379,7 @@
0B8A89972B369CF100688BA6 /* Protocols */ = {
isa = PBXGroup;
children = (
0B8A89C52B369FA800688BA6 /* H.swift */,
17314F882B49A8B60089A551 /* AlertDelegate.swift */,
);
path = Protocols;
sourceTree = "<group>";
Expand Down Expand Up @@ -463,6 +471,7 @@
0B8A89A52B369DD500688BA6 /* Common */ = {
isa = PBXGroup;
children = (
17314F7D2B485DCF0089A551 /* CustomAlert */,
174AF4362B43DB2000450D07 /* CustomTabbar */,
3666C8492B45F37900564874 /* SwiftUIView */,
0B8A89A62B369DDB00688BA6 /* UIComponets */,
Expand Down Expand Up @@ -522,6 +531,17 @@
path = Cells;
sourceTree = "<group>";
};
17314F7D2B485DCF0089A551 /* CustomAlert */ = {
isa = PBXGroup;
children = (
17314F7E2B485E150089A551 /* CustomAlertButton.swift */,
17314F822B486BEC0089A551 /* AlertViewController.swift */,
17314F842B497FDE0089A551 /* HMHLogoutAlert.swift */,
17314F862B49853C0089A551 /* HMHQuitAlert.swift */,
);
path = CustomAlert;
sourceTree = "<group>";
};
174AF4362B43DB2000450D07 /* CustomTabbar */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -876,25 +896,29 @@
0B8A89C42B369FA000688BA6 /* F.swift in Sources */,
3666C8892B47110800564874 /* TotalTimePickerView.swift in Sources */,
174AF49A2B447CFB00450D07 /* ChanllengeViews.swift in Sources */,
17314F872B49853C0089A551 /* HMHQuitAlert.swift in Sources */,
0B8A89B72B369F1100688BA6 /* C.swift in Sources */,
0B2C2D3B2B443BE90023CCFA /* Image.swift in Sources */,
17314F852B497FDE0089A551 /* HMHLogoutAlert.swift in Sources */,
3666C84D2B45F41300564874 /* HMHAppSelectButtonView.swift in Sources */,
3666C8A32B4861A200564874 /* AppListCollectionViewCell.swift in Sources */,
0B8A89AD2B369E3B00688BA6 /* HomeCell.swift in Sources */,
3666C8882B47110800564874 /* SpecificTimePickerView.swift in Sources */,
174AF4922B447B4600450D07 /* MyPageViews.swift in Sources */,
0B8A89C62B369FA800688BA6 /* H.swift in Sources */,
36A3D9BE2B409BCC007EA272 /* Color.swift in Sources */,
0B8A89B52B369F0100688BA6 /* B.swift in Sources */,
174AF49C2B447D0700450D07 /* ChallengeViewController.swift in Sources */,
17314F892B49A8B60089A551 /* AlertDelegate.swift in Sources */,
0B8A89B12B369E4C00688BA6 /* HomeView.swift in Sources */,
36A3D9B62B3EBBF7007EA272 /* Adjust+.swift in Sources */,
36A3D9BC2B3EBD2D007EA272 /* UIScreen+.swift in Sources */,
0B50F9CD2B369813000C5046 /* SceneDelegate.swift in Sources */,
36A3D9B42B3EBBED007EA272 /* UIStackView+.swift in Sources */,
174AF4962B447CE700450D07 /* ChanllengeCells.swift in Sources */,
17314F832B486BEC0089A551 /* AlertViewController.swift in Sources */,
0B8A89B32B369EF700688BA6 /* A.swift in Sources */,
0BC0EBD22B493B6B003EF5D4 /* OnboardingProgressView.swift in Sources */,
17314F7F2B485E150089A551 /* CustomAlertButton.swift in Sources */,
36A3D9BA2B3EBC65007EA272 /* UIButton+.swift in Sources */,
3666C88F2B471C5800564874 /* TabBarController.swift in Sources */,
36E05FE62B48825A005B633E /* AppCollectionReusableView.swift in Sources */,
Expand Down
14 changes: 14 additions & 0 deletions HMH_iOS/HMH_iOS/Global/Literals/String/String.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,18 @@ enum StringLiteral {
static var backgroundViewId = "GrayBackground"
}
}
enum AlertButton {
static let confirm = "확인"
static let cancel = "취소"
static let close = "닫기"
}

enum AlertTitle {
static let logout = "HMH을 로그아웃 하실 건가요?"
static let quit = "HMH을 탈퇴 하실 건가요?"
}

enum AlertDescription {
static let quit = "회원탈퇴 후 유저의 정보는 30일 동안 임시보관 후 영구 삭제됩니다."
}
}
13 changes: 13 additions & 0 deletions HMH_iOS/HMH_iOS/Global/Protocols/AlertDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// AlertDelegate.swift
// HMH_iOS
//
// Created by 김보연 on 1/7/24.
//

import Foundation

protocol AlertDelegate: AnyObject {
func enabledButtonTapped()
func alertDismissTapped()
}
8 changes: 0 additions & 8 deletions HMH_iOS/HMH_iOS/Global/Protocols/H.swift

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
//
// AlertViewController.swift
// HMH_iOS
//
// Created by 김보연 on 1/6/24.
//

import UIKit

enum AlertType {
case HMHLogoutAlert
case HMHQuitALert
}

final class AlertViewController: UIViewController {
var alertType: AlertType?
var okAction: (() -> Void)?

private let logoutAlert = HMHLogoutAlert()
private let quitAlert = HMHQuitAlert()

override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .black.withAlphaComponent(0.7)

setDelegate()
setAlertType()
setUI()
}

private func setUI() {
setHierarchy()
setConstraint()
}

private func setHierarchy() {
view.addSubviews(logoutAlert, quitAlert)
}

private func setConstraint() {
logoutAlert.snp.makeConstraints {
$0.center.equalToSuperview()
$0.height.equalTo(177.adjusted)
$0.width.equalTo(293.adjusted)
}

quitAlert.snp.makeConstraints {
$0.center.equalToSuperview()
$0.height.equalTo(203.adjusted)
$0.width.equalTo(293.adjusted)
}
}

private func setAlertType() {
switch alertType {
case .HMHLogoutAlert:
setAlertView(logout: true, quit: false)
case .HMHQuitALert:
setAlertView(logout: false, quit: true)
default:
break
}
}

private func setAlertView(logout: Bool, quit: Bool) {
logoutAlert.isHidden = !logout
quitAlert.isHidden = !quit
}

func setDelegate() {
logoutAlert.delegate = self
quitAlert.delegate = self
}

func emptyActions() {

}

func setAlertType(_ type: AlertType) {
self.alertType = type
}
}

extension AlertViewController: AlertDelegate {
func enabledButtonTapped() {
dismiss(animated: false) {
(self.okAction ?? self.emptyActions)()
}
}

func alertDismissTapped() {
dismiss(animated: true)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
//
// CustomAlertButton.swift
// HMH_iOS
//
// Created by 김보연 on 1/6/24.
//

import UIKit

import SnapKit
import Then

final class CustomAlertButton: UIButton {
@frozen
enum HMHAlertButtonType {
case disabled
case enabled
}

private var alertButtonType: HMHAlertButtonType = .disabled
private let buttonTitleLabel = UILabel().then {
$0.textColor = .whiteText
$0.font = .iosText6Medium14
}

init(buttonType: HMHAlertButtonType, buttonText: String) {
super.init(frame: .zero)
self.alertButtonType = buttonType
buttonTitleLabel.text = buttonText

configureButton()
setUI()
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

private func setUI() {
setHierarchy()
setConstraints()
}

private func setHierarchy() {
self.addSubview(buttonTitleLabel)
}

private func setConstraints() {
self.snp.makeConstraints {
$0.height.equalTo(44.adjustedHeight)
}

buttonTitleLabel.snp.makeConstraints {
$0.center.equalToSuperview()
}
}

private func configureButton() {
self.layer.cornerRadius = 6.adjusted
self.layer.masksToBounds = true

switch alertButtonType {
case .enabled:
self.isEnabled = true
self.backgroundColor = .bluePurpleButton

case .disabled:
self.isEnabled = false
self.backgroundColor = .gray4
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
//
// HMHLogoutAlert.swift
// HMH_iOS
//
// Created by 김보연 on 1/6/24.
//

import UIKit

import SnapKit
import Then

final class HMHLogoutAlert: UIView {
weak var delegate: AlertDelegate?

private let titleLabel = UILabel().then {
$0.text = StringLiteral.AlertTitle.logout
$0.textColor = .whiteText
$0.font = .iosText5Medium16
$0.textAlignment = .center
}

private let buttonStackView = UIStackView().then {
$0.axis = .horizontal
$0.distribution = .fillEqually
$0.spacing = 7
}

private let leftButton = CustomAlertButton(buttonType: .disabled, buttonText: StringLiteral.AlertButton.close)
private let rightButton = CustomAlertButton(buttonType: .enabled, buttonText: StringLiteral.AlertButton.confirm)

override init(frame: CGRect) {
super.init(frame: frame)
setAddTarget()
configureView()
setUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

private func setUI() {
setHierarchy()
setConstraints()
}

private func setHierarchy() {
self.addSubviews(titleLabel, buttonStackView)
buttonStackView.addArrangeSubViews([leftButton, rightButton])
}

private func setConstraints() {
titleLabel.snp.makeConstraints {
$0.top.equalToSuperview().inset(50.adjusted)
$0.horizontalEdges.equalToSuperview()
}

buttonStackView.snp.makeConstraints {
$0.horizontalEdges.equalToSuperview().inset(20.adjustedWidth)
$0.bottom.equalToSuperview().inset(19.adjusted)
}
}

private func setAddTarget() {
leftButton.addTarget(self, action: #selector(exitButtonTapped), for: .touchUpInside)
rightButton.addTarget(self, action: #selector(logoutButtonTapped), for: .touchUpInside)
}

private func configureView() {
self.do {
$0.makeCornerRound(radius: 10.adjusted)
$0.backgroundColor = .gray7
}
}

@objc func exitButtonTapped() {
delegate?.alertDismissTapped()
}

@objc func logoutButtonTapped() {
delegate?.enabledButtonTapped()
}
}
Loading

0 comments on commit 29a28b2

Please sign in to comment.