mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-30 22:07:57 +01:00 
			
		
		
		
	Ability to delete reading history (#3871)
* Added ability to delete history for all manga * Fix review comments
This commit is contained in:
		| @@ -95,6 +95,16 @@ class SettingsAdvancedController : SettingsController() { | ||||
|                     ctrl.showDialog(router) | ||||
|                 } | ||||
|             } | ||||
|             preference { | ||||
|                 titleRes = R.string.pref_clear_history | ||||
|                 summaryRes = R.string.pref_clear_history_summary | ||||
|  | ||||
|                 onClick { | ||||
|                     val ctrl = ClearHistoryDialogController() | ||||
|                     ctrl.targetController = this@SettingsAdvancedController | ||||
|                     ctrl.showDialog(router) | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         preferenceCategory { | ||||
| @@ -172,6 +182,22 @@ class SettingsAdvancedController : SettingsController() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     class ClearHistoryDialogController : DialogController() { | ||||
|         override fun onCreateDialog(savedViewState: Bundle?): Dialog { | ||||
|             return MaterialDialog(activity!!) | ||||
|                 .message(R.string.clear_history_confirmation) | ||||
|                 .positiveButton(android.R.string.ok) { | ||||
|                     (targetController as? SettingsAdvancedController)?.clearHistory() | ||||
|                 } | ||||
|                 .negativeButton(android.R.string.cancel) | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private fun clearHistory() { | ||||
|         db.deleteHistory().executeAsBlocking() | ||||
|         activity?.toast(R.string.clear_history_completed) | ||||
|     } | ||||
|  | ||||
|     private fun clearDatabase() { | ||||
|         db.deleteMangasNotInLibrary().executeAsBlocking() | ||||
|         db.deleteHistoryNoLastRead().executeAsBlocking() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user