From ba8d3e7271b1fe682bf8b8aa299c2215fbb12547 Mon Sep 17 00:00:00 2001 From: Max Radermacher Date: Fri, 21 Apr 2023 15:31:00 -0700 Subject: [PATCH] =?UTF-8?q?Show=20a=20spinner=20during=20=E2=80=9CClear=20?= =?UTF-8?q?Chat=20History=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChatsSettingsViewController.swift | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/Signal/src/ViewControllers/AppSettings/ChatsSettingsViewController.swift b/Signal/src/ViewControllers/AppSettings/ChatsSettingsViewController.swift index 5f8cb78252..4f5911e90a 100644 --- a/Signal/src/ViewControllers/AppSettings/ChatsSettingsViewController.swift +++ b/Signal/src/ViewControllers/AppSettings/ChatsSettingsViewController.swift @@ -6,6 +6,7 @@ import Foundation import IntentsUI import SignalMessaging +import SignalUI @objc class ChatsSettingsViewController: OWSTableViewController2 { @@ -181,9 +182,24 @@ class ChatsSettingsViewController: OWSTableViewController2 { "SETTINGS_DELETE_HISTORYLOG_CONFIRMATION_BUTTON", comment: "Confirmation text for button which deletes all message, calling, attachments, etc." ), - proceedStyle: .destructive - ) { _ in - ThreadUtil.deleteAllContentWithSneakyTransaction() - } + proceedStyle: .destructive, + proceedAction: { [weak self] _ in self?.clearHistory() } + ) + } + + private func clearHistory() { + ModalActivityIndicatorViewController.present( + fromViewController: self, + canCancel: false, + presentationDelay: 0.5, + backgroundBlock: { modal in + DispatchQueue.global(qos: .userInitiated).async { + ThreadUtil.deleteAllContentWithSneakyTransaction() + DispatchQueue.main.async { + modal.dismiss() + } + } + } + ) } }