@@ -108,7 +108,7 @@ extension Action: CaseIterable {
108
108
return actions. compactMap { $0 }
109
109
}
110
110
111
- private static func snoozedActions( _ messages: [ Message ] , folder: Folder ? ) -> [ Action ] {
111
+ private static func snoozedActions( for messages: [ Message ] , from folder: Folder ? ) -> [ Action ] {
112
112
guard folder? . canAccessSnoozeActions == true else { return [ ] }
113
113
114
114
let messagesFromFolder = messages. filter { $0. folder? . remoteId == folder? . remoteId }
@@ -122,7 +122,7 @@ extension Action: CaseIterable {
122
122
}
123
123
124
124
public static func actionsForMessages( _ messages: [ Message ] ,
125
- origin: ActionOrigin ,
125
+ from origin: ActionOrigin ,
126
126
userIsStaff: Bool ,
127
127
userEmail: String ) -> Action . Lists {
128
128
guard !messages. allSatisfy ( { $0. isScheduledDraft == true } ) ,
@@ -134,13 +134,12 @@ extension Action: CaseIterable {
134
134
bottomBarActions: [ . delete]
135
135
)
136
136
}
137
- return actionsForNormalMessages ( messages, origin : origin, userIsStaff: userIsStaff, userEmail: userEmail)
137
+ return actionsForNormalMessages ( messages, from : origin, userIsStaff: userIsStaff, userEmail: userEmail)
138
138
}
139
139
140
- private static func getArchiveAction(
141
- originFolderRole: FolderRole ? ,
142
- messagesAreSnoozed: Bool
143
- ) -> Action ? {
140
+ private static func archiveAction( for originFolderRole: FolderRole ? ,
141
+
142
+ messagesAreSnoozed: Bool ) -> Action ? {
144
143
guard originFolderRole != . spam,
145
144
!messagesAreSnoozed
146
145
else {
@@ -149,23 +148,23 @@ extension Action: CaseIterable {
149
148
return originFolderRole != . archive ? . archive : . moveToInbox
150
149
}
151
150
152
- private static func getSpamAction ( originFolderRole: FolderRole ? , messagesRecipients: [ Recipient ] ,
153
- userEmail: String ) -> Action ? {
151
+ private static func spamAction ( for originFolderRole: FolderRole ? , messagesRecipients: [ Recipient ] ,
152
+ userEmail: String ) -> Action ? {
154
153
guard !messagesRecipients. allSatisfy ( { $0. isMeOrPlusMe ( currentMailboxEmail: userEmail) } ) else {
155
154
return nil
156
155
}
157
156
return originFolderRole == . spam ? . nonSpam : . reportJunk
158
157
}
159
158
160
- private static func getReportDisplayProblemAction ( userIsStaff: Bool , isMessageDetails: Bool ) -> Action ? {
159
+ private static func reportDisplayProblemAction ( userIsStaff: Bool , isMessageDetails: Bool ) -> Action ? {
161
160
guard userIsStaff, isMessageDetails else {
162
161
return nil
163
162
}
164
163
return . reportDisplayProblem
165
164
}
166
165
167
- public static func getBottomBarActions (
168
- originType: ActionOrigin . ActionOriginType ,
166
+ public static func bottomBarActions (
167
+ for originType: ActionOrigin . ActionOriginType ,
169
168
unreadAction: Action ,
170
169
archiveAction: Action ? ,
171
170
starAction: Action
@@ -181,33 +180,33 @@ extension Action: CaseIterable {
181
180
}
182
181
183
182
private static func actionsForNormalMessages( _ messages: [ Message ] ,
184
- origin: ActionOrigin ,
183
+ from origin: ActionOrigin ,
185
184
userIsStaff: Bool ,
186
185
userEmail: String )
187
186
-> Action . Lists {
188
187
@LazyInjectService var platformDetector : PlatformDetectable
189
188
190
189
let unreadAction : Action = messages. allSatisfy ( \. seen) ? . markAsUnread : . markAsRead
191
- let archiveAction = getArchiveAction (
192
- originFolderRole : origin. frozenFolder? . role,
190
+ let archiveAction = archiveAction (
191
+ for : origin. frozenFolder? . role,
193
192
messagesAreSnoozed: messages. allSatisfy ( \. isSnoozed)
194
193
)
195
194
let openMovePanelAction : Action ? = messages. allSatisfy ( \. isMovable) ? . openMovePanel : nil
196
- let spamAction = getSpamAction (
197
- originFolderRole : origin. frozenFolder? . role,
195
+ let spamAction = spamAction (
196
+ for : origin. frozenFolder? . role,
198
197
messagesRecipients: messages. flatMap ( \. from) ,
199
198
userEmail: userEmail
200
199
)
201
200
let starAction : Action = messages. contains { $0. flagged } ? . unstar : . star
202
- let reportDisplayProblemAction = getReportDisplayProblemAction (
201
+ let reportDisplayProblemAction = reportDisplayProblemAction (
203
202
userIsStaff: userIsStaff,
204
203
isMessageDetails: origin. type. isMessageDetails
205
204
)
206
205
207
206
let quickActions : [ Action ] = origin. type. isMessageDetails ? [ . reply, . replyAll, . forward, . delete] : [ ]
208
207
209
208
var listActions : [ Action ? ] = [ origin. type == . floatingPanel( source: . contextMenu) ? . activeMultiSelect : nil ] +
210
- ( !origin. type. isMessageDetails ? snoozedActions ( messages, folder : origin. frozenFolder) : [ ] ) +
209
+ ( !origin. type. isMessageDetails ? snoozedActions ( for : messages, from : origin. frozenFolder) : [ ] ) +
211
210
[ openMovePanelAction, spamAction]
212
211
213
212
if origin. type != . floatingPanel( source: . threadList) {
@@ -221,8 +220,8 @@ extension Action: CaseIterable {
221
220
]
222
221
}
223
222
224
- let bottomBarActions = getBottomBarActions (
225
- originType : origin. type,
223
+ let bottomBarActions = bottomBarActions (
224
+ for : origin. type,
226
225
unreadAction: unreadAction,
227
226
archiveAction: archiveAction,
228
227
starAction: starAction
0 commit comments