Skip to content

Commit

Permalink
[#142] Pull Develop
Browse files Browse the repository at this point in the history
  • Loading branch information
meenyweeny committed Aug 16, 2022
2 parents 131fb64 + d7ce669 commit 8be5b64
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 207 deletions.
40 changes: 4 additions & 36 deletions Deartoday/Deartoday.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
9803F3D52885950F00A5A239 /* CheckMessageAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9803F3D42885950F00A5A239 /* CheckMessageAPI.swift */; };
9803F3D82885953B00A5A239 /* CheckMessageService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9803F3D72885953B00A5A239 /* CheckMessageService.swift */; };
9803F3E62885E0AD00A5A239 /* CheckTimeTravelDetailResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9803F3E52885E0AD00A5A239 /* CheckTimeTravelDetailResponse.swift */; };
981B059128A77AAF00394AE8 /* MessageDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 981B059028A77AAF00394AE8 /* MessageDetailViewController.swift */; };
98245CE3288699A6007821FA /* CheckTimeTravelDetail.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 98245CE2288699A6007821FA /* CheckTimeTravelDetail.storyboard */; };
98245CE728869A0A007821FA /* CheckTimeTravelDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98245CE628869A0A007821FA /* CheckTimeTravelDetailViewController.swift */; };
98245CF028869CCB007821FA /* PastImageCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98245CEE28869CCB007821FA /* PastImageCollectionViewCell.swift */; };
Expand All @@ -93,9 +94,6 @@
98A4750A287DECCF008891F5 /* CheckTimeTravel.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 98A47509287DECCF008891F5 /* CheckTimeTravel.storyboard */; };
98A4750F287DECF7008891F5 /* CheckTImeTravelDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98A4750E287DECF7008891F5 /* CheckTImeTravelDataModel.swift */; };
98A47513287DED14008891F5 /* CheckTimeTravelViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98A47512287DED14008891F5 /* CheckTimeTravelViewController.swift */; };
98A47516287E0106008891F5 /* CheckMessageDetail.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 98A47515287E0106008891F5 /* CheckMessageDetail.storyboard */; };
98A47519287E0129008891F5 /* CheckMessageDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98A47518287E0129008891F5 /* CheckMessageDetailViewController.swift */; };
98A4751C287E013F008891F5 /* CheckMessageDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98A4751B287E013F008891F5 /* CheckMessageDetailView.swift */; };
98A71D5A2882EEBA009508D9 /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 98A71D592882EEBA009508D9 /* Colors.xcassets */; };
98AD713928884FF700E910CD /* CheckMessageResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98AD713828884FF700E910CD /* CheckMessageResponse.swift */; };
98B4B5AA287EB54600F4AD7A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98B4B5A9287EB54600F4AD7A /* ViewController.swift */; };
Expand Down Expand Up @@ -190,6 +188,7 @@
9803F3D42885950F00A5A239 /* CheckMessageAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckMessageAPI.swift; sourceTree = "<group>"; };
9803F3D72885953B00A5A239 /* CheckMessageService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckMessageService.swift; sourceTree = "<group>"; };
9803F3E52885E0AD00A5A239 /* CheckTimeTravelDetailResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckTimeTravelDetailResponse.swift; sourceTree = "<group>"; };
981B059028A77AAF00394AE8 /* MessageDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageDetailViewController.swift; sourceTree = "<group>"; };
98245CE2288699A6007821FA /* CheckTimeTravelDetail.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = CheckTimeTravelDetail.storyboard; sourceTree = "<group>"; };
98245CE628869A0A007821FA /* CheckTimeTravelDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckTimeTravelDetailViewController.swift; sourceTree = "<group>"; };
98245CEE28869CCB007821FA /* PastImageCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PastImageCollectionViewCell.swift; sourceTree = "<group>"; };
Expand All @@ -212,9 +211,6 @@
98A47509287DECCF008891F5 /* CheckTimeTravel.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = CheckTimeTravel.storyboard; sourceTree = "<group>"; };
98A4750E287DECF7008891F5 /* CheckTImeTravelDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckTImeTravelDataModel.swift; sourceTree = "<group>"; };
98A47512287DED14008891F5 /* CheckTimeTravelViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckTimeTravelViewController.swift; sourceTree = "<group>"; };
98A47515287E0106008891F5 /* CheckMessageDetail.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = CheckMessageDetail.storyboard; sourceTree = "<group>"; };
98A47518287E0129008891F5 /* CheckMessageDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckMessageDetailViewController.swift; sourceTree = "<group>"; };
98A4751B287E013F008891F5 /* CheckMessageDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckMessageDetailView.swift; sourceTree = "<group>"; };
98A71D592882EEBA009508D9 /* Colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Colors.xcassets; sourceTree = "<group>"; };
98AD713828884FF700E910CD /* CheckMessageResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckMessageResponse.swift; sourceTree = "<group>"; };
98B4B5A9287EB54600F4AD7A /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -542,7 +538,6 @@
98245CDE28869980007821FA /* CheckTimeTravelDetail */,
4A2CEA6C2885A58A00DC9CC9 /* Splash */,
4ADAB7DA28846C9D0049C465 /* Initial */,
98A47514287E00F1008891F5 /* CheckMessageDetail */,
924814A8287EB490001177B1 /* Dialog */,
98A47508287DECB6008891F5 /* CheckTimeTravel */,
98D912C6287DC2FF0088A7F9 /* CheckMessage */,
Expand Down Expand Up @@ -888,32 +883,6 @@
path = Model;
sourceTree = "<group>";
};
98A47514287E00F1008891F5 /* CheckMessageDetail */ = {
isa = PBXGroup;
children = (
98A47515287E0106008891F5 /* CheckMessageDetail.storyboard */,
98A4751A287E0136008891F5 /* View */,
98A47517287E011F008891F5 /* Controller */,
);
path = CheckMessageDetail;
sourceTree = "<group>";
};
98A47517287E011F008891F5 /* Controller */ = {
isa = PBXGroup;
children = (
98A47518287E0129008891F5 /* CheckMessageDetailViewController.swift */,
);
path = Controller;
sourceTree = "<group>";
};
98A4751A287E0136008891F5 /* View */ = {
isa = PBXGroup;
children = (
98A4751B287E013F008891F5 /* CheckMessageDetailView.swift */,
);
path = View;
sourceTree = "<group>";
};
98A71D582882EEAC009508D9 /* Color */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -984,6 +953,7 @@
isa = PBXGroup;
children = (
986E000028A4DCC9008EB3F2 /* CheckMessageViewController.swift */,
981B059028A77AAF00394AE8 /* MessageDetailViewController.swift */,
);
path = Controller;
sourceTree = "<group>";
Expand Down Expand Up @@ -1094,7 +1064,6 @@
9803F3912882F3C300A5A239 /* timetape.json in Resources */,
98A71D5A2882EEBA009508D9 /* Colors.xcassets in Resources */,
986F5C4128883469001109F1 /* PresentDialogCollectionViewCell.xib in Resources */,
98A47516287E0106008891F5 /* CheckMessageDetail.storyboard in Resources */,
98BFBCC22879B66A00F01F04 /* GmarketSansMedium.otf in Resources */,
92DB353A2875633F001E2006 /* Assets.xcassets in Resources */,
984099E92881F4A700025092 /* sound_box.mp3 in Resources */,
Expand Down Expand Up @@ -1156,6 +1125,7 @@
files = (
92DB35682875656C001E2006 /* DDSButton.swift in Sources */,
923061D82877550E00F04EDA /* TimeTravelViewController.swift in Sources */,
981B059128A77AAF00394AE8 /* MessageDetailViewController.swift in Sources */,
98D912AE287D558A0088A7F9 /* DeartodayModel.swift in Sources */,
923061D6287754FA00F04EDA /* TimeTravelView.swift in Sources */,
4A916177288921FD00F72BFC /* SettingViewController.swift in Sources */,
Expand All @@ -1165,7 +1135,6 @@
988B471F28AAB38900D015D5 /* MainViewController.swift in Sources */,
4ADAB7E9288507A10049C465 /* LoginResponse.swift in Sources */,
986E000328A62A04008EB3F2 /* MessageCollectionViewCell.swift in Sources */,
98A47519287E0129008891F5 /* CheckMessageDetailViewController.swift in Sources */,
986F5C3C2888345E001109F1 /* PastDialogCollectionViewCell.swift in Sources */,
9803F3B428847C9100A5A239 /* MainResponse.swift in Sources */,
9803F3D82885953B00A5A239 /* CheckMessageService.swift in Sources */,
Expand Down Expand Up @@ -1234,7 +1203,6 @@
4A2CEA772885A91F00DC9CC9 /* SplashViewController.swift in Sources */,
98BFBCD12879BBB700F01F04 /* UIColor+.swift in Sources */,
4ADAB7E4288505A60049C465 /* LoginAPI.swift in Sources */,
98A4751C287E013F008891F5 /* CheckMessageDetailView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,10 @@ final class CheckMessageViewController: UIViewController {

extension CheckMessageViewController: UICollectionViewDelegate {
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
guard let messageDetail = UIStoryboard(name: Constant.Storyboard.CheckMessageDetail, bundle: nil)
.instantiateViewController(withIdentifier: Constant.ViewController.CheckMessageDetail) as? CheckMessageDetailViewController else { return }
let messageDetail = MessageDetailViewController()
messageDetail.modalPresentationStyle = .overFullScreen
messageDetail.content = messages[indexPath.item].message
present(messageDetail, animated: false, completion: nil)
present(messageDetail, animated: false)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
//
// MessageDetailViewController.swift
// Deartoday
//
// Created by ์ด๊ฒฝ๋ฏผ on 2022/08/13.
//

import UIKit

import SnapKit
import Then

final class MessageDetailViewController: UIViewController {

// MARK: - Property

internal var content: String = ""
private let messageWidth = UIScreen.main.bounds.width - 175

// MARK: - UI Property

private let messageView = UIView().then {
$0.backgroundColor = .yellow03
}

private lazy var scrollView: UIScrollView = {
return UIScrollView(frame: .zero).then {
$0.backgroundColor = .clear
$0.bounces = false
$0.contentInsetAdjustmentBehavior = .never
}
}()

private let contentView = UIView().then {
$0.backgroundColor = .clear
}

private lazy var contentLabel = UILabel().then {
$0.font = .p6
$0.textColor = .black
$0.numberOfLines = 0
$0.lineBreakMode = .byCharWrapping
$0.text = content
$0.setTextWithLineHeight(text: content, lineHeight: 16.8)
$0.sizeToFit()
}

private let writerLabel = UILabel().then {
$0.font = .p6
$0.textColor = .black
$0.text = "From. ๋ฏธ๋ž˜์˜ ๋‚˜"
}

private let closeButton = UIButton().then {
$0.setImage(Constant.Image.icClose, for: .normal)
$0.addTarget(self, action: #selector(closeButtonDidTap), for: .touchUpInside)
}

// MARK: - Life Cycle

override func viewDidLoad() {
super.viewDidLoad()
setUI()
setLayout()
}

override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
setDynamicHeight()
}

// MARK: - @objc

@objc private func closeButtonDidTap() {
dismiss(animated: false)
}

// MARK: - Custom Method

private func setUI() {
view.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.7)
}

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

private func setDynamicHeight() {
let maxHeight = getDeviceHeight() - 400
let contentHeight = contentLabel.frame.height + 80
let messageHeight = contentHeight < messageWidth ? messageWidth :
(contentHeight > maxHeight ? maxHeight : contentHeight)

messageView.snp.updateConstraints { make in
make.height.equalTo(messageHeight)
}
scrollView.snp.updateConstraints { make in
make.height.equalTo(messageHeight - 80)
}
}

private func setHierarchy() {
view.addSubviews([messageView, closeButton])
messageView.addSubviews([scrollView, writerLabel])
scrollView.addSubview(contentView)
contentView.addSubview(contentLabel)
}

private func setConstraint() {
messageView.snp.makeConstraints { make in
make.width.height.equalTo(messageWidth)
make.centerX.centerY.equalTo(view.safeAreaLayoutGuide)
}

closeButton.snp.makeConstraints { make in
make.top.equalTo(messageView.snp.bottom).offset(8)
make.width.height.equalTo(44)
make.centerX.equalTo(messageView)
}

writerLabel.snp.makeConstraints { make in
make.leading.equalToSuperview().inset(20)
make.bottom.equalToSuperview().inset(13)
}

scrollView.snp.makeConstraints { make in
make.top.leading.trailing.equalToSuperview().inset(20)
make.height.equalTo(messageWidth - 80)
}

contentView.snp.makeConstraints { make in
make.top.leading.trailing.bottom.equalToSuperview().inset(0)
make.width.equalToSuperview()
make.height.equalToSuperview().priority(.low)
}

contentLabel.snp.makeConstraints { make in
make.top.leading.equalToSuperview().inset(0)
make.trailing.equalTo(messageView.snp.trailing).inset(20)
make.bottom.equalToSuperview().inset(0)
}
}
}
Loading

0 comments on commit 8be5b64

Please sign in to comment.