Skip to content

Commit

Permalink
[MERGE] Pull Develop (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
cchanmi committed Jul 20, 2023
2 parents c310013 + 6933ef5 commit 6808ed2
Show file tree
Hide file tree
Showing 21 changed files with 218 additions and 33 deletions.
5 changes: 5 additions & 0 deletions LionHeart-iOS/LionHeart-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@
C0F029E82A5FB9EF00E0D185 /* RoundContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0F029E72A5FB9EF00E0D185 /* RoundContainerView.swift */; };
C0F029EA2A5FD32900E0D185 /* LHRoundButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0F029E92A5FD32900E0D185 /* LHRoundButton.swift */; };
C0F62FCA2A67CDCE0003ADFA /* BookmarkDetailCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A8980C12A5FD6AF00746C58 /* BookmarkDetailCollectionViewCell.swift */; };
C0F62FE72A691FC40003ADFA /* LHLoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0F62FE62A691FC40003ADFA /* LHLoadingView.swift */; };
D30CBA1A2A60384C00C8636B /* ChallengeDummy.swift in Sources */ = {isa = PBXBuildFile; fileRef = D30CBA192A60384C00C8636B /* ChallengeDummy.swift */; };
D34280772A66B90C00DA1499 /* UILabelPadding.swift in Sources */ = {isa = PBXBuildFile; fileRef = D34280762A66B90C00DA1499 /* UILabelPadding.swift */; };
D342807A2A67F12200DA1499 /* ChallengeDataResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = D34280792A67F12200DA1499 /* ChallengeDataResponse.swift */; };
D342807C2A67FE4700DA1499 /* ChallengeService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D342807B2A67FE4700DA1499 /* ChallengeService.swift */; };
Expand Down Expand Up @@ -377,6 +379,7 @@
C0F62FBA2A67CDB60003ADFA /* progressbar_3m.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = progressbar_3m.json; sourceTree = "<group>"; };
C0F62FBE2A67CDB60003ADFA /* progressbar_5m.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = progressbar_5m.json; sourceTree = "<group>"; };
C0F62FBF2A67CDB60003ADFA /* progressbar_6m.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = progressbar_6m.json; sourceTree = "<group>"; };
C0F62FE62A691FC40003ADFA /* LHLoadingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LHLoadingView.swift; sourceTree = "<group>"; };
D30CBA192A60384C00C8636B /* ChallengeDummy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChallengeDummy.swift; sourceTree = "<group>"; };
D34280762A66B90C00DA1499 /* UILabelPadding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UILabelPadding.swift; sourceTree = "<group>"; };
D34280792A67F12200DA1499 /* ChallengeDataResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChallengeDataResponse.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1307,6 +1310,7 @@
C0F029E52A5FB9DF00E0D185 /* ContainerView.swift */,
C0F029E72A5FB9EF00E0D185 /* RoundContainerView.swift */,
C0F029E92A5FD32900E0D185 /* LHRoundButton.swift */,
C0F62FE62A691FC40003ADFA /* LHLoadingView.swift */,
);
path = OnboardingComponent;
sourceTree = "<group>";
Expand Down Expand Up @@ -1675,6 +1679,7 @@
C0DF033B2A5A94BA0037F740 /* UITextField+.swift in Sources */,
C0F029C92A5EFC1F00E0D185 /* LHOnboardingPageViewController.swift in Sources */,
C0DF03412A5A95E40037F740 /* UIImage+.swift in Sources */,
C0F62FE72A691FC40003ADFA /* LHLoadingView.swift in Sources */,
4A8980CE2A617F7100746C58 /* CollectionHeaderViewRegisterDequeueProtocol.swift in Sources */,
4A860AD62A6265B2002BA428 /* BookmarkModel.swift in Sources */,
B5C6A2BE2A5DE6590021BE5E /* GeneralTitleTableViewCell.swift in Sources */,
Expand Down
11 changes: 10 additions & 1 deletion LionHeart-iOS/LionHeart-iOS/Global/Enums/NavigationBarType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by 김민재 on 2023/07/10.
//

import Foundation
import UIKit

enum LHNavigationType {
case today
Expand Down Expand Up @@ -40,6 +40,15 @@ enum LHNavigationType {
default: return .backButtonWithTitle
}
}

var backgroundColor: UIColor? {
switch self {
case .today:
return .designSystem(.black)
case .explore, .curriculumMain, .curriculumByWeek, .challenge, .onboarding, .articleMain, .bookmark, .myPage, .exploreEachCategory:
return .designSystem(.background)
}
}
}


Expand Down
7 changes: 5 additions & 2 deletions LionHeart-iOS/LionHeart-iOS/Global/Extensions/UIView+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ extension UIView{
} else if axis == .vertical {
gradient.type = .axial
}

gradient.frame = bounds
layer.addSublayer(gradient)
layer.insertSublayer(gradient, at: 0)
}

func removeGradient() {
self.layer.sublayers?.filter { $0 is CAGradientLayer }.forEach { $0.removeFromSuperlayer() }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ enum ImageLiterals {
static var loginBackgroundImage: UIImage { .load(named: "kakao_login_img") }
static var kakaoLogo: UIImage { .load(named: "ic_kakao") }
}

enum Onboarding {
static var onboardingCompleteImage: UIImage { .load(named: "onboarding_complete_image") }
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,54 @@

import UIKit

final class LHLoadingView: UIActivityIndicatorView {

init() {
super.init(frame: .zero)
self.style = .large
self.color = .designSystem(.lionRed)
self.backgroundColor = .designSystem(.black)
self.frame = .init(x: 0, y: 0, width: Constant.Screen.width, height: Constant.Screen.height)
}

required init(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}


/// 네트워크 요청을 하는 ViewController가 채택하는 프로토콜
protocol ViewControllerServiceable where Self: UIViewController {

/// 네트워크 통신을 do-catch문으로 감싸고 catch문에서 호출하는 메서드
/// - Parameter error: 네트워크 통신 중 throw된 에러
func handleError(_ error: NetworkError)
func showLoading()
func hideLoading()
}

extension ViewControllerServiceable {

func showLoading() {
if let loadingView = getLoadingView() {
loadingView.startAnimating()
return
}
let loadingView = LHLoadingView()
loadingView.startAnimating()

view.addSubview(loadingView)
loadingView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
}

func hideLoading() {
getLoadingView()?.stopAnimating()
getLoadingView()?.removeFromSuperview()
}

private func getLoadingView() -> LHLoadingView? {
return view.subviews.compactMap { $0 as? LHLoadingView }.first
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "TodayArticle_PointImage.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "onboarding_complete_image.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"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.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ final class LHNavigationBarView: UIView {
}

private func setStyle() {
self.backgroundColor = .designSystem(.black)
self.backgroundColor = type.backgroundColor
}

// MARK: - addsubView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,18 @@ final class LHKingFisherService {

}

func unwrapTaskArray<T>(dataTasks: [Task<T, Never>], type: T.Type) async -> [T] {
let tasks = dataTasks.map { task in
Task {
return try await task.result.get()
}
}

var result: [T?] = []
for task in tasks {
result.append(try? await task.result.get())
}
return result.compactMap { $0 }
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ final class ArticleDetailViewController: UIViewController {
private var progressBar = LHProgressView()

private let articleTableView = ArticleDetailTableView()

private let loadingIndicatorView = LHLoadingView()

private lazy var scrollToTopButton: UIButton = {
let button = UIButton()
Expand All @@ -36,6 +38,7 @@ final class ArticleDetailViewController: UIViewController {
private var articleDatas: [BlockTypeAppData]? {
didSet {
self.articleTableView.reloadData()
hideLoading()
}
}

Expand All @@ -58,7 +61,7 @@ final class ArticleDetailViewController: UIViewController {

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
LoadingIndicator.showLoading()
showLoading()
getArticleDetail()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ final class CurriculumViewController: UIViewController, CurriculumTableViewToggl

private enum Size {
static let userInfoView: CGFloat = 70 / 375
static let progressView: CGFloat = 124 / 375
}

private var isFirstPresented: Bool = true
Expand Down Expand Up @@ -138,7 +137,7 @@ private extension CurriculumViewController {
$0.top.equalTo(curriculumUserInfoView.snp.bottom)
$0.trailing.leading.equalToSuperview()
$0.width.equalTo(Constant.Screen.width)
$0.height.equalTo(progressBar.snp.width).multipliedBy(Size.progressView)
$0.height.equalTo(ScreenUtils.getHeight(180))
}

curriculumTableView.snp.makeConstraints{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// LHLoadingView.swift
// LionHeart-iOS
//
// Created by uiskim on 2023/07/20.
//

import UIKit

final class LHLoadingView: UIActivityIndicatorView {

init() {
super.init(frame: .zero)
self.style = .large
self.color = .designSystem(.lionRed)
self.backgroundColor = .designSystem(.black)
self.frame = .init(x: 0, y: 0, width: Constant.Screen.width, height: Constant.Screen.height)
}

required init(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ enum OnboardingPregnancyTextFieldResultType {
case .pregnancyTextFieldValid:
return "정상입니다"
case .pregnancyTextFieldOver:
return "1에서 40 사이의 숫자를 입력해주세요."
return "4에서 40 사이의 숫자를 입력해주세요."
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ final class CompleteOnbardingViewController: UIViewController {
/// 추후 삭제할 component
private let welcomeImageView: UIImageView = {
let imageView = UIImageView()
imageView.backgroundColor = .designSystem(.white)
imageView.image = ImageLiterals.Onboarding.onboardingCompleteImage
imageView.contentMode = .scaleAspectFit
return imageView
}()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ extension GetPregnancyViewController: UITextFieldDelegate {
guard let textNumber = Int(text) else { return }
if textNumber == 0 {
textFieldSettingWhenInputNumberZero()
} else if 1 <= textNumber && textNumber <= 40 {
} else if 4 <= textNumber && textNumber <= 40 {
textFieldSettingWhenInputNumberValid()
} else {
textFieldSettingWhenInpubNumberOver()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ final class OnboardingViewController: UIViewController {
private let onboardingViewController = LHOnboardingPageViewController()
private var pageDataSource: OnboardingViews = []
private lazy var onboardingNavigationbar = LHNavigationBarView(type: .onboarding, viewController: self)
private let loadingIndicatorView = LHLoadingView()

/// onboarding flow property
private var currentPage: OnboardingPageType = .getPregnancy
Expand All @@ -37,6 +38,7 @@ final class OnboardingViewController: UIViewController {
presentOnboardingView(oldValue: onboardingFlow)
case .toCompleteOnboarding:
presentCompleteOnboardingView()

}
}
}
Expand Down Expand Up @@ -160,18 +162,25 @@ private extension OnboardingViewController {
}

func presentCompleteOnboardingView() {
self.view.endEditing(true)

self.nextButton.isUserInteractionEnabled = false
let completeViewController = CompleteOnbardingViewController()
let passingData = UserOnboardingModel(kakaoAccessToken: self.kakaoAccessToken, pregnacny: self.pregnancy, fetalNickname: self.fetalNickName)
completeViewController.userData = passingData
Task {
self.view.addSubview(loadingIndicatorView)
loadingIndicatorView.startAnimating()
do {
try await AuthService.shared.signUp(type: .kakao, onboardingModel: passingData)
self.loadingIndicatorView.stopAnimating()
self.navigationController?.pushViewController(completeViewController, animated: true)

} catch {
guard let error = error as? NetworkError else { return }
handleError(error)
}

}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,29 @@ import UIKit

final class LHTodayArticleTitle: UILabel {

var title: String? {
var userNickName: String? {
didSet {
self.text = title
guard let userNickName else { return }
self.text = userNickName + "님,"
}
}

init() {
super.init(frame: .zero)
self.font = .pretendard(.head1)
self.textColor = .designSystem(.white)
self.numberOfLines = 2
self.numberOfLines = 1
}

init(initalizeString: String) {
super.init(frame: .zero)
self.font = .pretendard(.head1)
self.textColor = .designSystem(.white)
self.text = initalizeString
self.numberOfLines = 1
}


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

0 comments on commit 6808ed2

Please sign in to comment.