diff --git a/LionHeart-iOS/LionHeart-iOS/Global/Extensions/UIView+.swift b/LionHeart-iOS/LionHeart-iOS/Global/Extensions/UIView+.swift
index df1cd046..6a4dbee7 100644
--- a/LionHeart-iOS/LionHeart-iOS/Global/Extensions/UIView+.swift
+++ b/LionHeart-iOS/LionHeart-iOS/Global/Extensions/UIView+.swift
@@ -35,7 +35,7 @@ extension UIView{
case horizontal
}
- func setGradient(firstColor: UIColor, secondColor: UIColor, axis: GradientAxis){
+ func setGradient(firstColor: UIColor, secondColor: UIColor, axis: GradientAxis) {
let gradient: CAGradientLayer = CAGradientLayer()
gradient.colors = [firstColor.cgColor, secondColor.cgColor]
if axis == .horizontal {
diff --git a/LionHeart-iOS/LionHeart-iOS/Global/Extensions/UIViewController+.swift b/LionHeart-iOS/LionHeart-iOS/Global/Extensions/UIViewController+.swift
index efc22634..73e3be55 100644
--- a/LionHeart-iOS/LionHeart-iOS/Global/Extensions/UIViewController+.swift
+++ b/LionHeart-iOS/LionHeart-iOS/Global/Extensions/UIViewController+.swift
@@ -77,3 +77,22 @@ extension UIViewController {
}
}
+/**
+
+ - Description:
+ ArticleDetailViewController로 fullscreen으로 present해주는 메서드입니다
+
+ - parameters:
+ articleID를 넘겨줍니다
+
+*/
+
+extension UIViewController {
+ func presentArticleDetailFullScreen(articleID: Int) {
+ let articleDetailViewController = ArticleDetailViewController()
+ articleDetailViewController.setArticleId(id: articleID)
+ articleDetailViewController.isModalInPresentation = true
+ articleDetailViewController.modalPresentationStyle = .overFullScreen
+ self.present(articleDetailViewController, animated: true)
+ }
+}
diff --git a/LionHeart-iOS/LionHeart-iOS/Global/UserDefault/UserDefaultToken.swift b/LionHeart-iOS/LionHeart-iOS/Global/UserDefault/UserDefaultToken.swift
index b0267a6c..05161160 100644
--- a/LionHeart-iOS/LionHeart-iOS/Global/UserDefault/UserDefaultToken.swift
+++ b/LionHeart-iOS/LionHeart-iOS/Global/UserDefault/UserDefaultToken.swift
@@ -11,7 +11,7 @@ import Foundation
struct UserDefaultToken: AppData, Codable {
var refreshToken: String?
var accessToken: String?
- let fcmToken: String
+ let fcmToken: String?
var isExistJWT: Bool {
return !(self.refreshToken == nil)
diff --git a/LionHeart-iOS/LionHeart-iOS/Network/Services/AuthService.swift b/LionHeart-iOS/LionHeart-iOS/Network/Services/AuthService.swift
index 2ea78ae3..6d095700 100644
--- a/LionHeart-iOS/LionHeart-iOS/Network/Services/AuthService.swift
+++ b/LionHeart-iOS/LionHeart-iOS/Network/Services/AuthService.swift
@@ -40,7 +40,7 @@ final class AuthService: Serviceable {
func login(type: LoginType, kakaoToken: String) async throws {
// 1. UserDefault에서 토큰 가져오기
guard let fcmToken = UserDefaultsManager.tokenKey?.fcmToken else {
- throw NetworkError.clientError(code: "", message: "fcmToken이 없는데 왜 없죠")
+ throw NetworkError.clientError(code: "", message: "\(UserDefaultsManager.tokenKey)")
}
let loginRequest = LoginRequest(socialType: type.raw, token: kakaoToken, fcmToken: fcmToken)
diff --git a/LionHeart-iOS/LionHeart-iOS/Scenes/Article/ArticleDetail/ViewControllers/ArticleDetailViewController.swift b/LionHeart-iOS/LionHeart-iOS/Scenes/Article/ArticleDetail/ViewControllers/ArticleDetailViewController.swift
index da86c181..26a9888e 100644
--- a/LionHeart-iOS/LionHeart-iOS/Scenes/Article/ArticleDetail/ViewControllers/ArticleDetailViewController.swift
+++ b/LionHeart-iOS/LionHeart-iOS/Scenes/Article/ArticleDetail/ViewControllers/ArticleDetailViewController.swift
@@ -51,6 +51,7 @@ final class ArticleDetailViewController: UIViewController {
public override func viewDidLoad() {
super.viewDidLoad()
setStyle()
+ setUI()
setHierarchy()
setLayout()
setTableView()
@@ -76,10 +77,7 @@ extension ArticleDetailViewController {
private func getArticleDetail() {
Task {
do {
- guard let articleId else {
- return
-
- }
+ guard let articleId else { return }
self.articleDatas = try await ArticleService.shared.getArticleDetail(articleId: articleId)
} catch {
guard let error = error as? NetworkError else { return }
@@ -124,6 +122,10 @@ private extension ArticleDetailViewController {
self.view.backgroundColor = .designSystem(.background)
}
+ func setUI() {
+ view.backgroundColor = .designSystem(.background)
+ }
+
func setHierarchy() {
view.addSubviews(navigationBar, articleTableView, progressBar, scrollToTopButton)
}
@@ -141,7 +143,7 @@ private extension ArticleDetailViewController {
articleTableView.snp.makeConstraints { make in
make.top.equalTo(progressBar.snp.bottom)
make.leading.trailing.equalToSuperview()
- make.bottom.equalTo(view.safeAreaLayoutGuide)
+ make.bottom.equalToSuperview()
}
scrollToTopButton.snp.makeConstraints { make in
diff --git a/LionHeart-iOS/LionHeart-iOS/Scenes/Article/ArticleListByCategory/ViewControllers/ArticleListByCategoryViewController.swift b/LionHeart-iOS/LionHeart-iOS/Scenes/Article/ArticleListByCategory/ViewControllers/ArticleListByCategoryViewController.swift
index 55cea18e..20932e0b 100644
--- a/LionHeart-iOS/LionHeart-iOS/Scenes/Article/ArticleListByCategory/ViewControllers/ArticleListByCategoryViewController.swift
+++ b/LionHeart-iOS/LionHeart-iOS/Scenes/Article/ArticleListByCategory/ViewControllers/ArticleListByCategoryViewController.swift
@@ -13,7 +13,11 @@ import SnapKit
final class ArticleListByCategoryViewController: UIViewController {
var categoryString = String()
- var articleListData = [ArticleDataByWeek]()
+ var articleListData: [ArticleDataByWeek] = [] {
+ didSet {
+ articleListTableView.reloadData()
+ }
+ }
private lazy var navigationBar = LHNavigationBarView(type: .exploreEachCategory, viewController: self)
@@ -34,15 +38,9 @@ final class ArticleListByCategoryViewController: UIViewController {
public override func viewDidLoad() {
super.viewDidLoad()
setUI()
-
setHierarchy()
-
setLayout()
-
- setAddTarget()
-
setDelegate()
-
setTableView()
setNotificationCenter()
}
@@ -85,12 +83,9 @@ private extension ArticleListByCategoryViewController {
}
}
- func setAddTarget() {
-
- }
-
func setDelegate() {
articleListTableView.dataSource = self
+ articleListTableView.delegate = self
}
func setTableView() {
@@ -109,6 +104,7 @@ private extension ArticleListByCategoryViewController {
try await BookmarkService.shared.postBookmark(BookmarkRequest(articleId: articleListData[indexPath].articleId,
bookmarkStatus: buttonSelected))
+ buttonSelected ? LHToast.show(message: "북마크에 추가되었습니다") : LHToast.show(message: "북마크에 해제되었습니다")
} catch {
guard let error = error as? NetworkError else { return }
handleError(error)
@@ -146,7 +142,13 @@ extension ArticleListByCategoryViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = CurriculumArticleByWeekTableViewCell.dequeueReusableCell(to: articleListTableView)
- cell.inputData = articleListData[indexPath.item]
+ cell.inputData = articleListData[indexPath.row]
return cell
}
}
+
+extension ArticleListByCategoryViewController: UITableViewDelegate {
+ func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+ self.presentArticleDetailFullScreen(articleID: articleListData[indexPath.row].articleId)
+ }
+}
diff --git a/LionHeart-iOS/LionHeart-iOS/Scenes/BookMark/Cells/BookmarkListCollectionViewCell.swift b/LionHeart-iOS/LionHeart-iOS/Scenes/BookMark/Cells/BookmarkListCollectionViewCell.swift
index b2b9a487..f0ace10d 100644
--- a/LionHeart-iOS/LionHeart-iOS/Scenes/BookMark/Cells/BookmarkListCollectionViewCell.swift
+++ b/LionHeart-iOS/LionHeart-iOS/Scenes/BookMark/Cells/BookmarkListCollectionViewCell.swift
@@ -35,7 +35,6 @@ final class BookmarkListCollectionViewCell: UICollectionViewCell,
private let articleImageView: UIImageView = {
let imageView = UIImageView()
- imageView.backgroundColor = .yellow
return imageView
}()
diff --git a/LionHeart-iOS/LionHeart-iOS/Scenes/Challenge/Cells/ChallengeDayCheckCollectionViewCollectionViewCell.swift b/LionHeart-iOS/LionHeart-iOS/Scenes/Challenge/Cells/ChallengeDayCheckCollectionViewCollectionViewCell.swift
index 4582473c..889a0ebd 100644
--- a/LionHeart-iOS/LionHeart-iOS/Scenes/Challenge/Cells/ChallengeDayCheckCollectionViewCollectionViewCell.swift
+++ b/LionHeart-iOS/LionHeart-iOS/Scenes/Challenge/Cells/ChallengeDayCheckCollectionViewCollectionViewCell.swift
@@ -12,23 +12,11 @@ import SnapKit
final class ChallengeDayCheckCollectionViewCollectionViewCell: UICollectionViewCell, CollectionViewCellRegisterDequeueProtocol {
- var textColorBool = false
-
- var inputData: DummyModel? {
- didSet {
-
- }
- }
+ var inputData: DummyModel?
var inputString: String? {
didSet {
countLabel.text = inputString
-
- if textColorBool {
- countLabel.textColor = .designSystem(.white)
- } else {
- countLabel.textColor = .designSystem(.gray600)
- }
}
}
@@ -48,20 +36,9 @@ final class ChallengeDayCheckCollectionViewCollectionViewCell: UICollectionViewC
override init(frame: CGRect) {
super.init(frame: frame)
- // MARK: - 컴포넌트 설정
setUI()
-
- // MARK: - addsubView
setHierarchy()
-
- // MARK: - autolayout설정
setLayout()
-
- // MARK: - button의 addtarget설정
- setAddTarget()
-
- // MARK: - delegate설정
- setDelegate()
}
@available(*, unavailable)
@@ -90,12 +67,4 @@ private extension ChallengeDayCheckCollectionViewCollectionViewCell {
make.height.equalTo(1)
}
}
-
- func setAddTarget() {
-
- }
-
- func setDelegate() {
-
- }
}
diff --git a/LionHeart-iOS/LionHeart-iOS/Scenes/Challenge/ViewController/ChallengeViewController.swift b/LionHeart-iOS/LionHeart-iOS/Scenes/Challenge/ViewController/ChallengeViewController.swift
index 30c0ae71..835e2682 100644
--- a/LionHeart-iOS/LionHeart-iOS/Scenes/Challenge/ViewController/ChallengeViewController.swift
+++ b/LionHeart-iOS/LionHeart-iOS/Scenes/Challenge/ViewController/ChallengeViewController.swift
@@ -141,15 +141,17 @@ final class ChallengeViewController: UIViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
-
Task {
- do{
+ do {
+ self.showLoading()
let model = try await ChallengeService.shared.inquireChallengeInfo()
self.inputData = model
self.tags = model.daddyAttendances
self.challengeDayCheckCollectionView.reloadData()
+ self.hideLoading()
} catch {
- print(error)
+ guard let error = error as? NetworkError else { return }
+ handleError(error)
}
}
}
@@ -161,6 +163,7 @@ final class ChallengeViewController: UIViewController {
setLayout()
setNavigationBar()
setDelegate()
+ setAddTarget()
}
override func viewDidAppear(_ animated: Bool) {
@@ -243,6 +246,18 @@ private extension ChallengeViewController {
make.leading.trailing.equalToSuperview()
}
}
+
+ func setAddTarget() {
+ navigationBar.rightFirstBarItemAction {
+ let bookmarkViewController = BookmarkViewController()
+ self.navigationController?.pushViewController(bookmarkViewController, animated: true)
+ }
+
+ navigationBar.rightSecondBarItemAction {
+ let myPageViewController = MyPageViewController()
+ self.navigationController?.pushViewController(myPageViewController, animated: true)
+ }
+ }
}
extension ChallengeViewController:
@@ -275,12 +290,31 @@ extension ChallengeViewController: UICollectionViewDataSource {
if indexPath.item < tags.count {
cell.inputString = tags[indexPath.item]
cell.backgroundColor = .designSystem(.background)
- cell.textColorBool = true
} else {
cell.inputString = "\(indexPath.section + indexPath.row + 1)"
cell.backgroundColor = .designSystem(.gray1000)
- cell.textColorBool = false
}
return cell
}
}
+
+extension ChallengeViewController: ViewControllerServiceable {
+ func handleError(_ error: NetworkError) {
+ switch error {
+ case .urlEncodingError:
+ LHToast.show(message: "url인코딩에러")
+ case .jsonDecodingError:
+ LHToast.show(message: "챌린지Decode에러")
+ case .badCasting:
+ LHToast.show(message: "배드캐스팅")
+ case .fetchImageError:
+ LHToast.show(message: "챌린지 이미지 패치 에러")
+ case .unAuthorizedError:
+ LHToast.show(message: "챌린지 Auth 에러")
+ case .clientError(_, let message):
+ LHToast.show(message: message)
+ case .serverError:
+ LHToast.show(message: "서버문제!")
+ }
+ }
+}
diff --git a/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/Cells/CurriculumArticleByWeekTableViewCell.swift b/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/Cells/CurriculumArticleByWeekTableViewCell.swift
index dc140f05..f02409cc 100644
--- a/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/Cells/CurriculumArticleByWeekTableViewCell.swift
+++ b/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/Cells/CurriculumArticleByWeekTableViewCell.swift
@@ -13,8 +13,6 @@ import SnapKit
final class CurriculumArticleByWeekTableViewCell: UITableViewCell, TableViewCellRegisterDequeueProtocol {
- var isBookmarkedIndexPath: IndexPath?
-
var inputData: ArticleDataByWeek? {
didSet {
guard let inputData else {
@@ -30,7 +28,7 @@ final class CurriculumArticleByWeekTableViewCell: UITableViewCell, TableViewCell
articleContentLabel.text = inputData.articleContent
articleContentLabel.lineBreakStrategy = .pushOut
articleContentLabel.lineBreakMode = .byTruncatingTail
-
+ bookMarkButton.isSelected = inputData.isArticleBookmarked
}
}
@@ -95,9 +93,9 @@ final class CurriculumArticleByWeekTableViewCell: UITableViewCell, TableViewCell
button.setImage(ImageLiterals.BookMark.activeBookmarkSmall, for: .selected)
button.addButtonAction { _ in
- // VC로 넘기기 노티피케이션
+ let indexPath = self.getIndexPath()
NotificationCenter.default.post(name: NSNotification.Name("isArticleBookmarked"),
- object: nil, userInfo: ["bookmarkCellIndexPath": self.isBookmarkedIndexPath?.row ?? 0,
+ object: nil, userInfo: ["bookmarkCellIndexPath": indexPath?.row ?? 0,
"bookmarkButtonSelected": !button.isSelected])
button.isSelected.toggle()
}
@@ -182,4 +180,9 @@ private extension CurriculumArticleByWeekTableViewCell {
$0.bottom.equalToSuperview().inset(10)
}
}
+
+ func getIndexPath() -> IndexPath? {
+ guard let superView = self.superview as? UITableView else { return nil }
+ return superView.indexPath(for: self)
+ }
}
diff --git a/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/Cells/CurriculumListByWeekCollectionViewCell.swift b/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/Cells/CurriculumListByWeekCollectionViewCell.swift
index 9b475b2f..9229c45b 100644
--- a/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/Cells/CurriculumListByWeekCollectionViewCell.swift
+++ b/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/Cells/CurriculumListByWeekCollectionViewCell.swift
@@ -119,7 +119,6 @@ extension CurriculumListByWeekCollectionViewCell: UITableViewDataSource{
cell.inputData = inputData?.articleData[indexPath.row - 1]
cell.selectionStyle = .none
cell.backgroundColor = .designSystem(.background)
- cell.isBookmarkedIndexPath = indexPath
return cell
}
}
diff --git a/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/ViewControllers/CurriculumListByWeekViewController.swift b/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/ViewControllers/CurriculumListByWeekViewController.swift
index 25a4948d..4565c254 100644
--- a/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/ViewControllers/CurriculumListByWeekViewController.swift
+++ b/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/ViewControllers/CurriculumListByWeekViewController.swift
@@ -158,6 +158,7 @@ private extension CurriculumListByWeekViewController {
BookmarkRequest(articleId: listByWeekDatas.articleData[indexPath].articleId,
bookmarkStatus: buttonSelected))
hideLoading()
+ buttonSelected ? LHToast.show(message: "북마크가 추가되었습니다") : LHToast.show(message: "북마크가 해제되었습니다")
} catch {
guard let error = error as? NetworkError else { return }
handleError(error)
@@ -189,11 +190,7 @@ private extension CurriculumListByWeekViewController {
@objc
func didSelectTableVIewCell(notification: NSNotification) {
guard let articleId = notification.object as? Int else { return }
-
- let articleDetailVC = ArticleDetailViewController()
- articleDetailVC.setArticleId(id: articleId)
- articleDetailVC.modalPresentationStyle = .overFullScreen
- self.present(articleDetailVC, animated: true)
+ presentArticleDetailFullScreen(articleID: articleId)
}
diff --git a/LionHeart-iOS/LionHeart-iOS/Scenes/Login/LoginViewController.swift b/LionHeart-iOS/LionHeart-iOS/Scenes/Login/LoginViewController.swift
index 4fcd3f00..918c5097 100644
--- a/LionHeart-iOS/LionHeart-iOS/Scenes/Login/LoginViewController.swift
+++ b/LionHeart-iOS/LionHeart-iOS/Scenes/Login/LoginViewController.swift
@@ -17,7 +17,10 @@ final class LoginViewController: UIViewController {
private var kakaoAccessToken: String? {
didSet {
- guard let kakaoToken = self.kakaoAccessToken else { return }
+ guard let kakaoToken = self.kakaoAccessToken else {
+ LHToast.show(message: "카카오토큰 언래핑 실패 21")
+ return
+ }
self.loginAPI(kakaoToken: kakaoToken)
}
}
@@ -67,10 +70,12 @@ final class LoginViewController: UIViewController {
extension LoginViewController: ViewControllerServiceable {
func handleError(_ error: NetworkError) {
+ LHToast.show(message: error.description)
switch error {
case .clientError(let code, let message):
print(code, message)
if code == NetworkErrorCode.unfoundUserErrorCode {
+ LHToast.show(message: "코드 잘돌아감")
self.moveUserToOnboardingViewController()
}
default:
@@ -84,11 +89,15 @@ extension LoginViewController {
Task {
do {
try await AuthService.shared.login(type: .kakao, kakaoToken: kakaoToken)
- guard let window = self.view.window else { return }
+ guard let window = self.view.window else {
+ LHToast.show(message: "로그인api에서 window guard let 88")
+ return
+ }
let mainTabbarViewController = TabBarViewController()
ViewControllerUtil.setRootViewController(window: window, viewController: mainTabbarViewController, withAnimation: false)
} catch {
guard let error = error as? NetworkError else {
+ LHToast.show(message: "넷웤에러 95")
return
}
handleError(error)
@@ -144,9 +153,17 @@ private extension LoginViewController {
private func loginKakaoWithApp() {
UserApi.shared.loginWithKakaoTalk { oAuthToken, error in
- guard error == nil else { return }
+ guard error == nil else {
+ LHToast.show(message: "카카오api에러 151")
+ return
+
+ }
print("Login with KAKAO App Success !!")
- guard let oAuthToken = oAuthToken else { return }
+ guard let oAuthToken = oAuthToken else {
+ LHToast.show(message: "카카오api에러 157")
+ return
+
+ }
print(oAuthToken.accessToken)
self.kakaoAccessToken = oAuthToken.accessToken
}
@@ -154,9 +171,17 @@ private extension LoginViewController {
private func loginKakaoWithWeb() {
UserApi.shared.loginWithKakaoAccount { oAuthToken, error in
- guard error == nil else { return }
+ guard error == nil else {
+ LHToast.show(message: "카카오api에러 164")
+ return
+
+ }
print("Login with KAKAO Web Success !!")
- guard let oAuthToken = oAuthToken else { return }
+ guard let oAuthToken = oAuthToken else {
+ LHToast.show(message: "카카오api에러 175")
+ return
+
+ }
print(oAuthToken.accessToken)
self.kakaoAccessToken = oAuthToken.accessToken
}
diff --git a/LionHeart-iOS/LionHeart-iOS/Scenes/Splash/SplashViewController.swift b/LionHeart-iOS/LionHeart-iOS/Scenes/Splash/SplashViewController.swift
index 89eb005f..66c24c19 100644
--- a/LionHeart-iOS/LionHeart-iOS/Scenes/Splash/SplashViewController.swift
+++ b/LionHeart-iOS/LionHeart-iOS/Scenes/Splash/SplashViewController.swift
@@ -118,10 +118,10 @@ private extension SplashViewController {
guard let token = UserDefaultsManager.tokenKey else { return }
await logout(token: token)
// LoginVC로 이동하기
- let loginVC = LoginViewController()
+ let loginVC = UINavigationController(rootViewController: LoginViewController())
setRootViewController(to: loginVC, animation: true)
} else if code == NetworkErrorCode.unfoundUserErrorCode {
- let loginVC = LoginViewController()
+ let loginVC = UINavigationController(rootViewController: LoginViewController())
setRootViewController(to: loginVC, animation: true)
}
default:
diff --git a/LionHeart-iOS/LionHeart-iOS/Scenes/Today/ViewControllers/TodayViewController.swift b/LionHeart-iOS/LionHeart-iOS/Scenes/Today/ViewControllers/TodayViewController.swift
index ed92e420..d039d896 100644
--- a/LionHeart-iOS/LionHeart-iOS/Scenes/Today/ViewControllers/TodayViewController.swift
+++ b/LionHeart-iOS/LionHeart-iOS/Scenes/Today/ViewControllers/TodayViewController.swift
@@ -56,29 +56,6 @@ final class TodayViewController: UIViewController {
}
}
-// MARK: - 네트워킹
-extension TodayViewController: ViewControllerServiceable {
- func handleError(_ error: NetworkError) {
- switch error {
- case .urlEncodingError:
- LHToast.show(message: "URL인코딩오류입니다", isTabBar: true)
- case .jsonDecodingError:
- LHToast.show(message: "Json디코딩오류입니다", isTabBar: true)
- case .badCasting:
- LHToast.show(message: "배드퀘스트", isTabBar: true)
- case .fetchImageError:
- LHToast.show(message: "이미지패치실패", isTabBar: true)
- case .unAuthorizedError:
- guard let window = self.view.window else { return }
- ViewControllerUtil.setRootViewController(window: window, viewController: SplashViewController(), withAnimation: false)
- case .clientError(_, let message):
- LHToast.show(message: message, isTabBar: true)
- case .serverError:
- LHToast.show(message: "승준이어딧니 내목소리들리니", isTabBar: true)
- }
- }
-}
-
extension TodayViewController {
func getInquireTodayArticle() {
Task {
@@ -89,7 +66,10 @@ extension TodayViewController {
titleLabel.userNickName = responseArticle.fetalNickname
mainArticleView.data = responseArticle
todayArticleID = responseArticle.aticleID
- hideLoading()
+ // MARK: - 추후에 디팀에서 그라데이션있는 이미지로 받아오기로함
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
+ self.hideLoading()
+ }
} catch {
guard let error = error as? NetworkError else { return }
handleError(error)
@@ -112,7 +92,6 @@ private extension TodayViewController {
func setHierarchy() {
view.addSubviews(todayNavigationBar, seperateLine)
view.addSubviews(titleLabel, subTitleLable, pointImage, mainArticleView)
-
}
func setLayout() {
@@ -169,10 +148,30 @@ private extension TodayViewController {
}
@objc func articleTapped(_ sender: UIButton) {
- let articleDetailViewController = ArticleDetailViewController()
- articleDetailViewController.setArticleId(id: self.todayArticleID)
- articleDetailViewController.isModalInPresentation = true
- articleDetailViewController.modalPresentationStyle = .overFullScreen
- self.present(articleDetailViewController, animated: true)
+ guard let todayArticleID else { return }
+ self.presentArticleDetailFullScreen(articleID: todayArticleID)
+ }
+}
+
+// MARK: - 네트워킹
+extension TodayViewController: ViewControllerServiceable {
+ func handleError(_ error: NetworkError) {
+ switch error {
+ case .urlEncodingError:
+ LHToast.show(message: "URL인코딩오류입니다", isTabBar: true)
+ case .jsonDecodingError:
+ LHToast.show(message: "Json디코딩오류입니다", isTabBar: true)
+ case .badCasting:
+ LHToast.show(message: "배드퀘스트", isTabBar: true)
+ case .fetchImageError:
+ LHToast.show(message: "이미지패치실패", isTabBar: true)
+ case .unAuthorizedError:
+ guard let window = self.view.window else { return }
+ ViewControllerUtil.setRootViewController(window: window, viewController: SplashViewController(), withAnimation: false)
+ case .clientError(_, let message):
+ LHToast.show(message: message, isTabBar: true)
+ case .serverError:
+ LHToast.show(message: "승준이어딧니 내목소리들리니", isTabBar: true)
+ }
}
}
diff --git a/README.md b/README.md
index 5693591f..bb255384 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@
## 🍎 LionHeart-iOS Developers
- | | | | |
+ | | | | |
:---------:|:----------:|:---------:|:---------:|:---------:|
김민재 | 김의성 | 김동현 | 곽성준 | 황찬미 |
[ffalswo2](https://github.com/ffalswo2) | [kimscastle](https://github.com/kimscastle) | [BrickSky](https://github.com/BrickSky) | [sjk4618](https://github.com/sjk4618) |[cchanmi](https://github.com/cchanmi) |