Skip to content

Commit

Permalink
[Merge] #102 - 투명도 버튼 적용 구현 완료
Browse files Browse the repository at this point in the history
Feat [#101] 투명도 버튼 적용 구현 완료
  • Loading branch information
boogios authored Jan 18, 2024
2 parents f124727 + 0da9b8c commit 898a76e
Show file tree
Hide file tree
Showing 7 changed files with 155 additions and 29 deletions.
4 changes: 4 additions & 0 deletions DontBe-iOS/DontBe-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
3C70BE332B53EF92001AA5A6 /* MyPageViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C70BE322B53EF92001AA5A6 /* MyPageViewModel.swift */; };
3C7741522B5311750069E694 /* MyPageAccountInfoTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C7741512B5311750069E694 /* MyPageAccountInfoTableViewCell.swift */; };
3C7741542B531AC80069E694 /* AccountInfoDummy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C7741532B531AC80069E694 /* AccountInfoDummy.swift */; };
3CB634CA2B59080E00DB9DA5 /* DontBeTransparencyGrayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CB634C92B59080E00DB9DA5 /* DontBeTransparencyGrayView.swift */; };
3CBCA3CA2B57212400D348D3 /* MyPageMemberCommentResponseDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CBCA3C92B57212400D348D3 /* MyPageMemberCommentResponseDTO.swift */; };
3CBCA3CC2B573F9000D348D3 /* MyPageProfileViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CBCA3CB2B573F9000D348D3 /* MyPageProfileViewModel.swift */; };
3CBF99222B549B8C0015FE4B /* WriteContentRequestDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CBF99212B549B8C0015FE4B /* WriteContentRequestDTO.swift */; };
Expand Down Expand Up @@ -261,6 +262,7 @@
3C70BE322B53EF92001AA5A6 /* MyPageViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageViewModel.swift; sourceTree = "<group>"; };
3C7741512B5311750069E694 /* MyPageAccountInfoTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageAccountInfoTableViewCell.swift; sourceTree = "<group>"; };
3C7741532B531AC80069E694 /* AccountInfoDummy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountInfoDummy.swift; sourceTree = "<group>"; };
3CB634C92B59080E00DB9DA5 /* DontBeTransparencyGrayView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DontBeTransparencyGrayView.swift; sourceTree = "<group>"; };
3CBCA3C92B57212400D348D3 /* MyPageMemberCommentResponseDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageMemberCommentResponseDTO.swift; sourceTree = "<group>"; };
3CBCA3CB2B573F9000D348D3 /* MyPageProfileViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageProfileViewModel.swift; sourceTree = "<group>"; };
3CBF99212B549B8C0015FE4B /* WriteContentRequestDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WriteContentRequestDTO.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1031,6 +1033,7 @@
3CEE4CC12B503F9E00F506AF /* DontBeCustomInfoView.swift */,
3C2F544D2B50F65500E7BF01 /* DontBeBottomSheetView.swift */,
3CD25D282B5482FE0075F80F /* DontBeBottomSheetButton.swift */,
3CB634C92B59080E00DB9DA5 /* DontBeTransparencyGrayView.swift */,
3CE9C1342B4C4BC20086E4A3 /* CircleProgressbar.swift */,
2A2672042B4C3C00009D214F /* CancelBag.swift */,
2A8D70C22B4D7FF5009F4C6C /* BackButton.swift */,
Expand Down Expand Up @@ -1305,6 +1308,7 @@
2A5183022B569BDA00B43BA8 /* UserProfileRequestDTO.swift in Sources */,
2AC9FB1B2B4DE77400D31071 /* AgreementListCustomView.swift in Sources */,
2F17418A2B500CC20089FC4D /* HomeBottomsheetView.swift in Sources */,
3CB634CA2B59080E00DB9DA5 /* DontBeTransparencyGrayView.swift in Sources */,
2FBBADF82B53EF63002D6286 /* PostPopupView.swift in Sources */,
2FB64FF02B5310DD0082A414 /* WriteReplyViewController.swift in Sources */,
3C01692A2B4DC82D0075334B /* DontBePopupView.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// DontBeTransparencyGrayView.swift
// DontBe-iOS
//
// Created by 변상우 on 1/18/24.
//

import UIKit

import SnapKit

final class DontBeTransparencyGrayView: UIView {

// MARK: - Properties

// MARK: - UI Components

// MARK: - Life Cycles

override init(frame: CGRect) {
super.init(frame: frame)

setUI()
setHierarchy()
setLayout()
}

@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

// MARK: - Extensions

extension DontBeTransparencyGrayView {
private func setUI() {
self.backgroundColor = .donGray1
}

private func setHierarchy() {

}

private func setLayout() {

}
}

Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ final class HomeCollectionViewCell: UICollectionViewCell, UICollectionViewRegist
return view
}()

let grayView: DontBeTransparencyGrayView = {
let view = DontBeTransparencyGrayView()
view.layer.cornerRadius = 8.adjusted
view.alpha = 0
view.isUserInteractionEnabled = false
return view
}()

let profileImageView: UIImageView = {
let image = UIImageView()
image.contentMode = .scaleAspectFill
Expand Down Expand Up @@ -169,7 +177,7 @@ extension HomeCollectionViewCell {
}

func setHierarchy() {
contentView.addSubviews(backgroundUIView)
contentView.addSubviews(backgroundUIView, grayView)

backgroundUIView.addSubviews(profileImageView,
nicknameLabel,
Expand All @@ -194,6 +202,10 @@ extension HomeCollectionViewCell {
$0.width.equalTo(UIScreen.main.bounds.width - 32)
}

grayView.snp.makeConstraints {
$0.edges.equalToSuperview()
}

profileImageView.snp.makeConstraints {
$0.leading.equalTo(10.adjusted)
$0.top.equalTo(18.adjusted)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,14 @@ extension HomeViewController: UICollectionViewDataSource, UICollectionViewDelega
cell.likeButton.setImage(viewModel.postData[indexPath.row].isLiked ? ImageLiterals.Posting.btnFavoriteActive : ImageLiterals.Posting.btnFavoriteInActive, for: .normal)
cell.isLiked = self.viewModel.postData[indexPath.row].isLiked

// 내가 투명도를 누른 유저인 경우 -85% 적용
if self.viewModel.postData[indexPath.row].isGhost {
cell.grayView.alpha = 0.85
} else {
let alpha = self.viewModel.postData[indexPath.row].memberGhost
cell.grayView.alpha = CGFloat(Double(-alpha) / 100)
}

self.contentId = viewModel.postData[indexPath.row].contentId

return cell
Expand Down Expand Up @@ -408,6 +416,7 @@ extension HomeViewController: DontBePopupDelegate {
alarmTriggerType: self.alarmTriggerType,
targetMemberId: self.targetMemberId,
alarmTriggerId: self.alarmTriggerdId)
refreshPost()
if result?.status == 400 {
// 이미 투명도를 누른 대상인 경우, 토스트 메시지 보여주기
showAlreadyTransparencyToast()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ final class MyPageViewController: UIViewController {

let rootView = MyPageView()

let statusBarView = UIView(frame: UIApplication.shared.statusBarFrame)

// MARK: - Life Cycles

override func loadView() {
Expand Down Expand Up @@ -80,14 +78,12 @@ final class MyPageViewController: UIViewController {

self.navigationItem.title = StringLiterals.MyPage.MyPageNavigationTitle
self.navigationController?.navigationBar.titleTextAttributes = [.foregroundColor: UIColor.donWhite]
tabBarController?.tabBar.isHidden = false
}

override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(true)

self.navigationController?.navigationBar.backgroundColor = .clear
statusBarView.removeFromSuperview()
}

override func viewDidLayoutSubviews() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ final class PostReplyCollectionViewCell: UICollectionViewCell, UICollectionViewR
return view
}()

let grayView: DontBeTransparencyGrayView = {
let view = DontBeTransparencyGrayView()
view.layer.cornerRadius = 8.adjusted
view.alpha = 0
view.isUserInteractionEnabled = false
return view
}()

let profileImageView: UIImageView = {
let image = UIImageView()
image.contentMode = .scaleAspectFill
Expand Down Expand Up @@ -160,7 +168,8 @@ extension PostReplyCollectionViewCell {
func setHierarchy() {
contentView.addSubviews(horizontalCellBarCircleView,
backgroundUIView,
horizontalCellBarView)
horizontalCellBarView,
grayView)

backgroundUIView.addSubviews(profileImageView,
nicknameLabel,
Expand All @@ -185,6 +194,13 @@ extension PostReplyCollectionViewCell {
$0.width.equalTo(UIScreen.main.bounds.width - 64.adjusted)
}

grayView.snp.makeConstraints {
$0.top.bottom.equalToSuperview()
$0.leading.equalToSuperview().inset(14.adjusted)
$0.trailing.equalToSuperview()
$0.width.equalTo(UIScreen.main.bounds.width - 64.adjusted)
}

horizontalCellBarView.snp.makeConstraints {
$0.centerY.equalTo(backgroundUIView)
$0.trailing.equalTo(backgroundUIView.snp.leading)
Expand Down
Loading

0 comments on commit 898a76e

Please sign in to comment.