Skip to content

Commit

Permalink
[app] Fix ActivityView being presented twice
Browse files Browse the repository at this point in the history
  • Loading branch information
kirb committed Mar 22, 2022
1 parent 2094bf4 commit 7d354d9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions App/UI/SwiftUI Helpers/ActivityView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ActivityWrapperViewController: UIViewController {
}

func update() {
if isPresented && activityViewController?.isBeingPresented != true {
if isPresented && activityViewController == nil {
// We have to create a new instance every time, otherwise the completion never gets called for
// subsequent presentations on macOS…
activityViewController = UIActivityViewController(activityItems: activityItems, applicationActivities: nil)
Expand All @@ -43,8 +43,9 @@ class ActivityWrapperViewController: UIViewController {
self.completion()
}
present(activityViewController!, animated: true, completion: nil)
} else if !isPresented && activityViewController?.isBeingPresented == true {
} else if !isPresented && activityViewController != nil {
activityViewController?.dismiss(animated: true, completion: nil)
activityViewController = nil
}
}

Expand Down

0 comments on commit 7d354d9

Please sign in to comment.