@@ -41,7 +41,7 @@ public struct MainTabFeature {
4141 @Presents var contentDetail : ContentDetailFeature . State ?
4242 @Shared ( . inMemory( " SelectCategory " ) ) var categoryId : Int ?
4343 @Shared ( . inMemory( " PushTapped " ) ) var isPushTapped : Bool = false
44- var savedContentId : Int ?
44+ var categoryOfSavedContent : BaseCategoryItem ?
4545
4646 public init ( ) {
4747 self . pokit = . init( )
@@ -78,6 +78,7 @@ public struct MainTabFeature {
7878 case ๊ฒฝ๊ณ _๋์( BaseError )
7979 case errorSheetPresented( Bool )
8080 case ๋งํฌํ์
_ํ์ฑํ( PokitLinkPopup . PopupType )
81+ case ์นดํ
๊ณ ๋ฆฌ์์ธ_์ด๋( category: BaseCategoryItem )
8182 }
8283 public enum AsyncAction : Equatable {
8384 case ๊ณต์ ๋ฐ์_์นดํ
๊ณ ๋ฆฌ_์กฐํ( categoryId: Int )
@@ -98,7 +99,7 @@ public struct MainTabFeature {
9899 switch action {
99100 case . binding( \. linkPopup) :
100101 guard state. linkPopup == nil else { return . none }
101- state. savedContentId = nil
102+ state. categoryOfSavedContent = nil
102103 return . none
103104 case . binding:
104105 return . none
@@ -183,15 +184,15 @@ private extension MainTabFeature {
183184 }
184185 )
185186 case . onOpenURL( url: let url) :
186- guard let components = URLComponents ( url : url , resolvingAgainstBaseURL : false ) else {
187- return . none
188- }
187+ guard
188+ let components = URLComponents ( url : url , resolvingAgainstBaseURL : false )
189+ else { return . none }
189190
190191 let queryItems = components. queryItems ?? [ ]
191- guard let categoryIdString = queryItems . first ( where : { $0 . name == " categoryId " } ) ? . value ,
192- let categoryId = Int ( categoryIdString ) else {
193- return . none
194- }
192+ guard
193+ let categoryIdString = queryItems . first ( where : { $0 . name == " categoryId " } ) ? . value ,
194+ let categoryId = Int ( categoryIdString )
195+ else { return . none }
195196
196197 return . send( . async( . ๊ณต์ ๋ฐ์_์นดํ
๊ณ ๋ฆฌ_์กฐํ( categoryId: categoryId) ) )
197198 case . ๊ฒฝ๊ณ _ํ์ธ๋ฒํผ_ํด๋ฆญ:
@@ -222,7 +223,14 @@ private extension MainTabFeature {
222223 case let . ๋งํฌํ์
_ํ์ฑํ( type) :
223224 state. linkPopup = type
224225 return . none
225-
226+ case let . ์นดํ
๊ณ ๋ฆฌ์์ธ_์ด๋( category) :
227+ if category. categoryName == " ๋ฏธ๋ถ๋ฅ " {
228+ state. selectedTab = . pokit
229+ state. path. removeAll ( )
230+ return . send( . pokit( . delegate( . ๋ฏธ๋ถ๋ฅ_์นดํ
๊ณ ๋ฆฌ_ํ์ฑํ) ) )
231+ }
232+ state. path. append ( . ์นดํ
๊ณ ๋ฆฌ์์ธ( . init( category: category) ) )
233+ return . none
226234 default : return . none
227235 }
228236 }
@@ -259,9 +267,9 @@ private extension MainTabFeature {
259267 return . send( . delegate( . ๋งํฌ์ถ๊ฐํ๊ธฐ) )
260268 case . success:
261269 state. linkPopup = nil
262- state . contentDetail = . init ( contentId : state . savedContentId )
263- state. savedContentId = nil
264- return . none
270+ guard let category = state . categoryOfSavedContent else { return . none }
271+ state. categoryOfSavedContent = nil
272+ return . send ( . inner ( . ์นดํ
๊ณ ๋ฆฌ์์ธ_์ด๋ ( category : category ) ) )
265273 case . error, . text, . warning, . none:
266274 return . none
267275 }
0 commit comments