Skip to content

Commit 18b45f5

Browse files
refactor: Rename flushAlert variables
1 parent 74cd3b5 commit 18b45f5

11 files changed

+46
-46
lines changed

Mail/Utils/ShortcutModifier.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct ShortcutModifier: ViewModifier {
3131

3232
@LazyInjectService private var matomo: MatomoUtils
3333

34-
@ModalState private var flushAlert: DestructiveActionAlertState?
34+
@ModalState private var destructiveAlert: DestructiveActionAlertState?
3535

3636
@ObservedObject var viewModel: ThreadListViewModel
3737
@ObservedObject var multipleSelectionViewModel: MultipleSelectionViewModel
@@ -59,8 +59,8 @@ struct ShortcutModifier: ViewModifier {
5959

6060
content
6161
}
62-
.customAlert(item: $flushAlert) { item in
63-
DestructiveActionAlertView(flushAlert: item, folder: viewModel.frozenFolder)
62+
.customAlert(item: $destructiveAlert) { item in
63+
DestructiveActionAlertView(destructiveAlert: item, folder: viewModel.frozenFolder)
6464
}
6565
}
6666

@@ -79,7 +79,7 @@ struct ShortcutModifier: ViewModifier {
7979
try await actionsManager.performAction(
8080
target: messages,
8181
action: .delete,
82-
origin: .shortcut(originFolder: viewModel.frozenFolder, nearestFlushAlert: $flushAlert)
82+
origin: .shortcut(originFolder: viewModel.frozenFolder, nearestDestructiveAlert: $destructiveAlert)
8383
)
8484
}
8585
}

Mail/Views/Bottom sheets/Actions/ActionsPanelViewModifier.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct ActionsPanelViewModifier: ViewModifier {
5151
@ModalState private var blockSenderAlert: BlockRecipientAlertState?
5252
@ModalState private var blockSendersList: BlockRecipientState?
5353
@ModalState private var messagesToMove: [Message]?
54-
@ModalState private var flushAlert: DestructiveActionAlertState?
54+
@ModalState private var destructiveAlert: DestructiveActionAlertState?
5555
@ModalState private var shareMailLink: ShareMailLinkResult?
5656
@ModalState private var messagesToSnooze: [Message]?
5757
@ModalState private var messagesToDownload: [Message]?
@@ -66,7 +66,7 @@ struct ActionsPanelViewModifier: ViewModifier {
6666
.floatingPanel(
6767
source: panelSource,
6868
originFolder: originFolder?.freezeIfNeeded(),
69-
nearestFlushAlert: $flushAlert,
69+
nearestDestructiveAlert: $destructiveAlert,
7070
nearestMessagesToMoveSheet: $messagesToMove,
7171
nearestBlockSenderAlert: $blockSenderAlert,
7272
nearestBlockSendersList: $blockSendersList,
@@ -130,8 +130,8 @@ struct ActionsPanelViewModifier: ViewModifier {
130130
completionHandler: completionHandler
131131
)
132132
}
133-
.customAlert(item: $flushAlert) { item in
134-
DestructiveActionAlertView(flushAlert: item, folder: originFolder)
133+
.customAlert(item: $destructiveAlert) { item in
134+
DestructiveActionAlertView(destructiveAlert: item, folder: originFolder)
135135
}
136136
.customAlert(item: $messagesToDownload) { messages in
137137
ConfirmationSaveThreadInKdrive(targetMessages: messages)

Mail/Views/Thread List/DestructiveActionAlertView.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,31 +76,31 @@ extension DestructiveActionAlertState {
7676
struct DestructiveActionAlertView: View {
7777
@LazyInjectService private var matomo: MatomoUtils
7878

79-
let flushAlert: DestructiveActionAlertState
79+
let destructiveAlert: DestructiveActionAlertState
8080
var frozenFolder: Folder?
8181

82-
init(flushAlert: DestructiveActionAlertState, folder: Folder? = nil) {
83-
self.flushAlert = flushAlert
82+
init(destructiveAlert: DestructiveActionAlertState, folder: Folder? = nil) {
83+
self.destructiveAlert = destructiveAlert
8484
frozenFolder = folder?.freezeIfNeeded()
8585
}
8686

8787
var body: some View {
8888
VStack(alignment: .leading, spacing: IKPadding.large) {
89-
Text(flushAlert.title(in: frozenFolder))
89+
Text(destructiveAlert.title(in: frozenFolder))
9090
.textStyle(.bodyMedium)
91-
Text(flushAlert.description)
91+
Text(destructiveAlert.description)
9292
.textStyle(.body)
9393

9494
ModalButtonsView(primaryButtonTitle: MailResourcesStrings.Localizable.buttonConfirm) {
95-
if let frozenFolder, flushAlert.impactedMessages == nil {
95+
if let frozenFolder, destructiveAlert.impactedMessages == nil {
9696
matomo.track(eventWithCategory: .threadList, name: "empty\(frozenFolder.matomoName.capitalized)Confirm")
9797
}
98-
await flushAlert.completion()
98+
await destructiveAlert.completion()
9999
}
100100
}
101101
}
102102
}
103103

104104
#Preview {
105-
DestructiveActionAlertView(flushAlert: DestructiveActionAlertState(type: .delete) { /* Preview */ })
105+
DestructiveActionAlertView(destructiveAlert: DestructiveActionAlertState(type: .delete) { /* Preview */ })
106106
}

Mail/Views/Thread List/FlushFolderView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ struct FlushFolderView: View {
4040
let folder: Folder
4141
let mailboxManager: MailboxManager
4242

43-
@Binding var flushAlert: DestructiveActionAlertState?
43+
@Binding var destructiveAlert: DestructiveActionAlertState?
4444

4545
private var label: String {
4646
Self.labels[folder.role ?? .trash] ?? ""
@@ -60,7 +60,7 @@ struct FlushFolderView: View {
6060
matomo.track(eventWithCategory: .threadList, name: "empty\(folder.matomoName.capitalized)")
6161

6262
let frozenFolder = folder.freezeIfNeeded()
63-
flushAlert = DestructiveActionAlertState(type: .delete) {
63+
destructiveAlert = DestructiveActionAlertState(type: .delete) {
6464
await tryOrDisplayError {
6565
_ = try await mailboxManager.flushFolder(folder: frozenFolder)
6666
}
@@ -87,5 +87,5 @@ struct FlushFolderView: View {
8787
#Preview {
8888
FlushFolderView(folder: PreviewHelper.sampleFolder,
8989
mailboxManager: PreviewHelper.sampleMailboxManager,
90-
flushAlert: .constant(nil))
90+
destructiveAlert: .constant(nil))
9191
}

Mail/Views/Thread List/ThreadListModifiers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ struct ThreadListToolbar: ViewModifier {
123123
action: action,
124124
origin: .multipleSelection(
125125
originFolder: originFolder,
126-
nearestFlushAlert: $mainViewState.flushAlert,
126+
nearestDestructiveAlert: $mainViewState.destructiveAlert,
127127
nearestMessagesToMoveSheet: nil
128128
)
129129
)

Mail/Views/Thread List/ThreadListSwipeAction.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ private struct SwipeActionView: View {
3333

3434
@Binding var actionPanelMessages: [Message]?
3535
@Binding var moveSheetMessages: [Message]?
36-
@Binding var flushAlert: DestructiveActionAlertState?
36+
@Binding var destructiveAlert: DestructiveActionAlertState?
3737

3838
let viewModel: ThreadListable
3939
let thread: Thread
@@ -56,7 +56,7 @@ private struct SwipeActionView: View {
5656
originFolder: thread.folder,
5757
nearestMessagesActionsPanel: $actionPanelMessages,
5858
nearestMessagesToMoveSheet: $moveSheetMessages,
59-
nearestFlushAlert: $flushAlert
59+
nearestDestructiveAlert: $destructiveAlert
6060
)
6161
)
6262

@@ -125,7 +125,7 @@ struct ThreadListSwipeActions: ViewModifier {
125125
SwipeActionView(
126126
actionPanelMessages: $actionPanelMessages,
127127
moveSheetMessages: $messagesToMove,
128-
flushAlert: $mainViewState.flushAlert,
128+
destructiveAlert: $mainViewState.destructiveAlert,
129129
viewModel: viewModel,
130130
thread: thread,
131131
action: action
@@ -149,7 +149,7 @@ extension View {
149149
SwipeActionView(
150150
actionPanelMessages: .constant(nil),
151151
moveSheetMessages: .constant(nil),
152-
flushAlert: .constant(nil),
152+
destructiveAlert: .constant(nil),
153153
viewModel: ThreadListViewModel(mailboxManager: PreviewHelper.sampleMailboxManager,
154154
frozenFolder: PreviewHelper.sampleFolder,
155155
selectedThreadOwner: PreviewHelper.mockSelectedThreadOwner),

Mail/Views/Thread List/ThreadListView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ struct ThreadListView: View {
103103
FlushFolderView(
104104
folder: viewModel.frozenFolder,
105105
mailboxManager: viewModel.mailboxManager,
106-
flushAlert: $mainViewState.flushAlert
106+
destructiveAlert: $mainViewState.destructiveAlert
107107
)
108108
.threadListCellAppearance()
109109
}
@@ -220,8 +220,8 @@ struct ThreadListView: View {
220220
.task(id: viewModel.mailboxManager.mailbox.id) {
221221
updateFetchingTask()
222222
}
223-
.customAlert(item: $mainViewState.flushAlert) { item in
224-
DestructiveActionAlertView(flushAlert: item, folder: viewModel.frozenFolder)
223+
.customAlert(item: $mainViewState.destructiveAlert) { item in
224+
DestructiveActionAlertView(destructiveAlert: item, folder: viewModel.frozenFolder)
225225
}
226226
.customAlert(isPresented: $isShowingUpdateAlert) {
227227
// swiftlint:disable:next trailing_closure

Mail/Views/Thread/WebView/ThreadViewToolbarModifier.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct ThreadViewToolbarModifier: ViewModifier {
4343
@State private var replyOrReplyAllMessage: Message?
4444
@State private var messagesToMove: [Message]?
4545

46-
@ModalState private var nearestFlushAlert: DestructiveActionAlertState?
46+
@ModalState private var destructiveAlert: DestructiveActionAlertState?
4747

4848
private let frozenThread: Thread
4949

@@ -111,8 +111,8 @@ struct ThreadViewToolbarModifier: ViewModifier {
111111
}
112112
}
113113
}
114-
.customAlert(item: $nearestFlushAlert) { item in
115-
DestructiveActionAlertView(flushAlert: item)
114+
.customAlert(item: $destructiveAlert) { item in
115+
DestructiveActionAlertView(destructiveAlert: item)
116116
}
117117
}
118118

@@ -147,7 +147,7 @@ struct ThreadViewToolbarModifier: ViewModifier {
147147
try await actionsManager.performAction(
148148
target: frozenMessages,
149149
action: action,
150-
origin: .toolbar(originFolder: frozenFolder, nearestFlushAlert: $nearestFlushAlert)
150+
origin: .toolbar(originFolder: frozenFolder, nearestDestructiveAlert: $destructiveAlert)
151151
)
152152
}
153153
}

MailCore/Cache/Actions/ActionOrigin.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public struct ActionOrigin {
3838
public private(set) var frozenFolder: Folder?
3939

4040
private(set) var nearestMessagesActionsPanel: Binding<[Message]?>?
41-
private(set) var nearestFlushAlert: Binding<DestructiveActionAlertState?>?
41+
private(set) var nearestDestructiveAlert: Binding<DestructiveActionAlertState?>?
4242
private(set) var nearestMessagesToMoveSheet: Binding<[Message]?>?
4343
private(set) var nearestBlockSenderAlert: Binding<BlockRecipientAlertState?>?
4444
private(set) var nearestBlockSendersList: Binding<BlockRecipientState?>?
@@ -53,7 +53,7 @@ public struct ActionOrigin {
5353
type: ActionOriginType,
5454
folder: Folder? = nil,
5555
nearestMessagesActionsPanel: Binding<[Message]?>? = nil,
56-
nearestFlushAlert: Binding<DestructiveActionAlertState?>? = nil,
56+
nearestDestructiveAlert: Binding<DestructiveActionAlertState?>? = nil,
5757
nearestMessagesToMoveSheet: Binding<[Message]?>? = nil,
5858
nearestBlockSenderAlert: Binding<BlockRecipientAlertState?>? = nil,
5959
nearestBlockSendersList: Binding<BlockRecipientState?>? = nil,
@@ -67,7 +67,7 @@ public struct ActionOrigin {
6767
self.type = type
6868
frozenFolder = folder?.freezeIfNeeded()
6969
self.nearestMessagesActionsPanel = nearestMessagesActionsPanel
70-
self.nearestFlushAlert = nearestFlushAlert
70+
self.nearestDestructiveAlert = nearestDestructiveAlert
7171
self.nearestMessagesToMoveSheet = nearestMessagesToMoveSheet
7272
self.nearestBlockSenderAlert = nearestBlockSenderAlert
7373
self.nearestBlockSendersList = nearestBlockSendersList
@@ -80,13 +80,13 @@ public struct ActionOrigin {
8080
}
8181

8282
public static func toolbar(originFolder: Folder? = nil,
83-
nearestFlushAlert: Binding<DestructiveActionAlertState?>? = nil) -> ActionOrigin {
84-
return ActionOrigin(type: .toolbar, folder: originFolder, nearestFlushAlert: nearestFlushAlert)
83+
nearestDestructiveAlert: Binding<DestructiveActionAlertState?>? = nil) -> ActionOrigin {
84+
return ActionOrigin(type: .toolbar, folder: originFolder, nearestDestructiveAlert: nearestDestructiveAlert)
8585
}
8686

8787
public static func floatingPanel(source: FloatingPanelSource,
8888
originFolder: Folder? = nil,
89-
nearestFlushAlert: Binding<DestructiveActionAlertState?>? = nil,
89+
nearestDestructiveAlert: Binding<DestructiveActionAlertState?>? = nil,
9090
nearestMessagesToMoveSheet: Binding<[Message]?>? = nil,
9191
nearestBlockSenderAlert: Binding<BlockRecipientAlertState?>? = nil,
9292
nearestBlockSendersList: Binding<BlockRecipientState?>? = nil,
@@ -99,7 +99,7 @@ public struct ActionOrigin {
9999
return ActionOrigin(
100100
type: .floatingPanel(source: source),
101101
folder: originFolder,
102-
nearestFlushAlert: nearestFlushAlert,
102+
nearestDestructiveAlert: nearestDestructiveAlert,
103103
nearestMessagesToMoveSheet: nearestMessagesToMoveSheet,
104104
nearestBlockSenderAlert: nearestBlockSenderAlert,
105105
nearestBlockSendersList: nearestBlockSendersList,
@@ -113,12 +113,12 @@ public struct ActionOrigin {
113113
}
114114

115115
public static func multipleSelection(originFolder: Folder? = nil,
116-
nearestFlushAlert: Binding<DestructiveActionAlertState?>? = nil,
116+
nearestDestructiveAlert: Binding<DestructiveActionAlertState?>? = nil,
117117
nearestMessagesToMoveSheet: Binding<[Message]?>? = nil) -> ActionOrigin {
118118
return ActionOrigin(
119119
type: .multipleSelection,
120120
folder: originFolder,
121-
nearestFlushAlert: nearestFlushAlert,
121+
nearestDestructiveAlert: nearestDestructiveAlert,
122122
nearestMessagesToMoveSheet: nearestMessagesToMoveSheet
123123
)
124124
}
@@ -127,18 +127,18 @@ public struct ActionOrigin {
127127
originFolder: Folder? = nil,
128128
nearestMessagesActionsPanel: Binding<[Message]?>? = nil,
129129
nearestMessagesToMoveSheet: Binding<[Message]?>? = nil,
130-
nearestFlushAlert: Binding<DestructiveActionAlertState?>? = nil
130+
nearestDestructiveAlert: Binding<DestructiveActionAlertState?>? = nil
131131
) -> ActionOrigin {
132132
return ActionOrigin(type: .swipe,
133133
folder: originFolder,
134134
nearestMessagesActionsPanel: nearestMessagesActionsPanel,
135-
nearestFlushAlert: nearestFlushAlert,
135+
nearestDestructiveAlert: nearestDestructiveAlert,
136136
nearestMessagesToMoveSheet: nearestMessagesToMoveSheet)
137137
}
138138

139139
public static func shortcut(originFolder: Folder? = nil,
140-
nearestFlushAlert: Binding<DestructiveActionAlertState?>? = nil) -> ActionOrigin {
141-
ActionOrigin(type: .shortcut, folder: originFolder, nearestFlushAlert: nearestFlushAlert)
140+
nearestDestructiveAlert: Binding<DestructiveActionAlertState?>? = nil) -> ActionOrigin {
141+
ActionOrigin(type: .shortcut, folder: originFolder, nearestDestructiveAlert: nearestDestructiveAlert)
142142
}
143143

144144
public static func threadHeader(originFolder: Folder? = nil,

MailCore/Cache/Actions/ActionsManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public class ActionsManager: ObservableObject {
113113
case .delete:
114114
guard origin.frozenFolder?.shouldWarnBeforeDeletion != true else {
115115
Task { @MainActor in
116-
origin.nearestFlushAlert?.wrappedValue = DestructiveActionAlertState(
116+
origin.nearestDestructiveAlert?.wrappedValue = DestructiveActionAlertState(
117117
type: .delete,
118118
impactedMessages: messagesWithDuplicates.uniqueThreadsInFolder(origin.frozenFolder).count
119119
) {

0 commit comments

Comments
 (0)