mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-25 21:54:17 +01:00
Grant Uri permission when sharing logs
This commit is contained in:
parent
092dcb18c8
commit
6cf2ef8fb9
@ -132,9 +132,12 @@ class MainActivity : AppCompatActivity() {
|
|||||||
binding.logIcon.setOnClickListener {
|
binding.logIcon.setOnClickListener {
|
||||||
val file = applicationContext.filesDir.resolve("emulation.sklog")
|
val file = applicationContext.filesDir.resolve("emulation.sklog")
|
||||||
if (file.length() != 0L) {
|
if (file.length() != 0L) {
|
||||||
|
val uri = FileProvider.getUriForFile(this@MainActivity, "skyline.emu.fileprovider", file)
|
||||||
val intent = Intent(Intent.ACTION_SEND)
|
val intent = Intent(Intent.ACTION_SEND)
|
||||||
.setType("text/plain")
|
.setType("text/plain")
|
||||||
.putExtra(Intent.EXTRA_STREAM, FileProvider.getUriForFile(this@MainActivity, "skyline.emu.fileprovider", file))
|
.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||||
|
.setData(uri)
|
||||||
|
.putExtra(Intent.EXTRA_STREAM, uri)
|
||||||
startActivity(Intent.createChooser(intent, getString(R.string.log_share_prompt)))
|
startActivity(Intent.createChooser(intent, getString(R.string.log_share_prompt)))
|
||||||
} else {
|
} else {
|
||||||
Snackbar.make(this@MainActivity.findViewById(android.R.id.content), getString(R.string.logs_not_found), Snackbar.LENGTH_SHORT).show()
|
Snackbar.make(this@MainActivity.findViewById(android.R.id.content), getString(R.string.logs_not_found), Snackbar.LENGTH_SHORT).show()
|
||||||
|
Loading…
Reference in New Issue
Block a user