Skip to content

Commit

Permalink
#85 Main Tab Bar 수정
Browse files Browse the repository at this point in the history
- closed 85
  • Loading branch information
ezidayzi committed May 15, 2023
1 parent dd66347 commit 54f505f
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 37 deletions.
9 changes: 6 additions & 3 deletions dandi/dandi/Data/Network/Service/AuthService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Moya

enum AuthService {
case refresh(refreshToken: String, accessToken: String)
case login(idToken: String)
case login(idToken: String, fcmToken: String)
case logout
case witdraw
}
Expand Down Expand Up @@ -48,9 +48,12 @@ extension AuthService: BaseTargetType {

var task: Task {
switch self {
case let .login(idToken):
case let .login(idToken, fcmToken):
return .requestParameters(
parameters: ["idToken": idToken],
parameters: [
"idToken": idToken,
"pushNotificationToken": fcmToken
],
encoding: JSONEncoding.default
)
default:
Expand Down
4 changes: 2 additions & 2 deletions dandi/dandi/Data/Repositories/DefaultAuthRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ final class DefaultAuthRepository: AuthRepository {
}

func fetchUserInfo(
fcmToken _: String,
fcmToken: String,
idToken: String
) -> Single<NetworkResult<Token>> {
return router.rx.request(.login(idToken: idToken))
return router.rx.request(.login(idToken: idToken, fcmToken: fcmToken))
.map { response in
let decodedResponse: NetworkResult<TokenDTO> = NetworkHandler.requestDecoded(by: response)
switch decodedResponse {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "ic.closet.filled.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.
1 change: 1 addition & 0 deletions dandi/dandi/Global/Resource/Image.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ struct Image {
static let btnRotation = UIImage(named: "btnRotation")!
static let settingLine = UIImage(named: "ic_setting_line")!
static let closetLine = UIImage(named: "ic_closet_line")!
static let closetFilled = UIImage(named: "ic.closet.filled")!

static let background1 = UIImage(named: "img.background1")!
static let background2 = UIImage(named: "img.background2")!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ import YDS
final class ClosetMainViewController: BaseViewController, View {
typealias Reactor = ClosetTabReactor

override var hidesBottomBarWhenPushed: Bool {
get { navigationController?.topViewController == self }
set { super.hidesBottomBarWhenPushed = newValue }
}

private var categoryList: [CategoryInfo] = [] {
didSet {
category = categoryList.map { $0.category }
Expand Down Expand Up @@ -73,21 +68,10 @@ final class ClosetMainViewController: BaseViewController, View {

override init() {
super.init()
setProperties()
setCollectionView()
setLayouts()
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.navigationBar.isHidden = false
}

override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
navigationController?.navigationBar.isHidden = true
}

func bind(reactor: Reactor) {
bindAction(reactor)
bindState(reactor)
Expand Down Expand Up @@ -168,10 +152,6 @@ final class ClosetMainViewController: BaseViewController, View {
}
}

private func setProperties() {
title = "옷장"
}

private func setLayouts() {
view.addSubview(emptyLabel)
emptyLabel.snp.makeConstraints { make in
Expand Down
7 changes: 6 additions & 1 deletion dandi/dandi/Presentation/Login/LoginViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ final class LoginViewController: BaseViewController, View {
.disposed(by: disposeBag)

tokenPublisher
.map { idToken in Reactor.Action.loginButtonDidTap(fcmToken: "", idToken: idToken) }
.map { idToken in
Reactor.Action.loginButtonDidTap(
fcmToken: UserDefaultHandler.shared.fcmToken,
idToken: idToken
)
}
.bind(to: reactor.action)
.disposed(by: disposeBag)

Expand Down
28 changes: 19 additions & 9 deletions dandi/dandi/Presentation/Tab/MainTabBarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,36 @@ extension MainTabBarController {
selectedImage: Tab.feed.selectedImage
)

let myPageVC = factory.makeMyPageViewController()
let myPageNavigationController = YDSNavigationController(rootViewController: myPageVC)
myPageNavigationController.title = "마이페이지"
myPageNavigationController.tabBarItem = UITabBarItem(
title: nil,
image: Tab.my.image,
selectedImage: Tab.my.selectedImage
)

let chatVC = factory.makeChatViewController()
let chatNavigationController = YDSNavigationController(rootViewController: chatVC)
chatNavigationController.title = "단디챗"
chatNavigationController.tabBarItem = UITabBarItem(
title: nil,
image: Tab.chat.image,
selectedImage: Tab.chat.selectedImage
)

let closetVC = factory.makeClosetMainViewController()
let closetNavigationController = YDSNavigationController(rootViewController: closetVC)
closetNavigationController.title = "내 옷장"
closetNavigationController.tabBarItem = UITabBarItem(
title: nil,
image: Tab.closet.image,
selectedImage: Tab.closet.selectedImage
)

let myPageVC = factory.makeMyPageViewController()
let myPageNavigationController = YDSNavigationController(rootViewController: myPageVC)
myPageNavigationController.title = "마이페이지"
myPageNavigationController.tabBarItem = UITabBarItem(
title: nil,
image: Tab.my.image,
selectedImage: Tab.my.selectedImage
)

super.setViewControllers([
homeNavigationController,
closetNavigationController,
feedNavigationController,
chatNavigationController,
myPageNavigationController
Expand Down
14 changes: 12 additions & 2 deletions dandi/dandi/Presentation/Tab/Tab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import YDS

enum Tab: Int, CaseIterable {
case home = 0
case feed = 1
case my = 2
case closet = 1
case feed = 2
case chat = 3
case my = 4

var image: UIImage {
switch self {
Expand All @@ -22,6 +24,10 @@ enum Tab: Int, CaseIterable {
return YDSIcon.feedLine
case .my:
return YDSIcon.personLine
case .closet:
return Image.closetLine.resize(newWidth: 21)
case .chat:
return YDSIcon.commentLine.resize(newWidth: 21)
}
}

Expand All @@ -33,6 +39,10 @@ enum Tab: Int, CaseIterable {
return YDSIcon.feedFilled
case .my:
return YDSIcon.personFilled
case .closet:
return Image.closetFilled.resize(newWidth: 21)
case .chat:
return YDSIcon.commentFilled.resize(newWidth: 21)
}
}

Expand Down

0 comments on commit 54f505f

Please sign in to comment.