Skip to content

Commit

Permalink
[Merge] #105 - 404 페이지 구현 및 답글에서 프로필 클릭시 유저페이지로 이동 및 유저 투명도에 따른 글쓰기 분기처리
Browse files Browse the repository at this point in the history
Feat [#105] 404 페이지 구현 및 답글에서 프로필 클릭시 유저페이지로 이동 및 유저 투명도에 따른 글쓰기 분기처리
  • Loading branch information
Heyjooo authored Jan 18, 2024
2 parents c02ae56 + a43648d commit 877714c
Show file tree
Hide file tree
Showing 27 changed files with 381 additions and 12 deletions.
16 changes: 16 additions & 0 deletions DontBe-iOS/DontBe-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
2A5220EF2B507F97001510B7 /* NotificationViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A5220EE2B507F97001510B7 /* NotificationViewModel.swift */; };
2A5220F22B507FAE001510B7 /* NotificationTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A5220F12B507FAE001510B7 /* NotificationTableViewCell.swift */; };
2A5D68F82B58E9C0000AE1B7 /* CommentLikeRequestDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A5D68F72B58E9C0000AE1B7 /* CommentLikeRequestDTO.swift */; };
2A5D68FC2B5938BD000AE1B7 /* ErrorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A5D68FB2B5938BD000AE1B7 /* ErrorViewController.swift */; };
2A5D68FE2B596640000AE1B7 /* WriteBanView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A5D68FD2B596640000AE1B7 /* WriteBanView.swift */; };
2A6D54C12B479B4300F9891E /* adjusted+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A6D54C02B479B4300F9891E /* adjusted+.swift */; };
2A6D54C32B493A8400F9891E /* UIFont+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A6D54C22B493A8400F9891E /* UIFont+.swift */; };
2A6D54C62B493E3F00F9891E /* Pretendard-SemiBold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 2A6D54C42B493E3F00F9891E /* Pretendard-SemiBold.otf */; };
Expand Down Expand Up @@ -177,6 +179,8 @@
2A5220EE2B507F97001510B7 /* NotificationViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationViewModel.swift; sourceTree = "<group>"; };
2A5220F12B507FAE001510B7 /* NotificationTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationTableViewCell.swift; sourceTree = "<group>"; };
2A5D68F72B58E9C0000AE1B7 /* CommentLikeRequestDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommentLikeRequestDTO.swift; sourceTree = "<group>"; };
2A5D68FB2B5938BD000AE1B7 /* ErrorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErrorViewController.swift; sourceTree = "<group>"; };
2A5D68FD2B596640000AE1B7 /* WriteBanView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WriteBanView.swift; sourceTree = "<group>"; };
2A6D54C02B479B4300F9891E /* adjusted+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "adjusted+.swift"; sourceTree = "<group>"; };
2A6D54C22B493A8400F9891E /* UIFont+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIFont+.swift"; sourceTree = "<group>"; };
2A6D54C42B493E3F00F9891E /* Pretendard-SemiBold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-SemiBold.otf"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -461,6 +465,14 @@
path = Models;
sourceTree = "<group>";
};
2A5D68FA2B593864000AE1B7 /* 404 */ = {
isa = PBXGroup;
children = (
2A5D68FB2B5938BD000AE1B7 /* ErrorViewController.swift */,
);
path = 404;
sourceTree = "<group>";
};
2A7341592B58532A00F65FD0 /* ContentLike */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -795,6 +807,7 @@
3C6193032B3A773800220CEB /* Presentation */ = {
isa = PBXGroup;
children = (
2A5D68FA2B593864000AE1B7 /* 404 */,
3CE9C1332B4C4BA90086E4A3 /* Helpers */,
2AAEFC952B4A9BF100C2D323 /* TabBar */,
2A51AE832B4B05AA00FF770A /* Splash */,
Expand Down Expand Up @@ -1020,6 +1033,7 @@
children = (
3CE9C12B2B4BE7300086E4A3 /* WriteView.swift */,
3CE9C12D2B4C08AE0086E4A3 /* WriteTextView.swift */,
2A5D68FD2B596640000AE1B7 /* WriteBanView.swift */,
);
path = Views;
sourceTree = "<group>";
Expand Down Expand Up @@ -1251,9 +1265,11 @@
2A8D70C72B4D8C1C009F4C6C /* OnboardingEndingViewModel.swift in Sources */,
2A2671F92B4C0819009D214F /* UILabel+.swift in Sources */,
2A8D70B82B4C9A59009F4C6C /* OnboardingViewController.swift in Sources */,
2A5D68FE2B596640000AE1B7 /* WriteBanView.swift in Sources */,
2A2672022B4C3B44009D214F /* ViewModelType.swift in Sources */,
3C6192ED2B3A719A00220CEB /* AppDelegate.swift in Sources */,
2F8735402B4BE65300E55552 /* HomeView.swift in Sources */,
2A5D68FC2B5938BD000AE1B7 /* ErrorViewController.swift in Sources */,
2F8735442B4BE67300E55552 /* HomeViewModel.swift in Sources */,
2F87354C2B4D28D700E55552 /* HomeCollectionFooterView.swift in Sources */,
2A5220EC2B507F2A001510B7 /* UITableViewCellRegisterable.swift in Sources */,
Expand Down
6 changes: 6 additions & 0 deletions DontBe-iOS/DontBe-iOS/Global/Literals/ImageLiterals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ enum ImageLiterals {
static var logoSymbol: UIImage { .load(name: "logo_symbol") }
static var imgProfile: UIImage { .load(name: "img_profile") }
static var btnBackGray: UIImage { .load(name: "btn_back_gray") }
static var img404: UIImage { .load(name: "img_404") }
}

enum TabBar {
Expand Down Expand Up @@ -73,6 +74,11 @@ enum ImageLiterals {
static var btnTransparent: UIImage { .load(name: "status=btn_ghost_default") }
}

enum Write {
static var imgWritingRestriction: UIImage { .load(name: "img_writing_restriction") }
static var imgBanText: UIImage { .load(name: "img_ban_text") }
}

enum Toast {
static var icnCheck: UIImage { .load(name: "icn_check") }
}
Expand Down
3 changes: 3 additions & 0 deletions DontBe-iOS/DontBe-iOS/Global/Literals/StringLiterals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ enum StringLiterals {
static let later = "한 줄 소개 나중에 작성하기"
static let finish = "완료하기"
static let editFinish = "수정완료"
static let goHome = "홈으로 가기"
static let promise = "약속할게요!"
}

enum Toast {
Expand Down Expand Up @@ -143,5 +145,6 @@ enum StringLiterals {
static let baseImageURL = "https://github.com/TeamDon-tBe/SERVER/assets/97835512/fb3ea04c-661e-4221-a837-854d66cdb77e"
static let notificationImageURL = "https://github.com/TeamDon-tBe/SERVER/assets/128011308/327d416e-ef1f-4c10-961d-4d9b85632d87"
static let warnUserGoogleFormURL = "https://forms.gle/FTgZKkajwtzFvAk99"
static let errorMessage = "이런!\n현재 요청하신 페이지를 찾을 수 없어요!"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "img_404.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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "text.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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "img_writing-restriction.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.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ final class NetworkService: NetworkServiceType {

print("👻👻👻👻👻 토큰 재발급 👻👻👻👻👻")
return try await donNetwork(type: type, baseURL: baseURL, accessToken: newAccessToken, body: body, pathVariables: pathVariables)
case 404 :
case 404:
if let sceneDelegate = await UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate {
DispatchQueue.main.async {
let viewController = ErrorViewController()
sceneDelegate.window?.rootViewController = UINavigationController(rootViewController: viewController)
}
}
throw NetworkError.notFoundError
case 500:
throw NetworkError.internalServerError
Expand Down
98 changes: 98 additions & 0 deletions DontBe-iOS/DontBe-iOS/Presentation/404/ErrorViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
//
// ErrorViewController.swift
// DontBe-iOS
//
// Created by 변희주 on 1/18/24.
//

import UIKit

import SnapKit

final class ErrorViewController: UIViewController {

// MARK: - Properties

// MARK: - UI Components

private let errorImage: UIImageView = {
let emptyImage = UIImageView()
emptyImage.image = ImageLiterals.Common.img404
return emptyImage
}()

private let errorTitle: UILabel = {
let emptyTitle = UILabel()
emptyTitle.text = StringLiterals.Network.errorMessage
emptyTitle.textColor = .donBlack
emptyTitle.font = .font(.body1)
emptyTitle.setTextWithLineHeight(text: emptyTitle.text, lineHeight: 22.adjusted, alignment: .center)
emptyTitle.numberOfLines = 2
return emptyTitle
}()

private let homeButton = CustomButton(title: StringLiterals.Button.goHome, backColor: .donBlack, titleColor: .donWhite)

// MARK: - Life Cycles

override func viewDidLoad() {
super.viewDidLoad()

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


// MARK: - Extensions

extension ErrorViewController {
private func setUI() {
self.view.backgroundColor = .donWhite
}

private func setHierarchy() {
self.view.addSubviews(errorImage,
errorTitle,
homeButton)
}

private func setLayout() {
errorImage.snp.makeConstraints {
$0.top.equalToSuperview().inset(statusBarHeight + 182.adjustedH)
$0.centerX.equalToSuperview()
$0.width.equalTo(255.adjusted)
$0.height.equalTo(150.adjusted)
}

errorTitle.snp.makeConstraints {
$0.top.equalTo(errorImage.snp.bottom).offset(34.adjustedH)
$0.centerX.equalToSuperview()
}

homeButton.snp.makeConstraints {
$0.bottom.equalTo(self.view.safeAreaLayoutGuide).inset(29.adjusted)
$0.centerX.equalToSuperview()
}
}

private func setAddTarget() {
self.homeButton.addTarget(self, action: #selector(homeButtonTapped), for: .touchUpInside)
}

@objc
private func homeButtonTapped() {
if let sceneDelegate = UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate {
DispatchQueue.main.async {
let viewController = DontBeTabBarController()
viewController.selectedIndex = 0
if let selectedViewController = viewController.selectedViewController {
viewController.applyFontColorAttributes(to: selectedViewController.tabBarItem, isSelected: true)
}
sceneDelegate.window?.rootViewController = UINavigationController(rootViewController: viewController)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ extension MyPageViewController {
self.navigationController?.navigationBar.addSubviews(navigationBackButton)
navigationBackButton.snp.makeConstraints {
$0.centerY.equalToSuperview()
$0.leading.equalToSuperview().inset(23.adjusted)
$0.leading.equalToSuperview().inset(16.adjusted)
}
rootView.pageViewController.view.snp.makeConstraints {
$0.top.equalTo(rootView.segmentedControl.snp.bottom).offset(2.adjusted)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ extension MyPageViewModel {
accessToken: accessToken,
body: EmptyBody(),
pathVariables: ["":""])
UserDefaults.standard.set(result?.data?.memberGhost ?? 0, forKey: "memberGhost")
return result
} catch {
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ final class MyPageProfileView: UIView {

let userNickname: UILabel = {
let label = UILabel()
label.text = "안녕하세요반가와요우히히"
label.text = loadUserData()?.userNickname
label.textColor = .donWhite
label.textAlignment = .center
label.font = .font(.head3)
Expand All @@ -51,7 +51,7 @@ final class MyPageProfileView: UIView {

let userIntroduction: UILabel = {
let label = UILabel()
label.setTextWithLineHeight(text: "안녕하세요히안우히히안녕하세요반가와요우히히히히안녕하세요히안우히히안녕하세요반가와요우히히히히", lineHeight: 20.adjusted, alignment: .center)
label.setTextWithLineHeight(text: "", lineHeight: 20.adjusted, alignment: .center)
label.textColor = .donGray7
label.textAlignment = .center
label.font = .font(.caption2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ final class NotificationViewController: UIViewController {
setRefreshControll()
bindViewModel()
}

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

self.tabBarController?.tabBar.isHidden = false
self.tabBarController?.tabBar.isTranslucent = false
self.navigationController?.navigationBar.isHidden = false
self.navigationItem.hidesBackButton = true
}
}

// MARK: - Extensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ final class PostReplyCollectionViewCell: UICollectionViewCell, UICollectionViewR
var KebabButtonAction: (() -> Void) = {}
var LikeButtonAction: (() -> Void) = {}
var TransparentButtonAction: (() -> Void) = {}
var ProfileButtonAction: (() -> Void) = {}
var isLiked: Bool = false
var alarmTriggerType: String = ""
var targetMemberId: Int = 0
Expand Down Expand Up @@ -44,6 +45,7 @@ final class PostReplyCollectionViewCell: UICollectionViewCell, UICollectionViewR
image.clipsToBounds = true
image.image = ImageLiterals.Common.imgProfile
image.layer.cornerRadius = 22.adjusted
image.isUserInteractionEnabled = true
return image
}()

Expand Down Expand Up @@ -277,6 +279,8 @@ extension PostReplyCollectionViewCell {
kebabButton.addTarget(self, action: #selector(showButtons), for: .touchUpInside)
likeButton.addTarget(self, action: #selector(likeToggleButton), for: .touchUpInside)
ghostButton.addTarget(self, action: #selector(transparentShowPopupButton), for: .touchUpInside)
profileImageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(profileButton)))

}

@objc
Expand All @@ -292,4 +296,9 @@ extension PostReplyCollectionViewCell {
func transparentShowPopupButton() {
TransparentButtonAction()
}

@objc
func profileButton() {
ProfileButtonAction()
}
}
Loading

0 comments on commit 877714c

Please sign in to comment.