Skip to content

Commit eb88bfc

Browse files
committed
♻️ [refactor] 메뉴 탭 애니메이션 개선
1 parent 99f737f commit eb88bfc

File tree

6 files changed

+10
-20
lines changed

6 files changed

+10
-20
lines changed

Fitfty/Projects/Coordinator/Sources/Profile/ProfileCoordinator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ extension ProfileCoordinator: ProfileCoordinatorInterface {
122122
func showMyFitfty(_ myFitftyType: MyFitftyType) {
123123
let coordinator = makeMyFitftyCoordinator(myFitftyType)
124124
coordinator.start()
125-
coordinator.navigationController.modalPresentationStyle = .overFullScreen
125+
coordinator.navigationController.modalPresentationStyle = .fullScreen
126126
navigationController.present(coordinator.navigationController, animated: true)
127127
}
128128

Fitfty/Projects/Profile/Sources/Post/Views/MyPostBottomSheetView.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,3 @@ extension MyPostBottomSheetView {
7575
}
7676

7777
}
78-

Fitfty/Projects/Profile/Sources/Profile/ViewControllers/ProfileViewController.swift

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ private extension ProfileViewController {
290290
collectionView: collectionView,
291291
cellProvider: { (collectionView, indexPath, item) -> UICollectionViewCell? in
292292
switch item {
293-
case .feed(let filepath, _):
293+
case .feed(let filepath, _, _):
294294
guard let cell = collectionView.dequeueReusableCell(
295295
withReuseIdentifier: FeedImageCell.className,
296296
for: indexPath) as? FeedImageCell else {
@@ -363,6 +363,7 @@ private extension ProfileViewController {
363363
snapshot.appendSections([$0.sectionKind])
364364
snapshot.appendItems($0.items)
365365
}
366+
snapshot.reloadSections([.feed])
366367
dataSource?.apply(snapshot, animatingDifferences: true) {
367368
guard sections.first?.items.count == 0 else {
368369
return
@@ -371,12 +372,6 @@ private extension ProfileViewController {
371372
self.emptyView.isHidden = false
372373
self.emptyView.setUp(self.menuType)
373374
}
374-
375-
guard var currentSnapshot = dataSource?.snapshot() else {
376-
return
377-
}
378-
currentSnapshot.reloadSections([.feed])
379-
dataSource?.apply(currentSnapshot, animatingDifferences: false)
380375
}
381376

382377
func postLayout() -> UICollectionViewLayout {

Fitfty/Projects/Profile/Sources/Profile/ViewModel/ProfileSection.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@ public enum ProfileSectionKind: Hashable {
3737

3838
enum ProfileCellModel: Hashable {
3939

40-
case feed(String, ProfileType)
40+
case feed(String, ProfileType, UUID)
4141

4242
func hash(into hasher: inout Hasher) {
4343
switch self {
44-
case .feed(let filepath, let profileType):
44+
case .feed(let filepath, let profileType, let uuid):
4545
hasher.combine(filepath)
4646
hasher.combine(profileType)
47+
hasher.combine(uuid)
4748
}
4849
}
4950

Fitfty/Projects/Profile/Sources/Profile/ViewModel/ProfileViewModel.swift

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ extension ProfileViewModel {
137137
}
138138
var profileCellModels: [ProfileCellModel] = []
139139
for cody in data.codiList {
140-
profileCellModels.append(ProfileCellModel.feed(cody.filePath, .myProfile))
140+
profileCellModels.append(ProfileCellModel.feed(cody.filePath, .myProfile, UUID()))
141141
}
142142
self.currentState.send(.sections([
143143
ProfileSection(sectionKind: .feed, items: profileCellModels)
@@ -161,8 +161,6 @@ extension ProfileViewModel {
161161
return
162162
}
163163
do {
164-
self.currentState.send(.isLoading(true))
165-
166164
let response = try await getMyProfile()
167165
self.response = response
168166
if response.result == "SUCCESS" {
@@ -177,26 +175,24 @@ extension ProfileViewModel {
177175
switch menuType {
178176
case .myFitfty:
179177
for cody in data.codiList {
180-
profileCellModels.append(ProfileCellModel.feed(cody.filePath, .myProfile))
178+
profileCellModels.append(ProfileCellModel.feed(cody.filePath, .myProfile, UUID()))
181179
}
182180
self.currentState.send(.sections([
183181
ProfileSection(sectionKind: .feed, items: profileCellModels)
184182
]))
185183
case .bookmark:
186184
for cody in data.bookmarkList {
187-
profileCellModels.append(ProfileCellModel.feed(cody.filePath, .myProfile))
185+
profileCellModels.append(ProfileCellModel.feed(cody.filePath, .myProfile, UUID()))
188186
}
189187
self.currentState.send(.sections([
190188
ProfileSection(sectionKind: .feed, items: profileCellModels)
191189
]))
192190
}
193191
} else {
194-
currentState.send(.isLoading(false))
195192
currentState.send(.errorMessage("프로필 조회에 알 수 없는 에러가 발생했습니다."))
196193
}
197194
} catch {
198195
Logger.debug(error: error, message: "프로필 조회를 실패")
199-
currentState.send(.isLoading(false))
200196
currentState.send(.errorMessage("프로필 조회에 알 수 없는 에러가 발생했습니다."))
201197
}
202198

Fitfty/Projects/Profile/Sources/Profile/Views/ProfileView.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ extension ProfileView {
7373
if refresh {
7474
imageView.kf.setImage(
7575
with: url,
76-
placeholder: CommonAsset.Images.profileDummy.image,
77-
options: [.forceRefresh, .transition(.fade(0.1))]
76+
options: [.forceRefresh, .transition(.fade(0.3))]
7877
)
7978
} else {
8079
imageView.kf.setImage(with: url)

0 commit comments

Comments
 (0)