Skip to content

Commit

Permalink
fix share error
Browse files Browse the repository at this point in the history
  • Loading branch information
ShirosakiMio committed Jun 26, 2024
1 parent 8bf3927 commit e167716
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
14 changes: 10 additions & 4 deletions FCL/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,23 @@
android:enabled="true"/>
<provider
android:name=".scoped.FolderProvider"
android:authorities="@string/file_browser_provider"
android:authorities="@string/file_browser_document_provider"
android:exported="true"
android:grantUriPermissions="true"
android:permission="android.permission.MANAGE_DOCUMENTS">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
<intent-filter>
<action android:name="android.content.action.DOCUMENTS_PROVIDER" />
</intent-filter>
</provider>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="@string/file_browser_provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
</application>
<queries>
<package android:name="net.kdt.pojavlaunch.ffmpeg"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,10 @@ public void onClick(View v) {
File file = File.createTempFile("fcl-latest", ".log");
FileUtils.writeText(file, error.getText().toString());
Uri uri = FileProvider.getUriForFile(this, getString(com.tungsten.fcllibrary.R.string.file_browser_provider), file);
intent.setType("*/*");
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_STREAM, uri);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.addCategory(Intent.CATEGORY_DEFAULT);
startActivity(Intent.createChooser(intent, getString(com.tungsten.fcllibrary.R.string.crash_reporter_share)));
} catch (Exception e) {
LOG.log(Level.INFO, "Share error: " + e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,10 @@ public void onClick(View view) {
File file = File.createTempFile("crash_report", ".txt");
Files.write(file.toPath(), CrashReporter.getAllErrorDetailsFromIntent(this, getIntent()).getBytes(StandardCharsets.UTF_8));
Uri uri = FileProvider.getUriForFile(this, getString(R.string.file_browser_provider), file);
intent.setType("*/*");
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_STREAM, uri);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.addCategory(Intent.CATEGORY_DEFAULT);
startActivity(Intent.createChooser(intent, getString(R.string.crash_reporter_share)));
} catch (IOException e) {
e.printStackTrace();
Expand Down
1 change: 1 addition & 0 deletions FCLLibrary/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="file_browser_provider" translatable="false">com.tungsten.fcl.provider</string>
<string name="file_browser_document_provider" translatable="false">com.tungsten.fcl.document.provider</string>
<string name="file_browser_title">File Browser</string>
<string name="file_browser_back">Back</string>
<string name="file_browser_close">Exit</string>
Expand Down

0 comments on commit e167716

Please sign in to comment.