diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-12-29 19:43:48 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-12-29 19:43:48 +0200 |
commit | c5f9a431f3b42c3a34578f5406b5e39a9eec9cd0 (patch) | |
tree | fc84f1605ca9502d86ba3a33be7c4015875ef433 /src/ios.m | |
parent | e8f06bd0985ce2c9ac5ef02525672a426d559d18 (diff) |
iOS: Sharing file content and selected text
Diffstat (limited to 'src/ios.m')
-rw-r--r-- | src/ios.m | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -536,15 +536,24 @@ void pickFile_iOS(const char *command) { | |||
536 | [viewController_(get_Window()) presentViewController:picker animated:YES completion:nil]; | 536 | [viewController_(get_Window()) presentViewController:picker animated:YES completion:nil]; |
537 | } | 537 | } |
538 | 538 | ||
539 | void openTextActivityView_iOS(const iString *text) { | 539 | static void openActivityView_(NSArray *activityItems) { |
540 | UIActivityViewController *actView = | 540 | UIActivityViewController *actView = |
541 | [[UIActivityViewController alloc] | 541 | [[UIActivityViewController alloc] |
542 | initWithActivityItems:@[ | 542 | initWithActivityItems:activityItems |
543 | [NSString stringWithUTF8String:cstr_String(text)]] | ||
544 | applicationActivities:nil]; | 543 | applicationActivities:nil]; |
545 | [viewController_(get_Window()) presentViewController:actView animated:YES completion:nil]; | 544 | [viewController_(get_Window()) presentViewController:actView animated:YES completion:nil]; |
546 | } | 545 | } |
547 | 546 | ||
547 | void openTextActivityView_iOS(const iString *text) { | ||
548 | openActivityView_(@[[NSString stringWithUTF8String:cstr_String(text)]]); | ||
549 | } | ||
550 | |||
551 | void openFileActivityView_iOS(const iString *path) { | ||
552 | NSURL *url = [NSURL fileURLWithPath:[[NSString alloc] initWithCString:cstr_String(path) | ||
553 | encoding:NSUTF8StringEncoding]]; | ||
554 | openActivityView_(@[url]); | ||
555 | } | ||
556 | |||
548 | /*----------------------------------------------------------------------------------------------*/ | 557 | /*----------------------------------------------------------------------------------------------*/ |
549 | 558 | ||
550 | enum iAVFAudioPlayerState { | 559 | enum iAVFAudioPlayerState { |