summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-12-29 19:43:48 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-12-29 19:43:48 +0200
commitc5f9a431f3b42c3a34578f5406b5e39a9eec9cd0 (patch)
treefc84f1605ca9502d86ba3a33be7c4015875ef433
parente8f06bd0985ce2c9ac5ef02525672a426d559d18 (diff)
iOS: Sharing file content and selected text
-rw-r--r--po/en.po3
-rw-r--r--res/lang/cs.binbin31582 -> 31599 bytes
-rw-r--r--res/lang/de.binbin30589 -> 30606 bytes
-rw-r--r--res/lang/en.binbin26675 -> 26692 bytes
-rw-r--r--res/lang/eo.binbin25639 -> 25656 bytes
-rw-r--r--res/lang/es.binbin30413 -> 30430 bytes
-rw-r--r--res/lang/es_MX.binbin27745 -> 27762 bytes
-rw-r--r--res/lang/fi.binbin30246 -> 30263 bytes
-rw-r--r--res/lang/fr.binbin31393 -> 31410 bytes
-rw-r--r--res/lang/gl.binbin29598 -> 29615 bytes
-rw-r--r--res/lang/hu.binbin31418 -> 31435 bytes
-rw-r--r--res/lang/ia.binbin28745 -> 28762 bytes
-rw-r--r--res/lang/ie.binbin29333 -> 29350 bytes
-rw-r--r--res/lang/isv.binbin25396 -> 25413 bytes
-rw-r--r--res/lang/pl.binbin30021 -> 30038 bytes
-rw-r--r--res/lang/ru.binbin44781 -> 44798 bytes
-rw-r--r--res/lang/sk.binbin25732 -> 25749 bytes
-rw-r--r--res/lang/sr.binbin44207 -> 44224 bytes
-rw-r--r--res/lang/tok.binbin27455 -> 27472 bytes
-rw-r--r--res/lang/tr.binbin29639 -> 29656 bytes
-rw-r--r--res/lang/uk.binbin44126 -> 44143 bytes
-rw-r--r--res/lang/zh_Hans.binbin25640 -> 25657 bytes
-rw-r--r--res/lang/zh_Hant.binbin25838 -> 25855 bytes
-rw-r--r--src/app.c28
-rw-r--r--src/gmrequest.c2
-rw-r--r--src/ios.h1
-rw-r--r--src/ios.m15
-rw-r--r--src/ui/documentwidget.c12
-rw-r--r--src/ui/mediaui.c6
29 files changed, 54 insertions, 13 deletions
diff --git a/po/en.po b/po/en.po
index 49f78eb8..425243cc 100644
--- a/po/en.po
+++ b/po/en.po
@@ -858,6 +858,9 @@ msgstr "Download Linked File"
858msgid "menu.reveal.macos" 858msgid "menu.reveal.macos"
859msgstr "Show in Finder" 859msgstr "Show in Finder"
860 860
861msgid "menu.share"
862msgstr "Share"
863
861msgid "link.file.delete" 864msgid "link.file.delete"
862msgstr "Delete File" 865msgstr "Delete File"
863 866
diff --git a/res/lang/cs.bin b/res/lang/cs.bin
index 1c30a0a9..47a5496f 100644
--- a/res/lang/cs.bin
+++ b/res/lang/cs.bin
Binary files differ
diff --git a/res/lang/de.bin b/res/lang/de.bin
index bf05a72e..b0967918 100644
--- a/res/lang/de.bin
+++ b/res/lang/de.bin
Binary files differ
diff --git a/res/lang/en.bin b/res/lang/en.bin
index bd858ade..a918af83 100644
--- a/res/lang/en.bin
+++ b/res/lang/en.bin
Binary files differ
diff --git a/res/lang/eo.bin b/res/lang/eo.bin
index cc829562..5f5a056a 100644
--- a/res/lang/eo.bin
+++ b/res/lang/eo.bin
Binary files differ
diff --git a/res/lang/es.bin b/res/lang/es.bin
index f62291f1..91c1a9e6 100644
--- a/res/lang/es.bin
+++ b/res/lang/es.bin
Binary files differ
diff --git a/res/lang/es_MX.bin b/res/lang/es_MX.bin
index f6f88d6c..baf7e294 100644
--- a/res/lang/es_MX.bin
+++ b/res/lang/es_MX.bin
Binary files differ
diff --git a/res/lang/fi.bin b/res/lang/fi.bin
index e69245be..67ed5398 100644
--- a/res/lang/fi.bin
+++ b/res/lang/fi.bin
Binary files differ
diff --git a/res/lang/fr.bin b/res/lang/fr.bin
index 7be665e5..b4ecf798 100644
--- a/res/lang/fr.bin
+++ b/res/lang/fr.bin
Binary files differ
diff --git a/res/lang/gl.bin b/res/lang/gl.bin
index 8c1fdf24..005feca3 100644
--- a/res/lang/gl.bin
+++ b/res/lang/gl.bin
Binary files differ
diff --git a/res/lang/hu.bin b/res/lang/hu.bin
index b06c8676..4f9b6d8b 100644
--- a/res/lang/hu.bin
+++ b/res/lang/hu.bin
Binary files differ
diff --git a/res/lang/ia.bin b/res/lang/ia.bin
index 4c3b403d..d29bcee8 100644
--- a/res/lang/ia.bin
+++ b/res/lang/ia.bin
Binary files differ
diff --git a/res/lang/ie.bin b/res/lang/ie.bin
index 5e431c29..b648a56c 100644
--- a/res/lang/ie.bin
+++ b/res/lang/ie.bin
Binary files differ
diff --git a/res/lang/isv.bin b/res/lang/isv.bin
index 54cc6774..32b2cb39 100644
--- a/res/lang/isv.bin
+++ b/res/lang/isv.bin
Binary files differ
diff --git a/res/lang/pl.bin b/res/lang/pl.bin
index cf6a6b23..20fa1621 100644
--- a/res/lang/pl.bin
+++ b/res/lang/pl.bin
Binary files differ
diff --git a/res/lang/ru.bin b/res/lang/ru.bin
index 87c82a7d..6c2be568 100644
--- a/res/lang/ru.bin
+++ b/res/lang/ru.bin
Binary files differ
diff --git a/res/lang/sk.bin b/res/lang/sk.bin
index 3ac6e18c..0604ebab 100644
--- a/res/lang/sk.bin
+++ b/res/lang/sk.bin
Binary files differ
diff --git a/res/lang/sr.bin b/res/lang/sr.bin
index 5c66460d..38b56ffa 100644
--- a/res/lang/sr.bin
+++ b/res/lang/sr.bin
Binary files differ
diff --git a/res/lang/tok.bin b/res/lang/tok.bin
index 19b6d9df..c8097f29 100644
--- a/res/lang/tok.bin
+++ b/res/lang/tok.bin
Binary files differ
diff --git a/res/lang/tr.bin b/res/lang/tr.bin
index 9a8babc9..587774cc 100644
--- a/res/lang/tr.bin
+++ b/res/lang/tr.bin
Binary files differ
diff --git a/res/lang/uk.bin b/res/lang/uk.bin
index ebcb11be..18707608 100644
--- a/res/lang/uk.bin
+++ b/res/lang/uk.bin
Binary files differ
diff --git a/res/lang/zh_Hans.bin b/res/lang/zh_Hans.bin
index ab4b338a..39024cdc 100644
--- a/res/lang/zh_Hans.bin
+++ b/res/lang/zh_Hans.bin
Binary files differ
diff --git a/res/lang/zh_Hant.bin b/res/lang/zh_Hant.bin
index f166156f..59c4dcea 100644
--- a/res/lang/zh_Hant.bin
+++ b/res/lang/zh_Hant.bin
Binary files differ
diff --git a/src/app.c b/src/app.c
index e5f9a41c..bdc3a733 100644
--- a/src/app.c
+++ b/src/app.c
@@ -3364,25 +3364,32 @@ void openInDefaultBrowser_App(const iString *url) {
3364 return; 3364 return;
3365 } 3365 }
3366#endif 3366#endif
3367#if !defined (iPlatformAppleMobile) 3367#if defined (iPlatformAppleMobile)
3368 if (equalCase_Rangecc(urlScheme_String(url), "file")) {
3369 revealPath_App(collect_String(localFilePathFromUrl_String(url)));
3370 }
3371 return;
3372#endif
3368 iProcess *proc = new_Process(); 3373 iProcess *proc = new_Process();
3369 setArguments_Process(proc, 3374 setArguments_Process(proc, iClob(newStringsCStr_StringList(
3370#if defined (iPlatformAppleDesktop) 3375#if defined (iPlatformAppleDesktop)
3371 iClob(newStringsCStr_StringList("/usr/bin/env", "open", cstr_String(url), NULL)) 3376 "/usr/bin/env",
3377 "open",
3378 cstr_String(url),
3372#elif defined (iPlatformLinux) || defined (iPlatformOther) || defined (iPlatformHaiku) 3379#elif defined (iPlatformLinux) || defined (iPlatformOther) || defined (iPlatformHaiku)
3373 iClob(newStringsCStr_StringList("/usr/bin/env", "xdg-open", cstr_String(url), NULL)) 3380 "/usr/bin/env",
3381 "xdg-open",
3382 cstr_String(url),
3374#elif defined (iPlatformMsys) 3383#elif defined (iPlatformMsys)
3375 iClob(newStringsCStr_StringList( 3384 concatPath_CStr(cstr_String(execPath_App()), "../urlopen.bat"),
3376 concatPath_CStr(cstr_String(execPath_App()), "../urlopen.bat"), 3385 cstr_String(url),
3377 cstr_String(url),
3378 NULL))
3379 /* TODO: The prompt window is shown momentarily... */ 3386 /* TODO: The prompt window is shown momentarily... */
3380#endif 3387#endif
3388 NULL))
3381 ); 3389 );
3382 start_Process(proc); 3390 start_Process(proc);
3383 waitForFinished_Process(proc); /* TODO: test on Windows */ 3391 waitForFinished_Process(proc); /* TODO: test on Windows */
3384 iRelease(proc); 3392 iRelease(proc);
3385#endif
3386} 3393}
3387 3394
3388void revealPath_App(const iString *path) { 3395void revealPath_App(const iString *path) {
@@ -3392,6 +3399,9 @@ void revealPath_App(const iString *path) {
3392 proc, iClob(newStringsCStr_StringList("/usr/bin/open", "-R", cstr_String(path), NULL))); 3399 proc, iClob(newStringsCStr_StringList("/usr/bin/open", "-R", cstr_String(path), NULL)));
3393 start_Process(proc); 3400 start_Process(proc);
3394 iRelease(proc); 3401 iRelease(proc);
3402#elif defined (iPlatformAppleMobile)
3403 /* Use a share sheet. */
3404 openFileActivityView_iOS(path);
3395#elif defined (iPlatformLinux) || defined (iPlatformHaiku) 3405#elif defined (iPlatformLinux) || defined (iPlatformHaiku)
3396 iFileInfo *inf = iClob(new_FileInfo(path)); 3406 iFileInfo *inf = iClob(new_FileInfo(path));
3397 iRangecc target; 3407 iRangecc target;
diff --git a/src/gmrequest.c b/src/gmrequest.c
index c23e8499..3d5a4aef 100644
--- a/src/gmrequest.c
+++ b/src/gmrequest.c
@@ -694,9 +694,11 @@ void submit_GmRequest(iGmRequest *d) {
694 setCStr_String(&resp->meta, "text/gemini"); 694 setCStr_String(&resp->meta, "text/gemini");
695 iString *page = collectNew_String(); 695 iString *page = collectNew_String();
696 iString *parentDir = collectNewRange_String(dirName_Path(path)); 696 iString *parentDir = collectNewRange_String(dirName_Path(path));
697#if !defined (iPlatformMobile)
697 appendFormat_String(page, "=> %s " upArrow_Icon " %s" iPathSeparator "\n\n", 698 appendFormat_String(page, "=> %s " upArrow_Icon " %s" iPathSeparator "\n\n",
698 cstrCollect_String(makeFileUrl_String(parentDir)), 699 cstrCollect_String(makeFileUrl_String(parentDir)),
699 cstr_String(parentDir)); 700 cstr_String(parentDir));
701#endif
700 appendFormat_String(page, "# %s\n", cstr_Rangecc(baseName_Path(path))); 702 appendFormat_String(page, "# %s\n", cstr_Rangecc(baseName_Path(path)));
701 /* Make a directory index page. */ 703 /* Make a directory index page. */
702 iPtrArray *sortedInfo = collectNew_PtrArray(); 704 iPtrArray *sortedInfo = collectNew_PtrArray();
diff --git a/src/ios.h b/src/ios.h
index bf742f1f..9860f7a2 100644
--- a/src/ios.h
+++ b/src/ios.h
@@ -39,6 +39,7 @@ void exportDownloadedFile_iOS(const iString *path);
39void pickFileForOpening_iOS (void); 39void pickFileForOpening_iOS (void);
40void pickFile_iOS (const char *command); /* ` path:%s` will be appended */ 40void pickFile_iOS (const char *command); /* ` path:%s` will be appended */
41void openTextActivityView_iOS(const iString *text); 41void openTextActivityView_iOS(const iString *text);
42void openFileActivityView_iOS(const iString *path);
42 43
43iBool isPhone_iOS (void); 44iBool isPhone_iOS (void);
44void safeAreaInsets_iOS (float *left, float *top, float *right, float *bottom); 45void safeAreaInsets_iOS (float *left, float *top, float *right, float *bottom);
diff --git a/src/ios.m b/src/ios.m
index c9e843e4..69e09419 100644
--- a/src/ios.m
+++ b/src/ios.m
@@ -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
539void openTextActivityView_iOS(const iString *text) { 539static 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
547void openTextActivityView_iOS(const iString *text) {
548 openActivityView_(@[[NSString stringWithUTF8String:cstr_String(text)]]);
549}
550
551void 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
550enum iAVFAudioPlayerState { 559enum iAVFAudioPlayerState {
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 9e5e6ea3..65de157b 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -3945,7 +3945,14 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)
3945 /* Full document. */ 3945 /* Full document. */
3946 copied = copy_String(source_GmDocument(d->view.doc)); 3946 copied = copy_String(source_GmDocument(d->view.doc));
3947 } 3947 }
3948 SDL_SetClipboardText(cstr_String(copied)); 3948 if (argLabel_Command(cmd, "share")) {
3949#if defined (iPlatformAppleMobile)
3950 openTextActivityView_iOS(copied);
3951#endif
3952 }
3953 else {
3954 SDL_SetClipboardText(cstr_String(copied));
3955 }
3949 delete_String(copied); 3956 delete_String(copied);
3950 if (flags_Widget(w) & touchDrag_WidgetFlag) { 3957 if (flags_Widget(w) & touchDrag_WidgetFlag) {
3951 postCommand_Widget(w, "document.select arg:0"); 3958 postCommand_Widget(w, "document.select arg:0");
@@ -5227,6 +5234,9 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e
5227 } 5234 }
5228 d->copyMenu = makeMenu_Widget(w, (iMenuItem[]){ 5235 d->copyMenu = makeMenu_Widget(w, (iMenuItem[]){
5229 { clipCopy_Icon " ${menu.copy}", 0, 0, "copy" }, 5236 { clipCopy_Icon " ${menu.copy}", 0, 0, "copy" },
5237#if defined (iPlatformAppleMobile)
5238 { export_Icon " ${menu.share}", 0, 0, "copy share:1" },
5239#endif
5230 { "---" }, 5240 { "---" },
5231 { close_Icon " ${menu.select.clear}", 0, 0, "document.select arg:0" }, 5241 { close_Icon " ${menu.select.clear}", 0, 0, "document.select arg:0" },
5232 }, 3); 5242 }, 3);
diff --git a/src/ui/mediaui.c b/src/ui/mediaui.c
index 2aec568f..ab88c94a 100644
--- a/src/ui/mediaui.c
+++ b/src/ui/mediaui.c
@@ -263,6 +263,12 @@ iBool processEvent_DownloadUI(iDownloadUI *d, const SDL_Event *ev) {
263 0, 263 0,
264 format_CStr("!reveal path:%s", cstr_String(path)) }, 264 format_CStr("!reveal path:%s", cstr_String(path)) },
265#endif 265#endif
266#if defined (iPlatformAppleMobile)
267 { export_Icon " ${menu.share}",
268 0,
269 0,
270 format_CStr("!reveal path:%s", cstr_String(path)) },
271#endif
266 { "---" }, 272 { "---" },
267 /* Generic items */ 273 /* Generic items */
268 { "${menu.downloads}", 0, 0, "downloads.open newtab:1" }, 274 { "${menu.downloads}", 0, 0, "downloads.open newtab:1" },