@@ -159,9 +159,9 @@ struct HomeView: View {
159159 rootVC. present ( videoPlayerViewController, animated: true , completion: nil )
160160 }
161161 } ) {
162- VStack {
162+ VStack ( alignment : . leading ) {
163163 ZStack {
164- KFImage ( URL ( string: item. imageUrl) )
164+ KFImage ( URL ( string: item. imageUrl. isEmpty ? " https://raw.githubusercontent.com/cranci1/Sora/refs/heads/main/assets/banner2.png " : item . imageUrl ) )
165165 . placeholder {
166166 RoundedRectangle ( cornerRadius: 10 )
167167 . fill ( Color . gray. opacity ( 0.3 ) )
@@ -174,6 +174,14 @@ struct HomeView: View {
174174 . frame ( width: 240 , height: 135 )
175175 . cornerRadius ( 10 )
176176 . clipped ( )
177+ . overlay (
178+ KFImage ( URL ( string: item. module. metadata. iconUrl) )
179+ . resizable ( )
180+ . frame ( width: 24 , height: 24 )
181+ . cornerRadius ( 4 )
182+ . padding ( 4 ) ,
183+ alignment: . topLeading
184+ )
177185 }
178186 . overlay (
179187 ZStack {
@@ -185,7 +193,7 @@ struct HomeView: View {
185193 ProgressView ( value: item. progress)
186194 . progressViewStyle ( LinearProgressViewStyle ( tint: . white) )
187195 . padding ( . horizontal, 8 )
188- . scaleEffect ( x: 1 , y: 2 , anchor: . center)
196+ . scaleEffect ( x: 1 , y: 1.5 , anchor: . center)
189197 } ,
190198 alignment: . bottom
191199 )
@@ -204,12 +212,21 @@ struct HomeView: View {
204212 }
205213 . padding ( . horizontal, 8 )
206214 }
215+ . frame ( width: 250 , height: 190 )
216+ }
217+ . contextMenu {
218+ Button ( action: { markContinueWatchingItemAsWatched ( item: item) } ) {
219+ Label ( " Mark as Watched " , systemImage: " checkmark.circle " )
220+ }
221+ Button ( role: . destructive, action: { removeContinueWatchingItem ( item: item) } ) {
222+ Label ( " Remove Item " , systemImage: " trash " )
223+ }
207224 }
208225 }
209226 }
210- . frame ( width: 250 , height: 200 )
211227 . padding ( . horizontal, 8 )
212228 }
229+ . frame ( height: 190 )
213230 }
214231 }
215232 }
@@ -232,4 +249,24 @@ struct HomeView: View {
232249 }
233250 . navigationViewStyle ( StackNavigationViewStyle ( ) )
234251 }
252+
253+ private func markContinueWatchingItemAsWatched( item: ContinueWatchingItem ) {
254+ let key = " lastPlayedTime_ \( item. fullUrl) "
255+ let totalKey = " totalTime_ \( item. fullUrl) "
256+ UserDefaults . standard. set ( 99999999.0 , forKey: key)
257+ UserDefaults . standard. set ( 99999999.0 , forKey: totalKey)
258+ ContinueWatchingManager . shared. remove ( item: item)
259+
260+ if let index = continueWatchingItems. firstIndex ( where: { $0. id == item. id } ) {
261+ continueWatchingItems. remove ( at: index)
262+ }
263+ }
264+
265+ private func removeContinueWatchingItem( item: ContinueWatchingItem ) {
266+ ContinueWatchingManager . shared. remove ( item: item)
267+
268+ if let index = continueWatchingItems. firstIndex ( where: { $0. id == item. id } ) {
269+ continueWatchingItems. remove ( at: index)
270+ }
271+ }
235272}
0 commit comments