@@ -19,6 +19,7 @@ final public class ProfileViewController: UIViewController {
1919 private var profileType : ProfileType
2020 private var presentType : ProfilePresentType
2121 private var nickname : String ?
22+ private var isRefreshProfileImage = false
2223 private var dataSource : UICollectionViewDiffableDataSource < ProfileSectionKind , ProfileCellModel > ?
2324
2425 private lazy var collectionView : UICollectionView = {
@@ -38,7 +39,7 @@ final public class ProfileViewController: UIViewController {
3839 } ( )
3940
4041 private lazy var loadingIndicatorView : LoadingView = {
41- let loadingView : LoadingView = . init( backgroundColor: . white. withAlphaComponent ( 0.2 ) , alpha: 1 )
42+ let loadingView : LoadingView = . init( backgroundColor: . white. withAlphaComponent ( 0 ) , alpha: 1 )
4243 loadingView. stopAnimating ( )
4344 return loadingView
4445 } ( )
@@ -106,6 +107,7 @@ final public class ProfileViewController: UIViewController {
106107 }
107108 viewModel. input. viewWillAppearWithoutMenu ( nickname: nickname)
108109 case . myProfile:
110+ isRefreshProfileImage = true
109111 viewModel. input. viewWillAppearWithMenu ( menuType: menuType)
110112 }
111113 }
@@ -130,13 +132,21 @@ final public class ProfileViewController: UIViewController {
130132 }
131133
132134 @objc func didTapMyFitftyMenu( _ sender: Any ? ) {
135+ guard menuType == . bookmark else {
136+ return
137+ }
138+ isRefreshProfileImage = false
133139 collectionView. isScrollEnabled = true
134140 emptyView. isHidden = true
135141 menuType = . myFitfty
136142 viewModel. input. didTapMenu ( . myFitfty)
137143 }
138144
139145 @objc func didTapBookmarkMenu( _ sender: Any ? ) {
146+ guard menuType == . myFitfty else {
147+ return
148+ }
149+ isRefreshProfileImage = false
140150 collectionView. isScrollEnabled = true
141151 emptyView. isHidden = true
142152 menuType = . bookmark
@@ -299,7 +309,8 @@ private extension ProfileViewController {
299309 supplementaryView. profileView. setUp (
300310 nickname: nickname,
301311 content: content,
302- filepath: self ? . profileFilePath
312+ filepath: self ? . profileFilePath,
313+ refresh: self ? . isRefreshProfileImage ?? true
303314 )
304315 }
305316 return supplementaryView
@@ -316,7 +327,8 @@ private extension ProfileViewController {
316327 supplementaryView. profileView. setUp (
317328 nickname: nickname,
318329 content: content,
319- filepath: self ? . profileFilePath
330+ filepath: self ? . profileFilePath,
331+ refresh: self ? . isRefreshProfileImage ?? true
320332 )
321333 }
322334 supplementaryView. menuView. setMyFitftyButtonTarget ( self , action: #selector( self ? . didTapMyFitftyMenu) )
@@ -345,7 +357,6 @@ private extension ProfileViewController {
345357 snapshot. appendSections ( [ $0. sectionKind] )
346358 snapshot. appendItems ( $0. items)
347359 }
348- snapshot. reloadSections ( [ . feed] )
349360 dataSource? . apply ( snapshot, animatingDifferences: true ) {
350361 guard sections. first? . items. count == 0 else {
351362 return
@@ -355,6 +366,11 @@ private extension ProfileViewController {
355366 self . emptyView. setUp ( self . menuType)
356367 }
357368
369+ guard var currentSnapshot = dataSource? . snapshot ( ) else {
370+ return
371+ }
372+ currentSnapshot. reloadSections ( [ . feed] )
373+ dataSource? . apply ( currentSnapshot, animatingDifferences: false )
358374 }
359375
360376 func postLayout( ) -> UICollectionViewLayout {
0 commit comments