Skip to content

Commit

Permalink
Merge branch 'develop' into feat/#35-transparencyInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
boogios authored Jan 12, 2024
2 parents c3ff4e7 + aff9457 commit 309300b
Show file tree
Hide file tree
Showing 12 changed files with 383 additions and 35 deletions.
8 changes: 8 additions & 0 deletions DontBe-iOS/DontBe-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
2AAEFC992B4A9E3B00C2D323 /* DontBeTabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AAEFC982B4A9E3B00C2D323 /* DontBeTabBarController.swift */; };
2AC9FB1B2B4DE77400D31071 /* AgreementListCustomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AC9FB1A2B4DE77400D31071 /* AgreementListCustomView.swift */; };
2AC9FB1F2B4E634A00D31071 /* JoinAgreeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AC9FB1E2B4E634A00D31071 /* JoinAgreeView.swift */; };
2F1741882B500C270089FC4D /* UIApplication+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F1741872B500C270089FC4D /* UIApplication+.swift */; };
2F17418A2B500CC20089FC4D /* HomeBottomsheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F1741892B500CC20089FC4D /* HomeBottomsheetView.swift */; };
2F8735402B4BE65300E55552 /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F87353F2B4BE65300E55552 /* HomeView.swift */; };
2F8735422B4BE66500E55552 /* HomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F8735412B4BE66500E55552 /* HomeViewController.swift */; };
2F8735442B4BE67300E55552 /* HomeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F8735432B4BE67300E55552 /* HomeViewModel.swift */; };
Expand Down Expand Up @@ -113,6 +115,8 @@
2AAEFC982B4A9E3B00C2D323 /* DontBeTabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DontBeTabBarController.swift; sourceTree = "<group>"; };
2AC9FB1A2B4DE77400D31071 /* AgreementListCustomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AgreementListCustomView.swift; sourceTree = "<group>"; };
2AC9FB1E2B4E634A00D31071 /* JoinAgreeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JoinAgreeView.swift; sourceTree = "<group>"; };
2F1741872B500C270089FC4D /* UIApplication+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIApplication+.swift"; sourceTree = "<group>"; };
2F1741892B500CC20089FC4D /* HomeBottomsheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeBottomsheetView.swift; sourceTree = "<group>"; };
2F87353F2B4BE65300E55552 /* HomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeView.swift; sourceTree = "<group>"; };
2F8735412B4BE66500E55552 /* HomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewController.swift; sourceTree = "<group>"; };
2F8735432B4BE67300E55552 /* HomeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -398,6 +402,7 @@
2A8D70C42B4D8079009F4C6C /* UIViewController+.swift */,
2A8D70CB2B4DA7BD009F4C6C /* UITextField+.swift */,
2A31FF562B4F1E0400FEEED9 /* String+.swift */,
2F1741872B500C270089FC4D /* UIApplication+.swift */,
);
path = Extension;
sourceTree = "<group>";
Expand Down Expand Up @@ -457,6 +462,7 @@
2F8735452B4C34A500E55552 /* HomeCollectionView.swift */,
2F87354B2B4D28D700E55552 /* HomeCollectionFooterView.swift */,
2F8735492B4C427000E55552 /* UICollectionViewRegisterable.swift */,
2F1741892B500CC20089FC4D /* HomeBottomsheetView.swift */,
);
path = Views;
sourceTree = "<group>";
Expand Down Expand Up @@ -653,6 +659,7 @@
2A8D70BD2B4D61A1009F4C6C /* OnboardingDummy.swift in Sources */,
3C6193152B3A7A6400220CEB /* UIView+.swift in Sources */,
2AC9FB1F2B4E634A00D31071 /* JoinAgreeView.swift in Sources */,
2F1741882B500C270089FC4D /* UIApplication+.swift in Sources */,
3C61930C2B3A782100220CEB /* StringLiterals.swift in Sources */,
2F8735462B4C34A500E55552 /* HomeCollectionView.swift in Sources */,
3CEE4CBD2B500A7800F506AF /* DontBeTransparencyInfoView.swift in Sources */,
Expand Down Expand Up @@ -709,6 +716,7 @@
3CF184CB2B4EEC0B00816D5F /* MyPageViewController.swift in Sources */,
3C35565B2B494F0A0016BA49 /* UIColor+.swift in Sources */,
2AC9FB1B2B4DE77400D31071 /* AgreementListCustomView.swift in Sources */,
2F17418A2B500CC20089FC4D /* HomeBottomsheetView.swift in Sources */,
3C01692A2B4DC82D0075334B /* DontBePopupView.swift in Sources */,
2A2671FF2B4C3AF0009D214F /* Publisher+UIControl.swift in Sources */,
3C4993672B4F2644002A99CF /* MyPageContentViewController.swift in Sources */,
Expand Down
25 changes: 25 additions & 0 deletions DontBe-iOS/DontBe-iOS/Global/Extension/UIApplication+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// UIApplication+.swift
// DontBe-iOS
//
// Created by yeonsu on 1/11/24.
//

import Foundation

import UIKit

extension UIApplication {

/**
# keyWindowInConnectedScenes
- Note: iOS 13 keyWindow 경고 해결
*/
var keyWindowInConnectedScenes: UIWindow? {
if #available(iOS 13.0, *) {
return UIApplication.shared.windows.filter { $0.isKeyWindow }.first
} else {
return UIApplication.shared.keyWindow
}
}
}
4 changes: 4 additions & 0 deletions DontBe-iOS/DontBe-iOS/Global/Literals/ImageLiterals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ enum ImageLiterals {
static var imgTransparencyInfo5: UIImage { .load(name: "img_transparenc_info5") }
static var btnClose: UIImage { .load(name: "btn_close") }
}

enum Popup {
static var transparentButtonImage: UIImage { .load(name: "transparentPopUp") }
}
}

extension UIImage {
Expand Down
7 changes: 7 additions & 0 deletions DontBe-iOS/DontBe-iOS/Global/Literals/StringLiterals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,11 @@ enum StringLiterals {
static let content4 = "투명도가 -85%가 된 유저는\n더 이상 게시글과 답글을 작성할 수 없어요."
static let content5 = "투명도는 최근 5일 동안 버튼이 적용된 내용을 반영해요.\n5일이 지나면 적용되었던 투명도가 다시 회복돼요."
}

enum Home {
static let transparentPopupTitleLabel = "투명도 주기"
static let transparentPopupContentLabel = "지금 누르신 투명도 기능이 Don’t be를 더 온화한 커뮤니티로 만들기 위한 일이겠죠?"
static let transparentPopupLefteftButtonTitle = "조금 더 고민하기"
static let transparentPopupRightButtonTitle = "네, 맞아요"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "transparentPopUp.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
104 changes: 81 additions & 23 deletions DontBe-iOS/DontBe-iOS/Presentation/Helpers/DontBePopupView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ protocol DontBePopupDelegate: AnyObject {
}

final class DontBePopupView: UIView {

// MARK: - Properties

weak var delegate: DontBePopupDelegate?
Expand All @@ -25,10 +25,15 @@ final class DontBePopupView: UIView {
private let container: UIView = {
let view = UIView()
view.backgroundColor = .donWhite
view.layer.cornerRadius = 10
view.layer.cornerRadius = 10.adjusted
return view
}()

private let popupImageView: UIImageView = {
let popupImage = UIImageView()
return popupImage
}()

private let popupTitleLabel: UILabel = {
let label = UILabel()
label.textColor = .donBlack
Expand All @@ -42,13 +47,14 @@ final class DontBePopupView: UIView {
label.textColor = .donBlack
label.textAlignment = .center
label.font = UIFont.font(.body4)
label.numberOfLines = 0
return label
}()

private let buttonStackView: UIStackView = {
let stackView = UIStackView()
stackView.distribution = .fillEqually
stackView.spacing = 12
stackView.spacing = 12.adjusted
return stackView
}()

Expand All @@ -57,7 +63,7 @@ final class DontBePopupView: UIView {
button.setTitleColor(.donBlack, for: .normal)
button.titleLabel?.font = UIFont.font(.body3)
button.backgroundColor = .donGray3
button.layer.cornerRadius = 4
button.layer.cornerRadius = 4.adjusted
return button
}()

Expand All @@ -66,7 +72,7 @@ final class DontBePopupView: UIView {
button.setTitleColor(.donWhite, for: .normal)
button.titleLabel?.font = UIFont.font(.body3)
button.backgroundColor = .donBlack
button.layer.cornerRadius = 4
button.layer.cornerRadius = 4.adjusted
return button
}()

Expand All @@ -86,6 +92,23 @@ final class DontBePopupView: UIView {
setAddTarget()
}

init(popupImage: UIImage?, popupTitle: String, popupContent: String, leftButtonTitle: String, rightButtonTitle: String) {
super.init(frame: .zero)

popupTitleLabel.text = popupTitle // 팝업 타이틀
popupContentLabel.text = popupContent // 팝업 내용
cancleButton.setTitle(leftButtonTitle, for: .normal) // 팝업 왼쪽 버튼 타이틀
confirmButton.setTitle(rightButtonTitle, for: .normal) // 팝업 오른쪽 버튼 타이틀
if let image = popupImage {
popupImageView.image = image
}

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

@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
Expand All @@ -109,6 +132,10 @@ extension DontBePopupView {
container.addSubviews(popupTitleLabel, popupContentLabel, buttonStackView)
}

if popupImageView.image != nil {
container.addSubviews(popupImageView, popupTitleLabel, popupContentLabel, buttonStackView)
}

buttonStackView.addArrangedSubviews(cancleButton, confirmButton)
}

Expand All @@ -131,25 +158,56 @@ extension DontBePopupView {
$0.height.equalTo(44.adjusted)
}
} else {
container.snp.makeConstraints {
$0.leading.trailing.equalToSuperview().inset(24.adjusted)
$0.centerY.equalToSuperview()
}

popupTitleLabel.snp.makeConstraints {
$0.top.equalToSuperview().inset(24.adjusted)
$0.leading.trailing.equalToSuperview().inset(18.adjusted)
}

popupContentLabel.snp.makeConstraints {
$0.top.equalTo(popupTitleLabel.snp.bottom).offset(12.adjusted)
$0.leading.trailing.equalToSuperview().inset(18.adjusted)
$0.bottom.equalTo(cancleButton.snp.top).offset(-26.adjusted)
}

buttonStackView.snp.makeConstraints {
$0.leading.trailing.bottom.equalToSuperview().inset(20.adjusted)
$0.height.equalTo(44.adjusted)
if popupImageView.image != nil {
container.snp.makeConstraints {
$0.leading.trailing.equalToSuperview().inset(24.adjusted)
$0.centerY.equalToSuperview()
}

popupImageView.snp.makeConstraints {
$0.top.equalToSuperview().inset(38.adjusted)
$0.size.equalTo(116.adjusted)
$0.centerX.equalToSuperview()
}

popupTitleLabel.snp.makeConstraints {
$0.top.equalTo(popupImageView.snp.bottom).offset(24.adjusted)
$0.leading.trailing.equalToSuperview().inset(18.adjusted)
}

popupContentLabel.snp.makeConstraints {
$0.top.equalTo(popupTitleLabel.snp.bottom).offset(12.adjusted)
$0.leading.trailing.equalToSuperview().inset(18.adjusted)
$0.bottom.equalTo(cancleButton.snp.top).offset(-26.adjusted)
}

buttonStackView.snp.makeConstraints {
$0.leading.trailing.bottom.equalToSuperview().inset(20.adjusted)
$0.height.equalTo(44.adjusted)
}
} else {

container.snp.makeConstraints {
$0.leading.trailing.equalToSuperview().inset(24.adjusted)
$0.centerY.equalToSuperview()
}

popupTitleLabel.snp.makeConstraints {
$0.top.equalToSuperview().inset(24.adjusted)
$0.leading.trailing.equalToSuperview().inset(18.adjusted)
}

popupContentLabel.snp.makeConstraints {
$0.top.equalTo(popupTitleLabel.snp.bottom).offset(12.adjusted)
$0.leading.trailing.equalToSuperview().inset(18.adjusted)
$0.bottom.equalTo(cancleButton.snp.top).offset(-26.adjusted)
}

buttonStackView.snp.makeConstraints {
$0.leading.trailing.bottom.equalToSuperview().inset(20.adjusted)
$0.height.equalTo(44.adjusted)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ final class HomeCollectionViewCell: UICollectionViewCell, UICollectionViewRegist

// MARK: - Properties

var KebabButtonAction: (() -> Void) = {}
var LikeButtonAction: (() -> Void) = {}
var TransparentButtonAction: (() -> Void) = {}
var isLiked: Bool = false

// MARK: - UI Components

private let backgroundUIView: UIView = {
Expand Down Expand Up @@ -87,7 +92,7 @@ final class HomeCollectionViewCell: UICollectionViewCell, UICollectionViewRegist
return stackView
}()

private let likeButton: UIButton = {
let likeButton: UIButton = {
let button = UIButton()
button.setImage(ImageLiterals.Posting.btnFavoriteInActive, for: .normal)
return button
Expand Down Expand Up @@ -144,6 +149,7 @@ final class HomeCollectionViewCell: UICollectionViewCell, UICollectionViewRegist
setUI()
setHierarchy()
setLayout()
setAddTarget()
}

required init?(coder: NSCoder) {
Expand All @@ -164,16 +170,16 @@ extension HomeCollectionViewCell {
backgroundUIView.addSubviews(profileImageView,
nicknameLabel,
transparentLabel,
dotLabel,
dotLabel,
timeLabel,
kebabButton,
contentTextLabel,
contentTextLabel,
commentStackView,
likeStackView,
ghostButton,
verticalTextBarView)

likeStackView.addArrangedSubviews(likeButton,
likeStackView.addArrangedSubviews(likeButton,
likeNumLabel)
}

Expand Down Expand Up @@ -222,14 +228,14 @@ extension HomeCollectionViewCell {

commentStackView.snp.makeConstraints {
$0.top.equalTo(contentTextLabel.snp.bottom).offset(4.adjusted)
$0.height.equalTo(42.adjusted)
$0.trailing.equalTo(likeStackView.snp.leading).offset(-10.adjusted)
$0.height.equalTo(commentStackView)
$0.trailing.equalTo(kebabButton).inset(8.adjusted)
}

likeStackView.snp.makeConstraints {
$0.top.equalTo(commentStackView)
$0.height.equalTo(commentStackView)
$0.trailing.equalTo(kebabButton).inset(8.adjusted)
$0.height.equalTo(42.adjusted)
$0.trailing.equalTo(commentStackView.snp.leading).offset(-10.adjusted)
}

ghostButton.snp.makeConstraints {
Expand All @@ -245,4 +251,24 @@ extension HomeCollectionViewCell {
$0.centerX.equalTo(profileImageView)
}
}

func setAddTarget() {
kebabButton.addTarget(self, action: #selector(showButtons), for: .touchUpInside)
likeButton.addTarget(self, action: #selector(likeToggleButton), for: .touchUpInside)
ghostButton.addTarget(self, action: #selector(transparentShowPopupButton), for: .touchUpInside)
}

@objc
func showButtons() {
KebabButtonAction()
}

@objc
func likeToggleButton() {
LikeButtonAction()
}
@objc
func transparentShowPopupButton() {
TransparentButtonAction()
}
}
Loading

0 comments on commit 309300b

Please sign in to comment.