From 85a19da487821aa1fe770900634a3a06b74ec851 Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Wed, 7 Nov 2018 19:43:36 +0530 Subject: [PATCH] iPad: Ensure we set sourceRect for all cases where we use sourceView Signed-off-by: Roopesh Chander --- WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift | 2 +- .../WireGuard/UI/iOS/TunnelDetailTableViewController.swift | 1 + WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift b/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift index 5374b40..fac2005 100644 --- a/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift @@ -99,8 +99,8 @@ class SettingsTableViewController: UITableViewController { let activityVC = UIActivityViewController(activityItems: [destinationURL], applicationActivities: nil) // popoverPresentationController shall be non-nil on the iPad activityVC.popoverPresentationController?.sourceView = sourceView + activityVC.popoverPresentationController?.sourceRect = sourceView.bounds present(activityVC, animated: true) - } catch (let error) { showErrorAlert(title: "Unable to export", message: "There was an error exporting the tunnel configuration archive: \(String(describing: error))") } diff --git a/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift index 9bd9f5a..3e30662 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift @@ -72,6 +72,7 @@ class TunnelDetailTableViewController: UITableViewController { // popoverPresentationController will be nil on iPhone and non-nil on iPad alert.popoverPresentationController?.sourceView = sourceView + alert.popoverPresentationController?.sourceRect = sourceView.bounds self.present(alert, animated: true, completion: nil) } diff --git a/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift index 40d86e9..3af97da 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift @@ -400,6 +400,7 @@ extension TunnelEditTableViewController { // popoverPresentationController will be nil on iPhone and non-nil on iPad alert.popoverPresentationController?.sourceView = sourceView + alert.popoverPresentationController?.sourceRect = sourceView.bounds self.present(alert, animated: true, completion: nil) }