summaryrefslogtreecommitdiff
path: root/src/ios.m
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2022-01-01 01:00:56 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2022-01-01 01:00:56 +0200
commitce833b32c770475a2668067df878cdd094e2a4a8 (patch)
tree6d306cc2c4713300ebe50456cf38f40549d822db /src/ios.m
parente58fa57545937f4dbfb52b4966623481f733c74f (diff)
iOS: Showing activity views on iPad
On iPad, activity views are popovers and require information about the source. The UI doesn't provide this, though, so just use the long-press tap position for now.
Diffstat (limited to 'src/ios.m')
-rw-r--r--src/ios.m14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/ios.m b/src/ios.m
index 69e09419..82596ffd 100644
--- a/src/ios.m
+++ b/src/ios.m
@@ -25,6 +25,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
25#include "audio/player.h" 25#include "audio/player.h"
26#include "ui/command.h" 26#include "ui/command.h"
27#include "ui/window.h" 27#include "ui/window.h"
28#include "ui/touch.h"
28 29
29#include <the_Foundation/file.h> 30#include <the_Foundation/file.h>
30#include <the_Foundation/fileinfo.h> 31#include <the_Foundation/fileinfo.h>
@@ -541,7 +542,18 @@ static void openActivityView_(NSArray *activityItems) {
541 [[UIActivityViewController alloc] 542 [[UIActivityViewController alloc]
542 initWithActivityItems:activityItems 543 initWithActivityItems:activityItems
543 applicationActivities:nil]; 544 applicationActivities:nil];
544 [viewController_(get_Window()) presentViewController:actView animated:YES completion:nil]; 545 iWindow *win = get_Window();
546 UIViewController *viewCtl = viewController_(win);
547 UIPopoverPresentationController *popover = [actView popoverPresentationController];
548 if (popover) {
549 [popover setSourceView:[viewCtl view]];
550 iInt2 tapPos = latestTapPosition_Touch();
551 tapPos.x /= win->pixelRatio;
552 tapPos.y /= win->pixelRatio;
553 [popover setSourceRect:(CGRect){{tapPos.x - 10, tapPos.y - 10}, {20, 20}}];
554 [popover setCanOverlapSourceViewRect:YES];
555 }
556 [viewCtl presentViewController:actView animated:YES completion:nil];
545} 557}
546 558
547void openTextActivityView_iOS(const iString *text) { 559void openTextActivityView_iOS(const iString *text) {