@@ -121,6 +121,7 @@ class ActionLogBottomSheet : BottomSheetDialogFragment() {
121121 private fun performRollback (log : ActionLog ) {
122122 val b = binding ? : return
123123 val pm = policyManager ? : return
124+ val rm = rollbackManager ? : return
124125
125126 lifecycleScope.launch {
126127 b.progressBar.visibility = View .VISIBLE
@@ -140,13 +141,28 @@ class ActionLogBottomSheet : BottomSheetDialogFragment() {
140141 }
141142
142143 val failCount = results.count { it.second.isFailure }
144+ val success = failCount == 0
143145
144- if (failCount == 0 ) {
146+ // Log the rollback action
147+ val rollbackActionName = " ROLLBACK_" + log.action
148+ withContext(Dispatchers .IO ) {
149+ rm.logAction(ActionLog (
150+ action = rollbackActionName,
151+ packages = log.packages,
152+ success = success,
153+ message = if (success) " Rolled back from ${log.action} " else " $failCount failed"
154+ ))
155+ }
156+
157+ if (success) {
145158 Toast .makeText(context, R .string.log_rollback_success, Toast .LENGTH_SHORT ).show()
146159 } else {
147160 Toast .makeText(context, getString(R .string.log_rollback_partial, failCount), Toast .LENGTH_SHORT ).show()
148161 }
149162
163+ // Refresh the log list
164+ loadLogs()
165+
150166 } catch (e: Exception ) {
151167 Toast .makeText(context, getString(R .string.log_rollback_failed, e.message), Toast .LENGTH_SHORT ).show()
152168 } finally {
0 commit comments