Skip to content

Commit 728100b

Browse files
committed
Ensure mobileComposeMail attachment is not lost when Gmail is used
1 parent 9cd7b4a commit 728100b

File tree

6 files changed

+43
-3
lines changed

6 files changed

+43
-3
lines changed

Installer/package.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ component Runtime.Android
609609
file android:livecode_inputcontrol.xml
610610
file android:notify_icon.png
611611
file android:nfc_tech_filter.xml
612+
file android:file_provider_paths.xml
612613
executable android:Standalone[[BaseEditionTagUpper]] as Standalone
613614
executable android:RevZip
614615
executable android:RevXml

engine/engine.gyp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,25 @@
423423
'cp', '<@(_inputs)', '<@(_outputs)',
424424
],
425425
},
426+
{
427+
'action_name': 'copy_file_provider_paths',
428+
'message': 'Copying file provider paths file',
429+
430+
'inputs':
431+
[
432+
'rsrc/android-file_provider_paths.xml',
433+
],
434+
435+
'outputs':
436+
[
437+
'<(PRODUCT_DIR)/file_provider_paths.xml',
438+
],
439+
440+
'action':
441+
[
442+
'cp', '<@(_inputs)', '<@(_outputs)',
443+
],
444+
},
426445
],
427446

428447
'all_dependent_settings':
@@ -435,6 +454,7 @@
435454
'<(PRODUCT_DIR)/livecode_inputcontrol.xml',
436455
'<(PRODUCT_DIR)/notify_icon.png',
437456
'<(PRODUCT_DIR)/nfc_tech_filter.xml',
457+
'<(PRODUCT_DIR)/file_provider_paths.xml',
438458
],
439459
},
440460
},
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<paths xmlns:android="http://schemas.android.com/apk/res/android">
3+
<external-path name="share" path="/" />
4+
</paths>

engine/src/java/com/runrev/android/Email.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public boolean addAttachment(Context p_context, byte[] data, String mime_type, S
126126

127127
Uri t_uri;
128128
t_uri = FileProvider.getProvider(p_context).addPath(name, t_tempfile.getPath(), mime_type, true, ParcelFileDescriptor.MODE_READ_ONLY);
129-
129+
130130
return addAttachment(t_uri, mime_type, name);
131131
}
132132
catch (Exception e)

engine/src/java/com/runrev/android/FileProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private FileProvider(android.content.Context p_context)
5353
{
5454
m_infos = new HashMap<String, HashMap<String, String> >();
5555
m_context = p_context;
56-
m_content_uri_base = "content://" + p_context.getPackageName() + ".fileprovider";
56+
m_content_uri_base = "content://" + p_context.getPackageName() + ".fileprovider/share";
5757
}
5858

5959
private static FileProvider s_provider = null;

ide-support/revsaveasandroidstandalone.livecodescript

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,14 +523,17 @@ private command revSaveAsMobileStandaloneMain pStack, pApkFile, pTarget, pSettin
523523
end if
524524
replace "${PUSH_PERMISSIONS}" with tPushPermissions in tManifest
525525
replace "${PUSH_RECEIVER}" with tPushReceiver in tManifest
526-
527526
// Add the file provider to the manifest
528527
local tProvider
529528
put "<provider " & return into tProvider
530529
put " android:name=" & quote & pSettings["android,identifier"] & ".AppProvider" & quote & return after tProvider
531530
put " android:authorities=" & quote & pSettings["android,identifier"] & ".fileprovider" & quote & return after tProvider
532531
put " android:exported=" & quote & "true" & quote & return after tProvider
533532
put " android:grantUriPermissions=" & quote & "true" & quote & " >" & return after tProvider
533+
// Add meta-data tag
534+
put " <meta-data" & return after tProvider
535+
put " android:name=" & quote & "android.support.FILE_PROVIDER_PATHS" & quote & return after tProvider
536+
put " android:resource=" & quote & "@xml/file_provider_paths" & quote & " />" & return after tProvider
534537
put " </provider>" & return after tProvider
535538

536539
replace "${PROVIDER}" with tProvider in tManifest
@@ -738,6 +741,15 @@ private command revSaveAsMobileStandaloneMain pStack, pApkFile, pTarget, pSettin
738741
end if
739742
put tXMLResBuildFolder & slash & "nfc_tech_filter.xml" & return after tAssetFiles
740743

744+
745+
local tFileProviderPaths
746+
put mapFilePath(revMobileRuntimeFolder(pTarget) & slash & "file_provider_paths.xml") into tFileProviderPaths
747+
put url ("binfile:" & tFileProviderPaths) into url ("binfile:" & tXMLResBuildFolder & slash & "file_provider_paths.xml")
748+
if the result is not empty then
749+
throw "could not copy file provider paths file '" & tFileProviderPaths & "'"
750+
end if
751+
put tXMLResBuildFolder & slash & "file_provider_paths.xml" & return after tAssetFiles
752+
741753
if there is a file tIcon then
742754
put url ("binfile:" & tIcon) into url ("binfile:" & tDrawableResBuildFolder & slash & "icon.png")
743755
if the result is not empty then
@@ -1572,6 +1584,9 @@ function mapFilePath pPath
15721584
case "nfc_tech_filter.xml"
15731585
put merge("[[tBinariesFolder]]/nfc_tech_filter.xml") into tPath
15741586
break
1587+
case "file_provider_paths.xml"
1588+
put merge("[[tBinariesFolder]]/file_provider_paths.xml") into tPath
1589+
break
15751590
case "livecode_inputcontrol.xml"
15761591
put merge("[[tBinariesFolder]]/livecode_inputcontrol.xml") into tPath
15771592
break

0 commit comments

Comments
 (0)