Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cedaecb3 authored by Vincent Breitmoser's avatar Vincent Breitmoser Committed by GitHub
Browse files

Merge pull request #1769 from k9mail/attachment-ninjafix

use AttachmentTempFileProvider to expose file-backed content uris
parents bc41d912 502bb657
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5,3 +5,4 @@ androidSupportLibraryVersion=23.1.1
robolectricVersion=3.1.1
junitVersion=4.12
mockitoVersion=1.10.19
okioVersion=1.11.0
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ dependencies {
    androidTestCompile 'com.android.support.test:runner:0.4.1'
    androidTestCompile 'com.madgag.spongycastle:pg:1.51.0.0'

    testCompile 'com.squareup.okio:okio:1.6.0'
    testCompile "com.squareup.okio:okio:${okioVersion}"
    testCompile "org.robolectric:robolectric:${robolectricVersion}"
    testCompile "junit:junit:${junitVersion}"
    testCompile "org.mockito:mockito-core:${mockitoVersion}"
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ dependencies {
    compile project(':plugins:Android-PullToRefresh:library')
    compile project(':plugins:HoloColorPicker')
    compile project(':plugins:openpgp-api-lib:openpgp-api')
    compile "com.squareup.okio:okio:${okioVersion}"
    compile 'commons-io:commons-io:2.4'
    compile "com.android.support:support-v4:${androidSupportLibraryVersion}"
    compile 'net.sourceforge.htmlcleaner:htmlcleaner:2.16'
+10 −0
Original line number Diff line number Diff line
@@ -422,7 +422,17 @@
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/decrypted_file_provider_paths" />
        </provider>

        <provider
            android:name=".provider.AttachmentTempFileProvider"
            android:authorities="${applicationId}.tempfileprovider"
            android:exported="false"
            android:grantUriPermissions="true">

            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/temp_file_provider_paths" />
        </provider>

    </application>
+2 −2
Original line number Diff line number Diff line
@@ -127,13 +127,13 @@ public class AttachmentPresenter {
    }

    public void addAttachment(AttachmentViewInfo attachmentViewInfo) {
        if (attachments.containsKey(attachmentViewInfo.uri)) {
        if (attachments.containsKey(attachmentViewInfo.internalUri)) {
            throw new IllegalStateException("Received the same attachmentViewInfo twice!");
        }

        int loaderId = getNextFreeLoaderId();
        Attachment attachment = Attachment.createAttachment(
                attachmentViewInfo.uri, loaderId, attachmentViewInfo.mimeType);
                attachmentViewInfo.internalUri, loaderId, attachmentViewInfo.mimeType);
        attachment = attachment.deriveWithMetadataLoaded(
                attachmentViewInfo.mimeType, attachmentViewInfo.displayName, attachmentViewInfo.size);

Loading