mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-22 08:10:59 +00:00
Fix activity view controllers on iPad
This commit is contained in:
parent
f3107094c9
commit
c104f47ea9
3 changed files with 18 additions and 0 deletions
|
@ -152,6 +152,11 @@ extension ImageViewController {
|
||||||
if let image = imageView.image {
|
if let image = imageView.image {
|
||||||
let activityViewController = UIActivityViewController(activityItems: [image], applicationActivities: [])
|
let activityViewController = UIActivityViewController(activityItems: [image], applicationActivities: [])
|
||||||
|
|
||||||
|
if UIDevice.current.userInterfaceIdiom == .pad {
|
||||||
|
activityViewController.popoverPresentationController?
|
||||||
|
.barButtonItem = parent?.navigationItem.rightBarButtonItem
|
||||||
|
}
|
||||||
|
|
||||||
present(activityViewController, animated: true)
|
present(activityViewController, animated: true)
|
||||||
} else if let asset = playerView.player?.currentItem?.asset as? AVURLAsset {
|
} else if let asset = playerView.player?.currentItem?.asset as? AVURLAsset {
|
||||||
asset.exportWithoutAudioTrack { result in
|
asset.exportWithoutAudioTrack { result in
|
||||||
|
@ -162,6 +167,11 @@ extension ImageViewController {
|
||||||
activityItems: [url],
|
activityItems: [url],
|
||||||
applicationActivities: [])
|
applicationActivities: [])
|
||||||
|
|
||||||
|
if UIDevice.current.userInterfaceIdiom == .pad {
|
||||||
|
activityViewController.popoverPresentationController?
|
||||||
|
.barButtonItem = self.parent?.navigationItem.rightBarButtonItem
|
||||||
|
}
|
||||||
|
|
||||||
activityViewController.completionWithItemsHandler = { _, _, _, _ in
|
activityViewController.completionWithItemsHandler = { _, _, _, _ in
|
||||||
try? FileManager.default.removeItem(at: url.deletingLastPathComponent())
|
try? FileManager.default.removeItem(at: url.deletingLastPathComponent())
|
||||||
}
|
}
|
||||||
|
|
|
@ -444,6 +444,12 @@ private extension TableViewController {
|
||||||
func share(url: URL) {
|
func share(url: URL) {
|
||||||
let activityViewController = UIActivityViewController(activityItems: [url], applicationActivities: nil)
|
let activityViewController = UIActivityViewController(activityItems: [url], applicationActivities: nil)
|
||||||
|
|
||||||
|
if UIDevice.current.userInterfaceIdiom == .pad {
|
||||||
|
guard let sourceView = tableView.viewWithTag(url.hashValue) else { return }
|
||||||
|
|
||||||
|
activityViewController.popoverPresentationController?.sourceView = sourceView
|
||||||
|
}
|
||||||
|
|
||||||
present(activityViewController, animated: true, completion: nil)
|
present(activityViewController, animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -430,6 +430,8 @@ private extension StatusView {
|
||||||
|
|
||||||
favoriteButton.tintColor = favoriteColor
|
favoriteButton.tintColor = favoriteColor
|
||||||
favoriteButton.setTitleColor(favoriteColor, for: .normal)
|
favoriteButton.setTitleColor(favoriteColor, for: .normal)
|
||||||
|
|
||||||
|
shareButton.tag = viewModel.sharingURL?.hashValue ?? 0
|
||||||
}
|
}
|
||||||
// swiftlint:enable function_body_length
|
// swiftlint:enable function_body_length
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue