Skip to content

Commit b5e1a5a

Browse files
authored
Merge pull request #184 from EAT-SSU/fix/#90
[#90] `16+`의 모달 Sheet UI 작업 완료
2 parents 9a6b7e9 + 3cf6ec7 commit b5e1a5a

File tree

7 files changed

+222
-89
lines changed

7 files changed

+222
-89
lines changed

EATSSU_MVC/EATSSU_MVC/Sources/Data/Network/DTO/Review/TotalReviewResponse.swift

-23
This file was deleted.

EATSSU_MVC/EATSSU_MVC/Sources/Presentation/Auth/View/LoginView.swift

+89-52
Original file line numberDiff line numberDiff line change
@@ -13,62 +13,99 @@ import Then
1313
import EATSSUDesign
1414

1515
final class LoginView: BaseUIView {
16-
// MARK: - UI Components
16+
// MARK: - UI Components
1717

18-
private let logoImage = UIImageView().then {
19-
$0.image = EATSSUAsset.Images.Version2.authLogo.image
20-
}
21-
22-
private let logoSubTitle = UIImageView().then { imageView in
23-
imageView.image = EATSSUAsset.Images.Version2.authSubTitle.image
24-
}
18+
private let logoImage = UIImageView().then {
19+
$0.image = EATSSUAsset.Images.Version2.authLogo.image
20+
}
2521

26-
let appleLoginButton = UIButton().then { button in
27-
button.setImage(EATSSUAsset.Images.Version2.appleLoginButton.image, for: .normal)
28-
}
29-
30-
let kakaoLoginButton = UIButton().then { button in
31-
button.setImage(EATSSUAsset.Images.Version2.kakaoLoginButton.image, for: .normal)
32-
}
22+
private let logoSubTitle = UIImageView().then { imageView in
23+
imageView.image = EATSSUAsset.Images.Version2.authSubTitle.image
24+
}
25+
26+
let appleLoginButton = UIButton().then { button in
27+
button.setImage(EATSSUAsset.Images.Version2.appleLoginButton.image, for: .normal)
28+
}
3329

34-
let lookingWithNoSignInButton = UIButton().then { button in
35-
button.setImage(EATSSUAsset.Images.Version2.lookAroundButton.image, for: .normal)
36-
}
30+
let kakaoLoginButton = UIButton().then { button in
31+
button.setImage(EATSSUAsset.Images.Version2.kakaoLoginButton.image, for: .normal)
32+
}
3733

38-
override func configureUI() {
39-
addSubviews(
40-
logoImage,
41-
logoSubTitle,
42-
appleLoginButton,
43-
kakaoLoginButton,
44-
lookingWithNoSignInButton
45-
)
46-
}
34+
let lookingWithNoSignInButton = UIButton().then { button in
35+
button.setImage(EATSSUAsset.Images.Version2.lookAroundButton.image, for: .normal)
36+
}
4737

48-
override func setLayout() {
49-
logoImage.snp.makeConstraints { make in
50-
make.centerX.equalToSuperview()
51-
make.top.equalToSuperview().inset(223)
52-
}
38+
override func configureUI() {
39+
addSubviews(
40+
logoImage,
41+
logoSubTitle,
42+
appleLoginButton,
43+
kakaoLoginButton,
44+
lookingWithNoSignInButton
45+
)
46+
}
47+
48+
override func setLayout() {
49+
logoImage.snp.makeConstraints { make in
50+
make.centerX.equalToSuperview()
51+
make.top.equalToSuperview().inset(223)
52+
}
53+
54+
logoSubTitle.snp.makeConstraints { make in
55+
make.centerX.equalToSuperview()
56+
make.top.equalTo(logoImage.snp.bottom)
57+
}
5358

54-
logoSubTitle.snp.makeConstraints { make in
55-
make.centerX.equalToSuperview()
56-
make.top.equalTo(logoImage.snp.bottom)
57-
}
58-
59-
appleLoginButton.snp.makeConstraints { make in
60-
make.centerX.equalToSuperview()
61-
make.bottom.equalTo(self.safeAreaLayoutGuide).inset(151)
62-
}
63-
64-
kakaoLoginButton.snp.makeConstraints { make in
65-
make.centerX.equalToSuperview()
66-
make.bottom.equalTo(self.safeAreaLayoutGuide).inset(90)
67-
}
68-
69-
lookingWithNoSignInButton.snp.makeConstraints { make in
70-
make.centerX.equalToSuperview()
71-
make.bottom.equalTo(self.safeAreaLayoutGuide).inset(30)
72-
}
73-
}
59+
appleLoginButton.snp.makeConstraints { make in
60+
make.centerX.equalToSuperview()
61+
make.bottom.equalTo(self.safeAreaLayoutGuide).inset(151)
62+
}
63+
64+
kakaoLoginButton.snp.makeConstraints { make in
65+
make.centerX.equalToSuperview()
66+
make.bottom.equalTo(self.safeAreaLayoutGuide).inset(90)
67+
}
68+
69+
lookingWithNoSignInButton.snp.makeConstraints { make in
70+
make.centerX.equalToSuperview()
71+
make.bottom.equalTo(self.safeAreaLayoutGuide).inset(30)
72+
}
73+
}
7474
}
75+
76+
/*
77+
@objc
78+
private func rightBarButtonTapped() {
79+
if RealmService.shared.isAccessTokenPresent() {
80+
let nextVC = MyPageViewController()
81+
self.navigationController?.pushViewController(nextVC, animated: true)
82+
} else {
83+
// showAlertControllerWithCancel(title: "로그인이 필요한 서비스입니다", message: "로그인 하시겠습니까?", confirmStyle: .default) {
84+
// self.changeIntoLoginViewController()
85+
// }
86+
87+
let modalVC = LoginPromptViewController()
88+
modalVC.modalPresentationStyle = .pageSheet
89+
90+
// Check if UISheetPresentationController is available (iOS 15+)
91+
if let sheet = modalVC.sheetPresentationController {
92+
let small = UISheetPresentationController.Detent.Identifier("small")
93+
// let smallDetent = UISheetPresentationController.Detent.custom(identifier: smallId) { context in
94+
// return 270
95+
// }
96+
// sheet.detents = [smallDetent]
97+
sheet.detents = [
98+
.custom(identifier: small) { context in
99+
0.3 * context.maximumDetentValue
100+
}
101+
]
102+
103+
// sheet.prefersGrabberVisible = true
104+
sheet.prefersScrollingExpandsWhenScrolledToEdge = false
105+
sheet.preferredCornerRadius = 30
106+
}
107+
present(modalVC, animated: true, completion: nil)
108+
109+
}
110+
}
111+
*/

EATSSU_MVC/EATSSU_MVC/Sources/Presentation/Home/View/RestaurantTableView/RestaurantTableViewHeader.swift

+18-11
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,33 @@ import SnapKit
1111

1212
class RestaurantTableViewHeader: BaseTableViewHeaderView {
1313

14+
// MARK: - Properties
15+
1416
static let identifier = "RestaurantTableViewHeader"
17+
var infoButtonDidTappedCallback: (() -> Void)?
18+
19+
// MARK: - UI Components
1520

1621
let titleLabel = UILabel()
1722
let infoButton = UIButton()
1823
let stackView = UIStackView()
19-
20-
var infoButtonDidTappedCallback: (() -> Void)?
21-
22-
//MARK: - Functions
23-
24+
25+
// MARK: - Functions
26+
2427
override func configure() {
2528
super.configure()
2629

2730
configureUI()
2831
setLayout()
2932
setViewProperties()
3033
}
31-
32-
func setViewProperties() {
34+
35+
private func setViewProperties() {
3336
titleLabel.do {
3437
$0.font = .subtitle1
3538
$0.text = "기숙사 식당"
3639
}
40+
3741
infoButton.do {
3842
var configuration = UIButton.Configuration.plain()
3943
configuration.baseForegroundColor = EATSSUAsset.Color.GrayScale.gray600.color
@@ -42,27 +46,30 @@ class RestaurantTableViewHeader: BaseTableViewHeaderView {
4246
configuration.imagePadding = 4.0
4347
$0.configuration = configuration
4448
}
49+
4550
stackView.do {
4651
$0.axis = .horizontal
4752
$0.distribution = .equalSpacing
4853
$0.alignment = .center
4954
}
5055
}
51-
52-
func configureUI() {
56+
57+
private func configureUI() {
5358
contentView.addSubview(stackView)
5459
stackView.addArrangedSubviews([titleLabel,
55-
infoButton])
60+
infoButton])
5661
}
5762

58-
func setLayout() {
63+
private func setLayout() {
5964
stackView.snp.makeConstraints {
6065
$0.horizontalEdges.equalToSuperview()
6166
$0.centerY.equalToSuperview()
6267
}
68+
6369
titleLabel.snp.makeConstraints {
6470
$0.leading.equalToSuperview()
6571
}
72+
6673
infoButton.snp.makeConstraints {
6774
$0.trailing.equalToSuperview()
6875
}

EATSSU_MVC/EATSSU_MVC/Sources/Presentation/Home/ViewController/HomeViewController.swift

+26-3
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,36 @@ final class HomeViewController: BaseViewController {
101101

102102
@objc
103103
private func rightBarButtonTapped() {
104+
/// 로그인 되어있는 경우
104105
if RealmService.shared.isAccessTokenPresent() {
105106
let nextVC = MyPageViewController()
106107
self.navigationController?.pushViewController(nextVC, animated: true)
107-
} else {
108-
showAlertControllerWithCancel(title: "로그인이 필요한 서비스입니다", message: "로그인 하시겠습니까?", confirmStyle: .default) {
109-
self.changeIntoLoginViewController()
108+
}
109+
/// 로그인 되어있지 않은 경우
110+
else {
111+
let loginPromptVC = LoginPromptViewController()
112+
loginPromptVC.modalPresentationStyle = .pageSheet
113+
114+
// Check if iOS 16+
115+
if #available(iOS 16.0, *) {
116+
if let sheet = loginPromptVC.sheetPresentationController {
117+
let small = UISheetPresentationController.Detent.Identifier("small")
118+
sheet.detents = [
119+
.custom(identifier: small) { context in
120+
0.34 * context.maximumDetentValue
121+
}
122+
]
123+
124+
sheet.prefersScrollingExpandsWhenScrolledToEdge = false
125+
sheet.preferredCornerRadius = 30
126+
}
127+
present(loginPromptVC, animated: true, completion: nil)
110128
}
129+
130+
// showAlertControllerWithCancel(title: "로그인이 필요한 서비스입니다", message: "로그인 하시겠습니까?", confirmStyle: .default) {
131+
// self.changeIntoLoginViewController()
132+
// }
133+
111134
}
112135
}
113136

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
//
2+
// LoginPromptViewController.swift
3+
// EATSSU
4+
//
5+
// Created by 최지우 on 11/26/24.
6+
//
7+
8+
import UIKit
9+
10+
final class LoginPromptViewController: BaseViewController {
11+
12+
// MARK: - UI Components
13+
14+
private let loginAlertLabel = UILabel()
15+
private let appleLoginButton = UIButton()
16+
private let kakaoLoginButton = UIButton()
17+
private let buttonStackView = UIStackView()
18+
private let loginPromptStackView = UIStackView()
19+
private let buttonView = UIView()
20+
21+
// MARK: - Life Cycles
22+
23+
override func viewDidLoad() {
24+
super.viewDidLoad()
25+
26+
setViewProperties()
27+
}
28+
29+
// MARK: - Functions
30+
31+
private func setViewProperties() {
32+
loginAlertLabel.do {
33+
$0.text = TextLiteral.SignIn.loginPrompt
34+
$0.textAlignment = .left
35+
$0.numberOfLines = 0
36+
$0.font = EATSSUFontFamily.Pretendard.bold.font(size: 18)
37+
$0.setContentHuggingPriority(.defaultHigh, for: .vertical)
38+
}
39+
40+
appleLoginButton.do {
41+
$0.setImage(EATSSUAsset.Images.Version2.appleLoginButton.image, for: .normal)
42+
}
43+
44+
kakaoLoginButton.do {
45+
$0.setImage(EATSSUAsset.Images.Version2.kakaoLoginButton.image, for: .normal)
46+
}
47+
48+
buttonStackView.do {
49+
$0.axis = .vertical
50+
$0.spacing = 8
51+
}
52+
53+
loginPromptStackView.do {
54+
$0.axis = .vertical
55+
}
56+
}
57+
58+
override func configureUI() {
59+
view.addSubview(loginPromptStackView)
60+
buttonView.addSubview(buttonStackView)
61+
62+
buttonStackView.addArrangedSubviews([appleLoginButton,
63+
kakaoLoginButton])
64+
loginPromptStackView.addArrangedSubviews([loginAlertLabel,
65+
buttonView])
66+
}
67+
68+
override func setLayout() {
69+
loginAlertLabel.snp.makeConstraints {
70+
$0.top.equalToSuperview()
71+
}
72+
73+
buttonStackView.snp.makeConstraints{
74+
$0.center.equalToSuperview()
75+
}
76+
77+
loginPromptStackView.snp.makeConstraints {
78+
$0.horizontalEdges.equalToSuperview().inset(30)
79+
$0.height.equalToSuperview().multipliedBy(0.7)
80+
$0.bottom.equalToSuperview().multipliedBy(0.85)
81+
}
82+
}
83+
}

EATSSU_MVC/EATSSU_MVC/Sources/Utility/Literal/TextLiteral.swift

+6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ enum TextLiteral {
3535
}
3636

3737
// MARK: - Sign In
38+
39+
enum SignIn {
40+
41+
/// 3초만에 로그인하고 리뷰를 달아보세요!
42+
static let loginPrompt: String = "3초만에 로그인하고\n리뷰를 달아보세요!"
43+
}
3844

3945
static let signInWithApple: String = "Apple로 로그인"
4046
static let signInWithKakao: String = "카카오 로그인"

0 commit comments

Comments
 (0)