@@ -103,7 +103,8 @@ class TableViewControllerSetting: UITableViewController, UITextFieldDelegate {
103103 [ NSLocalizedString ( " Ignore overlay subtiles " , comment: " " ) ,
104104 NSLocalizedString ( " Auto select streams " , comment: " " ) ] ,
105105 [ NSLocalizedString ( " Current cache size " , comment: " " ) ,
106- NSLocalizedString ( " Cache limit " , comment: " " ) ] ,
106+ NSLocalizedString ( " Cache limit " , comment: " " ) ,
107+ NSLocalizedString ( " Purge cache " , comment: " " ) ] ,
107108 [ NSLocalizedString ( " View online help " , comment: " " ) ,
108109 NSLocalizedString ( " View privacy policy " , comment: " " ) ,
109110 NSLocalizedString ( " Version " , comment: " " ) ,
@@ -302,6 +303,8 @@ class TableViewControllerSetting: UITableViewController, UITextFieldDelegate {
302303 cell. detailTextLabel? . text = NSLocalizedString ( " Not use " , comment: " " )
303304 }
304305 cell. accessoryType = . disclosureIndicator
306+ case 2 :
307+ break ;
305308 default :
306309 break
307310 }
@@ -395,6 +398,8 @@ class TableViewControllerSetting: UITableViewController, UITextFieldDelegate {
395398 }
396399 }
397400 present ( contentVC, animated: true , completion: nil )
401+ case 2 :
402+ deleteCache ( )
398403 default :
399404 break
400405 }
@@ -466,7 +471,28 @@ class TableViewControllerSetting: UITableViewController, UITextFieldDelegate {
466471 */
467472
468473 // MARK: - internal
469-
474+
475+ func deleteCache( ) {
476+ let alert = UIAlertController ( title: NSLocalizedString ( " Purge cache " , comment: " " ) ,
477+ message: NSLocalizedString ( " Delete all internal cache " , comment: " " ) ,
478+ preferredStyle: . alert)
479+ let cancelAction = UIAlertAction ( title: NSLocalizedString ( " Abort " , comment: " " ) , style: . cancel)
480+ let defaultAction = UIAlertAction ( title: NSLocalizedString ( " Delete " , comment: " " ) ,
481+ style: . destructive,
482+ handler: { action in
483+ DispatchQueue . global ( ) . async {
484+ CloudFactory . shared. cache. deleteAllCache ( )
485+ DispatchQueue . main. asyncAfter ( deadline: . now( ) + 2 ) {
486+ self . tableView. reloadData ( )
487+ }
488+ }
489+ } )
490+ alert. addAction ( cancelAction)
491+ alert. addAction ( defaultAction)
492+
493+ present ( alert, animated: true )
494+ }
495+
470496 func deleteAllData( ) {
471497 let alert = UIAlertController ( title: NSLocalizedString ( " Clear all Auth and Cache " , comment: " " ) ,
472498 message: NSLocalizedString ( " Delete all Auth infomation, Delete all internal cache, Delete all user setting in this app " , comment: " " ) ,
0 commit comments