From 1d874dc935386e0ad355b9a0d215a2dcb6ccb2c4 Mon Sep 17 00:00:00 2001
From: BandarHelal <31299470+BandarHL@users.noreply.github.com>
Date: Thu, 5 May 2022 05:20:58 +0300
Subject: [PATCH] 2.9.5-2

- Fix iPad issues
---
 BHTwitter/BHTManager.m           | 4 ++++
 BHTwitter/BHTwitter.xm           | 3 ++-
 BHTwitter/Package/DEBIAN/control | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/BHTwitter/BHTManager.m b/BHTwitter/BHTManager.m
index 67624891..5603e8b0 100644
--- a/BHTwitter/BHTManager.m
+++ b/BHTwitter/BHTManager.m
@@ -100,6 +100,10 @@ + (void)save:(NSURL *)url {
 }
 + (void)showSaveVC:(NSURL *)url {
     UIActivityViewController *acVC = [[UIActivityViewController alloc] initWithActivityItems:@[url] applicationActivities:nil];
+    if (is_iPad()) {
+        acVC.popoverPresentationController.sourceView = topMostController().view;
+        acVC.popoverPresentationController.sourceRect = CGRectMake(topMostController().view.bounds.size.width / 2.0, topMostController().view.bounds.size.height / 2.0, 1.0, 1.0);
+    }
     [topMostController() presentViewController:acVC animated:true completion:nil];
 }
 
diff --git a/BHTwitter/BHTwitter.xm b/BHTwitter/BHTwitter.xm
index 9d50d9f7..f950bfe0 100644
--- a/BHTwitter/BHTwitter.xm
+++ b/BHTwitter/BHTwitter.xm
@@ -141,7 +141,8 @@
 %new - (void)copyButtonHandler:(UIButton *)sender {
     UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"hi" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
     if (is_iPad()) {
-        alert.popoverPresentationController.sourceRect = CGRectMake(self.view.bounds.size.width / 2.0, self.view.bounds.size.height / 2.0, 1.0, 1.0);
+        alert.popoverPresentationController.sourceView = self.view;
+        alert.popoverPresentationController.sourceRect = sender.frame;
     }
     UIAlertAction *bio = [UIAlertAction actionWithTitle:@"Copy bio" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
         UIPasteboard.generalPasteboard.string = self.viewModel.bio;
diff --git a/BHTwitter/Package/DEBIAN/control b/BHTwitter/Package/DEBIAN/control
index 6edfa5ab..2a5ee6cb 100644
--- a/BHTwitter/Package/DEBIAN/control
+++ b/BHTwitter/Package/DEBIAN/control
@@ -1,6 +1,6 @@
 Package: com.bandarhl.BHTwitter
 Name: BHTwitter
-Version: 2.9.5-1
+Version: 2.9.5-2
 Description: Awesome tweak for Twitter
 Section: Tweaks
 Depends: firmware (>= 13.0), mobilesubstrate