Skip to content

Commit

Permalink
[TEST] Home Logic (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
eung7 authored Jul 24, 2023
2 parents 359d99e + f728f3d commit ac22463
Show file tree
Hide file tree
Showing 20 changed files with 208 additions and 242 deletions.
14 changes: 2 additions & 12 deletions Favor/Favor.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@
2EFF672E2A5058E50097A664 /* BaseSettingsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EFF672D2A5058E50097A664 /* BaseSettingsCell.swift */; };
2EFF67302A5059450097A664 /* SettingsTappableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EFF672F2A5059450097A664 /* SettingsTappableCell.swift */; };
2EFF67322A5059570097A664 /* SettingsSwitchableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EFF67312A5059570097A664 /* SettingsSwitchableCell.swift */; };
DDA780DB2A57BCBF000B6E26 /* Photo.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDA780DA2A57BCBF000B6E26 /* Photo.swift */; };
DD30D6BE2A53E34A0043F1BE /* ReminderDatePopup.swift in Sources */ = {isa = PBXBuildFile; fileRef = E51A21F22A51C7AC003E676F /* ReminderDatePopup.swift */; };
DDA780DB2A57BCBF000B6E26 /* Photo.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDA780DA2A57BCBF000B6E26 /* Photo.swift */; };
E51F55842A4036650002EADB /* FavorTabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = E51F55832A4036650002EADB /* FavorTabBar.swift */; };
E523F63E2A22EBDB007A6317 /* FirendPageVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = E523F63D2A22EBDB007A6317 /* FirendPageVC.swift */; };
E523F6472A231B17007A6317 /* FriendPageViewReactor.swift in Sources */ = {isa = PBXBuildFile; fileRef = E523F6462A231B17007A6317 /* FriendPageViewReactor.swift */; };
Expand All @@ -218,7 +218,6 @@
E52F565B29D5698A004E85A6 /* NewGiftFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = E52F565A29D5698A004E85A6 /* NewGiftFlow.swift */; };
E55CF7BA298A743B002940D1 /* AuthFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = E55CF7B9298A743B002940D1 /* AuthFlow.swift */; };
E55CF7C1298B5631002940D1 /* OnboardingFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = E55CF7C0298B5631002940D1 /* OnboardingFlow.swift */; };
E55CF7C6298B8EBB002940D1 /* DashboardFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = E55CF7C5298B8EBB002940D1 /* DashboardFlow.swift */; };
E56260FC2991E4EA00D14020 /* RSKPlaceholderTextView in Frameworks */ = {isa = PBXBuildFile; productRef = E56260FB2991E4EA00D14020 /* RSKPlaceholderTextView */; };
E57F313D2970004D00E3D449 /* OnboardingCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E57F313C2970004D00E3D449 /* OnboardingCell.swift */; };
E583C58F2A1E619F00DC219A /* AnniversaryBottomSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E583C58E2A1E619F00DC219A /* AnniversaryBottomSheetView.swift */; };
Expand Down Expand Up @@ -452,7 +451,6 @@
E52F565A29D5698A004E85A6 /* NewGiftFlow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewGiftFlow.swift; sourceTree = "<group>"; };
E55CF7B9298A743B002940D1 /* AuthFlow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthFlow.swift; sourceTree = "<group>"; };
E55CF7C0298B5631002940D1 /* OnboardingFlow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingFlow.swift; sourceTree = "<group>"; };
E55CF7C5298B8EBB002940D1 /* DashboardFlow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashboardFlow.swift; sourceTree = "<group>"; };
E57F313C2970004D00E3D449 /* OnboardingCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingCell.swift; sourceTree = "<group>"; };
E583C58E2A1E619F00DC219A /* AnniversaryBottomSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnniversaryBottomSheetView.swift; sourceTree = "<group>"; };
E583C5902A1E627800DC219A /* FilterBottomSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilterBottomSheet.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1566,7 +1564,6 @@
E5CFF72A298404F700E11D9A /* AppStep.swift */,
2EAC60A42A49F68B0047A572 /* AppStepper.swift */,
E55CF7B9298A743B002940D1 /* AuthFlow.swift */,
E55CF7C5298B8EBB002940D1 /* DashboardFlow.swift */,
E59AB0992A17858C00F0AC7D /* FriendFlow.swift */,
2E9B4CB92A1277BC00C7E31E /* FriendListFlow.swift */,
E523F64D2A24DC04007A6317 /* FriendPageFlow.swift */,
Expand Down Expand Up @@ -1833,7 +1830,6 @@
2ED8CB4729B0C30400E7B547 /* AuthTermCell.swift in Sources */,
2ED326C329B327DE001963D0 /* AuthValidateEmailViewReactor.swift in Sources */,
E583C5952A1E62A400DC219A /* MemoBottomSheet.swift in Sources */,
E51A21F52A51C7AC003E676F /* ReminderDatePopup.swift in Sources */,
E524C19629EAA50C004CCC40 /* FriendSelectorHeaderView.swift in Sources */,
2E00561E29A8B131006CF302 /* ProfileSectionFooter.swift in Sources */,
2EC939E32998C63200C8C47F /* ProfileSetupHelperCell.swift in Sources */,
Expand Down Expand Up @@ -1888,9 +1884,8 @@
2E8FFDE02A3AAAFD00C7D254 /* SearchTagSection.swift in Sources */,
2EB3E71B29D5EB77008D10A0 /* PastSectionBackgroundView.swift in Sources */,
2EC939E12998BEAD00C8C47F /* ProfileGiftStatsCollectionHeader.swift in Sources */,
2E7330972A52D7DB009682D2 /* BasePopup.swift in Sources */,
2E3FA75129F713A7003342CA /* EditMyPageProfileHeader.swift in Sources */,
2E3FA75129F713A7003342CA /* EditMyPageCollectionHeaderView.swift in Sources */,
2E3FA75129F713A7003342CA /* EditMyPageProfileHeader.swift in Sources */,
2E95E4B729E8FB8000A46C38 /* SearchUserResultCell.swift in Sources */,
2E76F58529601CD6002FF001 /* SplashVC.swift in Sources */,
2EC358E32A1E786B000313BB /* GiftDetailViewReactor.swift in Sources */,
Expand Down Expand Up @@ -1980,7 +1975,6 @@
2EB3E71129D4356A008D10A0 /* ReminderViewReactor.swift in Sources */,
2EC6E11F29BC6656006FBC11 /* ReminderFlow.swift in Sources */,
2E1C81B22A1EEC3100D4128E /* GiftDetailSection.swift in Sources */,
E55CF7C6298B8EBB002940D1 /* DashboardFlow.swift in Sources */,
2E6E28E42A246C6600E25DB6 /* GiftManagementPinCell.swift in Sources */,
2EC939F1299CF67E00C8C47F /* ProfileGiftStatsCollectionHeaderReactor.swift in Sources */,
2EE07ECF296E8DB500048A3C /* ReminderVC.swift in Sources */,
Expand Down Expand Up @@ -2187,8 +2181,6 @@
OTHER_LIBTOOLFLAGS = "-WLinkingC true -XCBuildForPre true -XCExpApple true";
PRODUCT_BUNDLE_IDENTIFIER = com.favor.Favor.iOS;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "Favor GitHubActions Deploy";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Favor-iOS-Development-Provision";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Favor-Apple-Development-Provision";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
Expand Down Expand Up @@ -2231,8 +2223,6 @@
OTHER_LIBTOOLFLAGS = "-WLinkingC true -XCBuildForPre true -XCExpApple true";
PRODUCT_BUNDLE_IDENTIFIER = com.favor.Favor.iOS;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "Favor GitHubActions Deploy";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Favor-iOS-Development-Provision";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Favor-Apple-Development-Provision";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,6 @@
"version" : "5.0.0"
}
},
{
"identity" : "hero",
"kind" : "remoteSourceControl",
"location" : "https://github.com/HeroTransitions/Hero.git",
"state" : {
"revision" : "66a554b21116fccf61b3aa2205a86f6b0cdc9766",
"version" : "1.6.2"
}
},
{
"identity" : "kakao-ios-sdk",
"kind" : "remoteSourceControl",
Expand Down
28 changes: 24 additions & 4 deletions Favor/Favor/Sources/Flows/AppFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public final class AppFlow: Flow {

case .authIsRequired:
return self.navigateToAuth()

case .localAuthIsRequired(let location):
return self.navigateToLocalAuth(request: location)

Expand All @@ -55,7 +55,10 @@ public final class AppFlow: Flow {

case .wayBackToRootIsRequired:
return self.navigateWayBackToRoot()


case .giftManagementIsRequired:
return self.navigateToGiftManagement()

default:
return .none
}
Expand Down Expand Up @@ -162,10 +165,26 @@ private extension AppFlow {

return .none
}

func navigateWayBackToRoot() -> FlowContributors {
return .one(flowContributor: .forwardToCurrentFlow(withStep: AppStep.authIsRequired))
}

func navigateToGiftManagement() -> FlowContributors {
let newGiftFlow = NewGiftFlow()

Flows.use(newGiftFlow, when: .ready) { [unowned self] root in
DispatchQueue.main.async {
root.modalPresentationStyle = .fullScreen
self.rootViewController.present(root, animated: true)
}
}

return .one(flowContributor: .contribute(
withNextPresentable: newGiftFlow,
withNextStepper: OneStepper(withSingleStep: AppStep.giftManagementIsRequired())
))
}
}

// MARK: - Contributors
Expand All @@ -192,7 +211,8 @@ private extension AppFlow {
.contribute(
withNextPresentable: myPageFlow,
withNextStepper: OneStepper(withSingleStep: AppStep.myPageIsRequired)
)
),
.contribute(withNext: self.rootViewController)
]
}
}
60 changes: 0 additions & 60 deletions Favor/Favor/Sources/Flows/DashboardFlow.swift

This file was deleted.

53 changes: 25 additions & 28 deletions Favor/Favor/Sources/Flows/HomeFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ final class HomeFlow: Flow {
case .reminderIsRequired:
return self.navigateToReminder()

case .filterBottomSheetIsRequired(let sortType):
return self.navigateToFilter(sortedBy: sortType)

case .giftDetailIsRequired(let gift):
return self.navigateToGift(with: gift)

Expand All @@ -62,7 +59,7 @@ private extension HomeFlow {
withNextStepper: homeReactor
))
}

func navigateToSearch() -> FlowContributors {
let searchFlow = SearchFlow(rootViewController: self.rootViewController)

Expand Down Expand Up @@ -90,29 +87,29 @@ private extension HomeFlow {
))
}

func navigateToFilter(sortedBy sortType: SortType) -> FlowContributors {
let filterBottomSheet = FilterBottomSheet()
filterBottomSheet.currentSortType = sortType
filterBottomSheet.modalPresentationStyle = .overFullScreen
self.rootViewController.present(filterBottomSheet, animated: false)
self.filterBottomSheet = filterBottomSheet

return .one(flowContributor: .contribute(
withNextPresentable: filterBottomSheet,
withNextStepper: filterBottomSheet
))
}
// func navigateToFilter(sortedBy sortType: SortType) -> FlowContributors {
// let filterBottomSheet = FilterBottomSheet()
// filterBottomSheet.currentSortType = sortType
// filterBottomSheet.modalPresentationStyle = .overFullScreen
// self.rootViewController.present(filterBottomSheet, animated: false)
// self.filterBottomSheet = filterBottomSheet
//
// return .one(flowContributor: .contribute(
// withNextPresentable: filterBottomSheet,
// withNextStepper: filterBottomSheet
// ))
// }

func dismissFilter(sortedBy sortType: SortType) -> FlowContributors {
self.filterBottomSheet?.animateDismissView()
self.filterBottomSheet = nil

guard let homeVC = self.rootViewController.topViewController as? HomeViewController else {
return .none
}
// TODO: Realm DB 구현하며 Sort, Filter 방식 변경
// homeVC.reactor?.currentSortType.accept(sortType)
// homeVC.filterDidEnded()
return .none
}
// func dismissFilter(sortedBy sortType: SortType) -> FlowContributors {
// self.filterBottomSheet?.animateDismissView()
// self.filterBottomSheet = nil
//
// guard let homeVC = self.rootViewController.topViewController as? HomeViewController else {
// return .none
// }
// // TODO: Realm DB 구현하며 Sort, Filter 방식 변경
//// homeVC.reactor?.currentSortType.accept(sortType)
//// homeVC.filterDidEnded()
// return .none
// }
}
4 changes: 2 additions & 2 deletions Favor/Favor/Sources/Flows/NewGiftFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ final class NewGiftFlow: Flow {

case .friendManagementIsRequired:
return self.navigateToFriendManagement()

case .giftManagementIsCompleteWithNoChanges:
return self.popToTabBar()

case .newGiftIsComplete(let gift):
return self.popToTabBar(with: gift)

Expand Down
2 changes: 1 addition & 1 deletion Favor/Favor/Sources/Models/Storables/Reminder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public struct Reminder: Storable, Receivable {
self.notifyDate = realmObject.notifyTime
self.relatedFriend = realmObject.friendNo
}

public func realmObject() -> ReminderObject {
ReminderObject(
reminderNo: self.identifier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ final class FavorTabBarController: UITabBarController, Stepper {
self.delegate = self
self.setValue(self.favorTabBar, forKey: "tabBar")
self.favorTabBar.selectedIndex = 0

self.favorTabBar.middleButtonObserver = {
// TODO: GiftManagement페이지로 이동합니다.
}
self.favorTabBar.eventDelegate = self
}

/// 탭 바의 높이를 조정해주는 메서드입니다.
Expand All @@ -73,3 +70,10 @@ extension FavorTabBarController: UITabBarControllerDelegate {
HapticManager.haptic(style: .soft)
}
}

extension FavorTabBarController: FavorTabBarDelegate {
/// 중앙의 선물 추가 버튼을 누르면 실행되는 메서드입니다.
func didTapAddGiftButton() {
self.steps.accept(AppStep.giftManagementIsRequired())
}
}
8 changes: 6 additions & 2 deletions Favor/Favor/Sources/Scenes/Dashboard/Views/FavorTabBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import FavorKit
import RxSwift
import SnapKit

protocol FavorTabBarDelegate: AnyObject {
func didTapAddGiftButton()
}

final class FavorTabBar: UITabBar {

// MARK: - UI Components
Expand All @@ -35,7 +39,7 @@ final class FavorTabBar: UITabBar {
}

var isDrawn: Bool = false
var middleButtonObserver: (() -> Void)?
weak var eventDelegate: FavorTabBarDelegate?

// MARK: - DrawCycle

Expand Down Expand Up @@ -201,7 +205,7 @@ final class FavorTabBar: UITabBar {

/// 중앙 버튼이 터치될 때 불려지는 메서드입니다.
@objc private func didTapMiddleButton() {
self.middleButtonObserver?()
self.eventDelegate?.didTapAddGiftButton()
}
}

Expand Down
Loading

0 comments on commit ac22463

Please sign in to comment.