Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Back after mark as unread on iPhone #962

Merged
merged 1 commit into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Mail/Components/ActionsPanelButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import MailResources
import SwiftUI

struct ActionsPanelButton<Content: View>: View {
@Environment(\.dismiss) private var dismiss

@State private var actionMessages: [Message]?

let messages: [Message]
Expand All @@ -34,6 +36,10 @@ struct ActionsPanelButton<Content: View>: View {
} label: {
label()
}
.actionsPanel(messages: $actionMessages, originFolder: originFolder)
.actionsPanel(messages: $actionMessages, originFolder: originFolder) { action in
if action == .markAsUnread {
dismiss()
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import SwiftUI

extension View {
func actionsPanel(messages: Binding<[Message]?>, originFolder: Folder?,
completionHandler: (() -> Void)? = nil) -> some View {
completionHandler: ((Action) -> Void)? = nil) -> some View {
return modifier(ActionsPanelViewModifier(
messages: messages,
originFolder: originFolder,
Expand All @@ -42,7 +42,7 @@ struct ActionsPanelViewModifier: ViewModifier {
@Binding var messages: [Message]?
let originFolder: Folder?

var completionHandler: (() -> Void)?
var completionHandler: ((Action) -> Void)?

private var origin: ActionOrigin {
.floatingPanel(
Expand Down
12 changes: 6 additions & 6 deletions Mail/Views/Bottom sheets/Actions/ActionsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ struct ActionsView: View {
private let quickActions: [Action]
private let listActions: [Action]
private let origin: ActionOrigin
private let completionHandler: (() -> Void)?
private let completionHandler: ((Action) -> Void)?

init(mailboxManager: MailboxManager,
target messages: [Message],
origin: ActionOrigin,
completionHandler: (() -> Void)? = nil) {
completionHandler: ((Action) -> Void)? = nil) {
let userIsStaff = mailboxManager.account.user.isStaff ?? false
let actions = Action.actionsForMessages(messages, originFolder: origin.folder, userIsStaff: userIsStaff)
quickActions = actions.quickActions
Expand Down Expand Up @@ -98,7 +98,7 @@ struct QuickActionView: View {
let targetMessages: [Message]
let action: Action
let origin: ActionOrigin
var completionHandler: (() -> Void)?
var completionHandler: ((Action) -> Void)?

var body: some View {
Button {
Expand All @@ -110,7 +110,7 @@ struct QuickActionView: View {
action: action,
origin: origin
)
completionHandler?()
completionHandler?(action)
}
}
} label: {
Expand Down Expand Up @@ -143,7 +143,7 @@ struct MessageActionView: View {
let targetMessages: [Message]
let action: Action
let origin: ActionOrigin
var completionHandler: (() -> Void)?
var completionHandler: ((Action) -> Void)?

var body: some View {
Button {
Expand All @@ -155,7 +155,7 @@ struct MessageActionView: View {
action: action,
origin: origin
)
completionHandler?()
completionHandler?(action)
}
}
} label: {
Expand Down
2 changes: 1 addition & 1 deletion Mail/Views/Thread List/ThreadListModifiers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ struct ThreadListToolbar: ViewModifier {
}
.disabled(multipleSelectionViewModel.selectedItems.isEmpty)
}
.actionsPanel(messages: $multipleSelectedMessages, originFolder: viewModel.folder) {
.actionsPanel(messages: $multipleSelectedMessages, originFolder: viewModel.folder) { _ in
multipleSelectionViewModel.isEnabled = false
}
.navigationTitle(
Expand Down
Loading