Skip to content

Commit

Permalink
feat: Display ActivityView()
Browse files Browse the repository at this point in the history
  • Loading branch information
Lnamw committed Jul 11, 2024
1 parent 156dc68 commit a3bfdc3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
15 changes: 14 additions & 1 deletion Mail/Views/Bottom sheets/Actions/ActionsPanelViewModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct ActionsPanelViewModifier: ViewModifier {
@ModalState private var reportedForPhishingMessage: Message?
@ModalState private var messagesToMove: [Message]?
@ModalState private var flushAlert: FlushAlertState?
@ModalState private var shareMailLink: ShareMailLinkResult?

@Binding var messages: [Message]?
let originFolder: Folder?
Expand All @@ -60,7 +61,8 @@ struct ActionsPanelViewModifier: ViewModifier {
nearestMessagesToMoveSheet: $messagesToMove,
nearestReportJunkMessageActionsPanel: $reportForJunkMessage,
nearestReportedForPhishingMessageAlert: $reportedForPhishingMessage,
nearestReportedForDisplayProblemMessageAlert: $reportedForDisplayProblemMessage
nearestReportedForDisplayProblemMessageAlert: $reportedForDisplayProblemMessage,
nearestShareMailLinkPanel: $shareMailLink
)
}

Expand Down Expand Up @@ -89,5 +91,16 @@ struct ActionsPanelViewModifier: ViewModifier {
.customAlert(item: $flushAlert) { item in
FlushFolderAlertView(flushAlert: item, folder: originFolder)
}
.sheet(item: $shareMailLink) { shareMailLinkResult in
if #available(iOS 16.0, *) {
ActivityView(activityItems: [shareMailLinkResult.url])
.ignoresSafeArea(edges: [.bottom])
.presentationDetents([.medium, .large])
} else {
ActivityView(activityItems: [shareMailLinkResult.url])
.ignoresSafeArea(edges: [.bottom])
.backport.presentationDetents([.medium, .large])
}
}
}
}
11 changes: 8 additions & 3 deletions MailCore/Cache/Actions/ActionOrigin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public struct ActionOrigin {
private(set) var nearestReportJunkMessageActionsPanel: Binding<Message?>?
private(set) var nearestReportedForPhishingMessageAlert: Binding<Message?>?
private(set) var nearestReportedForDisplayProblemMessageAlert: Binding<Message?>?
private(set) var nearestShareMailLinkPanel: Binding<ShareMailLinkResult?>?

init(
type: ActionOriginType,
Expand All @@ -51,7 +52,8 @@ public struct ActionOrigin {
nearestMessagesToMoveSheet: Binding<[Message]?>? = nil,
nearestReportJunkMessageActionsPanel: Binding<Message?>? = nil,
nearestReportedForPhishingMessageAlert: Binding<Message?>? = nil,
nearestReportedForDisplayProblemMessageAlert: Binding<Message?>? = nil
nearestReportedForDisplayProblemMessageAlert: Binding<Message?>? = nil,
nearestShareMailLinkPanel: Binding<ShareMailLinkResult?>? = nil
) {
self.type = type
frozenFolder = folder?.freezeIfNeeded()
Expand All @@ -61,6 +63,7 @@ public struct ActionOrigin {
self.nearestReportJunkMessageActionsPanel = nearestReportJunkMessageActionsPanel
self.nearestReportedForPhishingMessageAlert = nearestReportedForPhishingMessageAlert
self.nearestReportedForDisplayProblemMessageAlert = nearestReportedForDisplayProblemMessageAlert
self.nearestShareMailLinkPanel = nearestShareMailLinkPanel
}

public static func toolbar(originFolder: Folder? = nil,
Expand All @@ -74,15 +77,17 @@ public struct ActionOrigin {
nearestMessagesToMoveSheet: Binding<[Message]?>? = nil,
nearestReportJunkMessageActionsPanel: Binding<Message?>? = nil,
nearestReportedForPhishingMessageAlert: Binding<Message?>? = nil,
nearestReportedForDisplayProblemMessageAlert: Binding<Message?>? = nil) -> ActionOrigin {
nearestReportedForDisplayProblemMessageAlert: Binding<Message?>? = nil,
nearestShareMailLinkPanel: Binding<ShareMailLinkResult?>? = nil) -> ActionOrigin {
return ActionOrigin(
type: .floatingPanel(source: source),
folder: originFolder,
nearestFlushAlert: nearestFlushAlert,
nearestMessagesToMoveSheet: nearestMessagesToMoveSheet,
nearestReportJunkMessageActionsPanel: nearestReportJunkMessageActionsPanel,
nearestReportedForPhishingMessageAlert: nearestReportedForPhishingMessageAlert,
nearestReportedForDisplayProblemMessageAlert: nearestReportedForDisplayProblemMessageAlert
nearestReportedForDisplayProblemMessageAlert: nearestReportedForDisplayProblemMessageAlert,
nearestShareMailLinkPanel: nearestShareMailLinkPanel
)
}

Expand Down

0 comments on commit a3bfdc3

Please sign in to comment.