@@ -75,11 +75,6 @@ struct MediaStorageDetailsView: View {
7575 @ViewBuilder
7676 private func actionSection( _ action: Action ) -> some View {
7777 switch action. kind {
78- case . cleanUp:
79- ActionSection ( action: action) {
80- // TODO: Implement a view that shows unattached media (order by file size)
81- Image ( systemName: " trash " )
82- }
8378 case . buyStorage:
8479 ActionSection ( action: action) {
8580 self . purchase = . storage( blog: viewModel. blog)
@@ -89,13 +84,11 @@ struct MediaStorageDetailsView: View {
8984 self . purchase = . upgradePlan( blog: viewModel. blog)
9085 }
9186 }
92-
9387 }
9488}
9589
9690private struct Action {
9791 enum Kind : Hashable {
98- case cleanUp
9992 case buyStorage
10093 case upgradePlan
10194 }
@@ -294,7 +287,6 @@ final class MediaStorageDetailsViewModel: ObservableObject {
294287 fileprivate let blog : Blog
295288 private let client : WordPressClient
296289 private let service : MediaServiceRemoteCoreREST
297- private var unattachedCount : Int ?
298290
299291 @Published fileprivate private( set) var actions : [ Action ] = [ ]
300292 @Published fileprivate private( set) var usage : Usage ?
@@ -320,45 +312,9 @@ final class MediaStorageDetailsViewModel: ObservableObject {
320312 // `BlogService.syncBlogAndAllMetadata` function.
321313
322314 updateUsage ( )
323-
324- do {
325- unattachedCount = try await service. unattachedMediaItemCount ( )
326- } catch {
327- DDLogError ( " Failed due to error: \( error) " )
328- }
329-
330315 updateActions ( )
331316 }
332317
333- private var cleanUpAction : Action {
334- let message : String
335- let state : Action . State
336-
337- if let unattachedCount {
338- if unattachedCount == 0 {
339- message = Strings . cleanupAllAttachedMessage
340- state = . disabled
341- } else {
342- message = String . localizedStringWithFormat (
343- Strings . cleanupMessage,
344- unattachedCount
345- )
346- state = . enabled
347- }
348- } else {
349- message = Strings . cleanupLoadingMessage
350- state = . loading
351- }
352-
353- return Action (
354- icon: " trash " ,
355- title: Strings . cleanupTitle,
356- message: message,
357- kind: . cleanUp,
358- state: state
359- )
360- }
361-
362318 private func updateActions( ) {
363319 var actions = [
364320 Action (
@@ -382,13 +338,6 @@ final class MediaStorageDetailsViewModel: ObservableObject {
382338 )
383339 }
384340
385- let cleanUp = cleanUpAction
386- if cleanUp. state == . disabled {
387- actions. append ( cleanUp)
388- } else {
389- actions. insert ( cleanUp, at: 0 )
390- }
391-
392341 self . actions = actions
393342 }
394343
@@ -414,18 +363,6 @@ private enum Strings {
414363 comment: " Storage usage message showing used space and total space. %1$@ is used space, %2$@ is total space. "
415364 )
416365
417- static let cleanupTitle = NSLocalizedString (
418- " mediaLibrary.storageDetails.cleanup.title " ,
419- value: " Remove unused items " ,
420- comment: " Title for cleanup section "
421- )
422-
423- static let cleanupMessage = NSLocalizedString (
424- " mediaLibrary.storageDetails.cleanup.message " ,
425- value: " %1$d item unattached. Remove them to free up some space. " ,
426- comment: " Message about unattached media that can be cleaned up. %1$d is the count of unattached media. "
427- )
428-
429366 static let buyStorageTitle = NSLocalizedString (
430367 " mediaLibrary.storageDetails.buyStorage.message " ,
431368 value: " Buy storage add-on " ,
@@ -450,18 +387,6 @@ private enum Strings {
450387 comment: " Detail message for upgrading plan "
451388 )
452389
453- static let cleanupAllAttachedMessage = NSLocalizedString (
454- " mediaLibrary.storageDetails.cleanup.allAttached " ,
455- value: " All items in the Media Library are attached. " ,
456- comment: " Message shown when all media items are attached "
457- )
458-
459- static let cleanupLoadingMessage = NSLocalizedString (
460- " mediaLibrary.storageDetails.cleanup.loading " ,
461- value: " Finding out if there are any unattached media items... " ,
462- comment: " Message shown while loading unattached media count "
463- )
464-
465390 static let calculatingUsageMessage = NSLocalizedString (
466391 " mediaLibrary.storageDetails.usage.calculating " ,
467392 value: " Calculating... " ,
0 commit comments