Skip to content

Commit

Permalink
Merge pull request #1258 from Infomaniak/fix-sheet-presentation
Browse files Browse the repository at this point in the history
fix: Delay DefaultDiscoveryView after ComposeView dismiss
  • Loading branch information
Ambrdctr committed Feb 5, 2024
2 parents 467eed8 + ed864fa commit 84f864e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Mail/Views/New Message/ComposeMessageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,10 @@ struct ComposeMessageView: View {
sendDraft()

if !Bundle.main.isExtension {
mainViewState.isShowingSetAppAsDefaultDiscovery = UserDefaults.shared.shouldPresentSetAsDefaultDiscovery
// We should implement a proper router to avoid doing this
DispatchQueue.main.asyncAfter(deadline: UIConstants.modalCloseDelay) {
mainViewState.isShowingSetAppAsDefaultDiscovery = UserDefaults.shared.shouldPresentSetAsDefaultDiscovery
}
if !mainViewState.isShowingSetAppAsDefaultDiscovery {
mainViewState.isShowingChristmasEasterEgg = true
}
Expand Down
2 changes: 1 addition & 1 deletion MailCore/Cache/Actions/ActionsManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public class ActionsManager: ObservableObject {
case .print:
guard let message = messages.first else { return }
// Needed to be sure that the bottomView is dismissed before we try to show the printPanel
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
DispatchQueue.main.asyncAfter(deadline: UIConstants.modalCloseDelay) {
let nc = NotificationCenter.default
nc.post(name: Notification.Name.printNotification, object: message)
}
Expand Down
4 changes: 4 additions & 0 deletions MailCore/UI/UIConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ public extension UIConstants {
public extension UIConstants {
static let checkboxAppearDelay = 0.2
static let checkboxDisappearOffsetDelay = 0.35

static var modalCloseDelay: DispatchTime {
DispatchTime.now() + 0.75
}
}

// MARK: - Utils
Expand Down

0 comments on commit 84f864e

Please sign in to comment.