@@ -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,15 @@ final public class ProfileViewController: UIViewController {
130132 }
131133
132134 @objc func didTapMyFitftyMenu( _ sender: Any ? ) {
135+ isRefreshProfileImage = false
133136 collectionView. isScrollEnabled = true
134137 emptyView. isHidden = true
135138 menuType = . myFitfty
136139 viewModel. input. didTapMenu ( . myFitfty)
137140 }
138141
139142 @objc func didTapBookmarkMenu( _ sender: Any ? ) {
143+ isRefreshProfileImage = false
140144 collectionView. isScrollEnabled = true
141145 emptyView. isHidden = true
142146 menuType = . bookmark
@@ -299,7 +303,8 @@ private extension ProfileViewController {
299303 supplementaryView. profileView. setUp (
300304 nickname: nickname,
301305 content: content,
302- filepath: self ? . profileFilePath
306+ filepath: self ? . profileFilePath,
307+ refresh: self ? . isRefreshProfileImage ?? true
303308 )
304309 }
305310 return supplementaryView
@@ -316,7 +321,8 @@ private extension ProfileViewController {
316321 supplementaryView. profileView. setUp (
317322 nickname: nickname,
318323 content: content,
319- filepath: self ? . profileFilePath
324+ filepath: self ? . profileFilePath,
325+ refresh: self ? . isRefreshProfileImage ?? true
320326 )
321327 }
322328 supplementaryView. menuView. setMyFitftyButtonTarget ( self , action: #selector( self ? . didTapMyFitftyMenu) )
@@ -345,7 +351,6 @@ private extension ProfileViewController {
345351 snapshot. appendSections ( [ $0. sectionKind] )
346352 snapshot. appendItems ( $0. items)
347353 }
348- snapshot. reloadSections ( [ . feed] )
349354 dataSource? . apply ( snapshot, animatingDifferences: true ) {
350355 guard sections. first? . items. count == 0 else {
351356 return
@@ -355,6 +360,11 @@ private extension ProfileViewController {
355360 self . emptyView. setUp ( self . menuType)
356361 }
357362
363+ guard var currentSnapshot = dataSource? . snapshot ( ) else {
364+ return
365+ }
366+ currentSnapshot. reloadSections ( [ . feed] )
367+ dataSource? . apply ( currentSnapshot, animatingDifferences: false )
358368 }
359369
360370 func postLayout( ) -> UICollectionViewLayout {
0 commit comments