Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FileProvider issues. #410

Merged
merged 1 commit into from
Aug 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
android:exported="false" />

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="@string/chucker_provider_authority"
android:name="com.chuckerteam.chucker.internal.support.ChuckerFileProvider"
android:authorities="${applicationId}.com.chuckerteam.chucker.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/chucker_provider_paths" />
</provider>
</application>
</manifest>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.chuckerteam.chucker.internal.support

import androidx.core.content.FileProvider

/**
* We need our own subclass so we don't conflict with other [FileProvider]s
* See: https://github.com/ChuckerTeam/chucker/issues/409
*/
class ChuckerFileProvider : FileProvider()
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ internal class TransactionListFragment :
val file = viewModel.createExportFile(filecontent, cacheFileFactory)
val uri = FileProvider.getUriForFile(
requireContext(),
getString(R.string.chucker_provider_authority),
"${requireContext().packageName}.com.chuckerteam.chucker.provider",
file
)
shareFile(uri)
Expand Down
1 change: 0 additions & 1 deletion library/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,4 @@
<string name="chucker_request_not_ready">The request isn\'t ready for sharing or saving</string>
<string name="chucker_request_is_empty">This request is empty</string>
<string name="chucker_response_is_empty">This response is empty</string>
<string name="chucker_provider_authority">com.chuckerteam.chucker.provider</string>
</resources>