diff --git a/Session/DMs/NewDMVC.swift b/Session/DMs/NewDMVC.swift index e98a5b02e..0f0ce99a6 100644 --- a/Session/DMs/NewDMVC.swift +++ b/Session/DMs/NewDMVC.swift @@ -73,7 +73,7 @@ final class NewDMVC : BaseVC, UIPageViewControllerDataSource, UIPageViewControll tabBar.pin(.leading, to: .leading, of: view) let tabBarInset: CGFloat if #available(iOS 13, *) { - tabBarInset = navigationBar.height() + tabBarInset = UIDevice.current.isIPad ? navigationBar.height() + 20 : navigationBar.height() } else { tabBarInset = 0 } @@ -232,7 +232,7 @@ private final class EnterPublicKeyVC : UIViewController { // Share button let shareButton = Button(style: .unimportant, size: .medium) shareButton.setTitle(NSLocalizedString("share", comment: ""), for: UIControl.State.normal) - shareButton.addTarget(self, action: #selector(sharePublicKey), for: UIControl.Event.touchUpInside) + shareButton.addTarget(self, action: #selector(sharePublicKey(_:)), for: UIControl.Event.touchUpInside) // Button container buttonContainer.addArrangedSubview(copyButton) buttonContainer.addArrangedSubview(shareButton) @@ -330,8 +330,13 @@ private final class EnterPublicKeyVC : UIViewController { Timer.scheduledTimer(timeInterval: 4, target: self, selector: #selector(enableCopyButton), userInfo: nil, repeats: false) } - @objc private func sharePublicKey() { + @objc private func sharePublicKey(_ sender: UIButton) { let shareVC = UIActivityViewController(activityItems: [ getUserHexEncodedPublicKey() ], applicationActivities: nil) + if UIDevice.current.isIPad { + shareVC.excludedActivityTypes = [] + shareVC.popoverPresentationController?.sourceView = sender + shareVC.popoverPresentationController?.sourceRect = sender.bounds + } NewDMVC.navigationController!.present(shareVC, animated: true, completion: nil) } diff --git a/Session/Home/HomeVC.swift b/Session/Home/HomeVC.swift index 26954036e..7918f24f8 100644 --- a/Session/Home/HomeVC.swift +++ b/Session/Home/HomeVC.swift @@ -410,7 +410,9 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, NewConv @objc private func openSettings() { let settingsVC = SettingsVC() let navigationController = OWSNavigationController(rootViewController: settingsVC) - navigationController.modalPresentationStyle = .fullScreen + if UIDevice.current.isIPad { + navigationController.modalPresentationStyle = .fullScreen + } present(navigationController, animated: true, completion: nil) } @@ -425,12 +427,18 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, NewConv @objc func joinOpenGroup() { let joinOpenGroupVC = JoinOpenGroupVC() let navigationController = OWSNavigationController(rootViewController: joinOpenGroupVC) + if UIDevice.current.isIPad { + navigationController.modalPresentationStyle = .fullScreen + } present(navigationController, animated: true, completion: nil) } @objc func createNewDM() { let newDMVC = NewDMVC() let navigationController = OWSNavigationController(rootViewController: newDMVC) + if UIDevice.current.isIPad { + navigationController.modalPresentationStyle = .fullScreen + } present(navigationController, animated: true, completion: nil) } @@ -438,12 +446,18 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, NewConv func createNewDMFromDeepLink(sessionID: String) { let newDMVC = NewDMVC(sessionID: sessionID) let navigationController = OWSNavigationController(rootViewController: newDMVC) + if UIDevice.current.isIPad { + navigationController.modalPresentationStyle = .fullScreen + } present(navigationController, animated: true, completion: nil) } @objc func createClosedGroup() { let newClosedGroupVC = NewClosedGroupVC() let navigationController = OWSNavigationController(rootViewController: newClosedGroupVC) + if UIDevice.current.isIPad { + navigationController.modalPresentationStyle = .fullScreen + } present(navigationController, animated: true, completion: nil) } diff --git a/Session/Open Groups/JoinOpenGroupVC.swift b/Session/Open Groups/JoinOpenGroupVC.swift index 866513807..52f838b3d 100644 --- a/Session/Open Groups/JoinOpenGroupVC.swift +++ b/Session/Open Groups/JoinOpenGroupVC.swift @@ -61,7 +61,7 @@ final class JoinOpenGroupVC : BaseVC, UIPageViewControllerDataSource, UIPageView tabBar.pin(.leading, to: .leading, of: view) let tabBarInset: CGFloat if #available(iOS 13, *) { - tabBarInset = navigationBar.height() + tabBarInset = UIDevice.current.isIPad ? navigationBar.height() + 20 : navigationBar.height() } else { tabBarInset = 0 }