Merge branch 'release_hyx' into release
This commit is contained in:
commit
571afae633
@ -62,9 +62,10 @@
|
|||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:requestLegacyExternalStorage="true"
|
android:requestLegacyExternalStorage="true"
|
||||||
android:usesCleartextTraffic="true">
|
android:usesCleartextTraffic="true">
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="androidx.core.content.FileProvider"
|
android:name="androidx.core.content.FileProvider"
|
||||||
android:authorities="${applicationId}.fileprovider"
|
android:authorities="${applicationId}.provider"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:grantUriPermissions="true">
|
android:grantUriPermissions="true">
|
||||||
<meta-data
|
<meta-data
|
||||||
|
|||||||
@ -68,21 +68,22 @@ class MainActivity : FlutterActivity() {
|
|||||||
if (filePath == null) {
|
if (filePath == null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val file = File(filePath)
|
val file = File(filePath)
|
||||||
|
if (!file.exists()) {
|
||||||
|
Log.e("File Share", "文件不存在: $filePath")
|
||||||
|
return
|
||||||
|
}
|
||||||
val uri: Uri = FileProvider.getUriForFile(
|
val uri: Uri = FileProvider.getUriForFile(
|
||||||
this,
|
this,
|
||||||
"${applicationContext.packageName}.fileprovider",
|
"${packageName}.provider",
|
||||||
file
|
file
|
||||||
)
|
)
|
||||||
|
|
||||||
val shareIntent = Intent().apply {
|
val shareIntent = Intent().apply {
|
||||||
action = Intent.ACTION_SEND
|
action = Intent.ACTION_SEND
|
||||||
putExtra(Intent.EXTRA_STREAM, uri)
|
putExtra(Intent.EXTRA_STREAM, uri)
|
||||||
type = "application/octet-stream"
|
type = "application/octet-stream"
|
||||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||||
}
|
}
|
||||||
|
|
||||||
startActivity(Intent.createChooser(shareIntent, null))
|
startActivity(Intent.createChooser(shareIntent, null))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
<paths>
|
||||||
<files-path name="files" path="." />
|
<root-path name="root-path" path="."/>
|
||||||
|
<files-path name="files" path="."/>
|
||||||
|
<cache-path name="cache" path="."/>
|
||||||
|
<external-files-path name="external_files" path="."/>
|
||||||
</paths>
|
</paths>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user