Skip to content

Commit

Permalink
Merge pull request team-peekabook#286 from duyeong-ko/fix/team-peekab…
Browse files Browse the repository at this point in the history
…ook#275-바텀시트기능원래대로

[Fix] team-peekabook#275 - 책 0권일 때 추천버튼 isHidden 처리
  • Loading branch information
duyeong-ko authored Mar 24, 2024
2 parents ee95adc + e2e9619 commit ddcdaf0
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 72 deletions.
14 changes: 4 additions & 10 deletions Peekabook/Peekabook.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1466,11 +1466,9 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Peekabook/Peekabook.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 23090804;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = R6RDNJW78B;
DEVELOPMENT_TEAM = 6SUGCZ4YRX;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Peekabook/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "피카북";
Expand All @@ -1492,7 +1490,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.sopt.peekabook.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "peekabook release";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -1506,11 +1503,9 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Peekabook/Peekabook.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 23090804;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = R6RDNJW78B;
DEVELOPMENT_TEAM = 6SUGCZ4YRX;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Peekabook/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "피카북";
Expand All @@ -1532,7 +1527,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.sopt.peekabook.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "peekabook release";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/abseil-cpp-binary.git",
"state" : {
"revision" : "bfc0b6f81adc06ce5121eb23f628473638d67c5c",
"version" : "1.2022062300.0"
"revision" : "df308b8b46607675f2b9ec8e569109008f9155ce",
"version" : "1.2022062300.1"
}
},
{
Expand Down Expand Up @@ -41,44 +41,44 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/firebase-ios-sdk.git",
"state" : {
"revision" : "f91c8167141d0279726c6f6d9d4a47c026785cbc",
"version" : "10.21.0"
"revision" : "be49849dcba96f2b5ee550d4eceb2c0fa27dade4",
"version" : "10.22.1"
}
},
{
"identity" : "googleappmeasurement",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleAppMeasurement.git",
"state" : {
"revision" : "cb8617fab75d181270a1d8f763f26b15c73e2e1e",
"version" : "10.21.0"
"revision" : "482cfa4e5880f0a29f66ecfd60c5a62af28bd1f0",
"version" : "10.22.1"
}
},
{
"identity" : "googledatatransport",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleDataTransport.git",
"state" : {
"revision" : "a732a4b47f59e4f725a2ea10f0c77e93a7131117",
"version" : "9.3.0"
"revision" : "a637d318ae7ae246b02d7305121275bc75ed5565",
"version" : "9.4.0"
}
},
{
"identity" : "googleutilities",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleUtilities.git",
"state" : {
"revision" : "bc27fad73504f3d4af235de451f02ee22586ebd3",
"version" : "7.12.1"
"revision" : "26c898aed8bed13b8a63057ee26500abbbcb8d55",
"version" : "7.13.1"
}
},
{
"identity" : "grpc-binary",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/grpc-binary.git",
"state" : {
"revision" : "a673bc2937fbe886dd1f99c401b01b6d977a9c98",
"version" : "1.49.1"
"revision" : "ea4cb5cc0c39c732b85386263116d2e2fdbbdc61",
"version" : "1.49.2"
}
},
{
Expand Down Expand Up @@ -122,8 +122,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/leveldb.git",
"state" : {
"revision" : "9d108e9112aa1d65ce508facf804674546116d9c",
"version" : "1.22.3"
"revision" : "43aaef65e0c665daadf848761d560e446d350d3d",
"version" : "1.22.4"
}
},
{
Expand All @@ -140,8 +140,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/nanopb.git",
"state" : {
"revision" : "819d0a2173aff699fb8c364b6fb906f7cdb1a692",
"version" : "2.30909.0"
"revision" : "b7e1104502eca3a213b46303391ca4d3bc8ddec1",
"version" : "2.30910.0"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,10 @@ extension BookShelfVC {
let contentOffset = CGPoint(x: 0, y: 0)
pickCollectionView.setContentOffset(contentOffset, animated: true)
}

func setEditOrRecommendButtonHidden(_ isHidden: Bool) {
editOrRecommendButton.isHidden = isHidden
}
}

// MARK: - UICollectionViewDelegate, UICollectionViewDataSource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@ final class BottomBookShelfVC: UIViewController {
// MARK: - Properties

private var bookTotalNum: Int = 0
var isSheetUp: Bool = false
var bookShelfType: BookShelfType = .user
private var isInitialLoad = true
private var books: [Book] = []
private var fullView: CGFloat {
return SafeAreaHeight.safeAreaTopInset() + 52
}
private var middleView: CGFloat {
return SafeAreaHeight.safeAreaTopInset() + 250
}

private var partialView: CGFloat {
if UIScreen.main.isSmallThan712pt {
Expand Down Expand Up @@ -95,10 +91,7 @@ final class BottomBookShelfVC: UIViewController {

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

if bookTotalNum == 0 {
setEmptyAnimateView()
}
setInitialAnimateView()
}

// MARK: - @objc Function
Expand Down Expand Up @@ -190,8 +183,8 @@ extension BottomBookShelfVC {
}

emptyDescriptionLabel.snp.makeConstraints {
$0.top.equalTo(booksCountLabel.snp.bottom).offset(190)
$0.centerX.equalToSuperview()
$0.centerY.equalToSuperview().multipliedBy(0.8)
}

emptyDescriptionImage.snp.makeConstraints {
Expand Down Expand Up @@ -222,7 +215,7 @@ extension BottomBookShelfVC {
bookShelfCollectionView.register(BookShelfCVC.self, forCellWithReuseIdentifier: BookShelfCVC.className)
}

private func setPriorAnimateView() {
private func setInitialAnimateView() {
if isInitialLoad {
self.view.frame = CGRect(x: 0,
y: partialView,
Expand All @@ -231,34 +224,6 @@ extension BottomBookShelfVC {
isInitialLoad = false
}
}

private func setInitialAnimateView() {
self.view.frame = CGRect(x: 0, y: partialView, width: view.frame.width, height: view.frame.height)
holdView.isHidden = false
enablePanGesture()
}

private func setEmptyAnimateView() {
self.view.frame = CGRect(x: 0, y: middleView, width: view.frame.width, height: view.frame.height)
holdView.isHidden = true
disablePanGesture()
}

private func enablePanGesture() {
for gestureRecognizer in view.gestureRecognizers ?? [] {
if let panGestureRecognizer = gestureRecognizer as? UIPanGestureRecognizer {
panGestureRecognizer.isEnabled = true
}
}
}

private func disablePanGesture() {
for gestureRecognizer in view.gestureRecognizers ?? [] {
if let panGestureRecognizer = gestureRecognizer as? UIPanGestureRecognizer {
panGestureRecognizer.isEnabled = false
}
}
}

private func roundViews() {
view.layer.cornerRadius = 15
Expand All @@ -283,16 +248,16 @@ extension BottomBookShelfVC {
self.booksCountLabel.text = "\(String(bookTotalNum)) Books"
bookShelfCollectionView.reloadData()

if bookTotalNum == 0 {
setEmptyAnimateView() // 아예 책장이 위에 딱 붙는 상태
if bookTotalNum == 0 && bookShelfType == .user {
if let bookShelfVC = parent as? BookShelfVC {
bookShelfVC.setEditOrRecommendButtonHidden(true)
}
} else {
if isSheetUp == true {
setPriorAnimateView() // 책장 상태 올라간 기존상태 유지
isSheetUp = false
} else {
setInitialAnimateView() // 책장 내려간 상태
if let bookShelfVC = parent as? BookShelfVC {
bookShelfVC.setEditOrRecommendButtonHidden(false)
}
}

}

func changeLayout(isUser: Bool) {
Expand Down Expand Up @@ -335,7 +300,6 @@ extension BottomBookShelfVC: UICollectionViewDelegate, UICollectionViewDataSourc
bookShelfCollectionView.isUserInteractionEnabled = true

let bookDetailVC = BookDetailVC()
isSheetUp = true
if bookShelfType == .user {
bookDetailVC.changeUserViewLayout()
}
Expand Down Expand Up @@ -399,3 +363,4 @@ extension BottomBookShelfVC: UIGestureRecognizerDelegate {
return false
}
}

0 comments on commit ddcdaf0

Please sign in to comment.