Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed folders showing up incorrectly as files in copy/move dialog ([#267])
- Fixed error when saving files with unsupported characters ([#250])
- Fixed File manager does not ask for file access permission if opened for the first time via "share" dialog ([#85])
Comment thread
jguegel marked this conversation as resolved.
Outdated

## [1.2.3] - 2025-09-15
### Fixed
Expand Down Expand Up @@ -76,6 +77,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#251]: https://github.com/FossifyOrg/File-Manager/issues/251
[#267]: https://github.com/FossifyOrg/File-Manager/issues/267
[#250]: https://github.com/FossifyOrg/File-Manager/issues/250
[#85]: https://github.com/FossifyOrg/File-Manager/issues/85

[Unreleased]: https://github.com/FossifyOrg/File-Manager/compare/1.2.3...HEAD
[1.2.3]: https://github.com/FossifyOrg/File-Manager/compare/1.2.2...1.2.3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package org.fossify.filemanager.activities

import android.annotation.SuppressLint
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.os.Environment
import androidx.core.net.toUri
import org.fossify.commons.dialogs.FilePickerDialog
import org.fossify.commons.extensions.*
import org.fossify.commons.helpers.NavigationIcon
import org.fossify.commons.helpers.ensureBackgroundThread
import org.fossify.commons.helpers.isRPlus
import org.fossify.filemanager.R
import org.fossify.filemanager.databinding.ActivitySaveAsBinding
import org.fossify.filemanager.extensions.config
Expand All @@ -15,9 +19,18 @@ import java.io.File
class SaveAsActivity : SimpleActivity() {
private val binding by viewBinding(ActivitySaveAsBinding::inflate)

companion object {
private const val MANAGE_STORAGE_RC = 201
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(binding.root)
if (isRPlus() && !Environment.isExternalStorageManager()) {
Comment thread
jguegel marked this conversation as resolved.
Outdated
val intent = Intent(android.provider.Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION)
intent.data = "package:$packageName".toUri()
startActivityForResult(intent, MANAGE_STORAGE_RC)
return
}

Comment thread
jguegel marked this conversation as resolved.
if (intent.action == Intent.ACTION_SEND && intent.extras?.containsKey(Intent.EXTRA_STREAM) == true) {
FilePickerDialog(this, pickFile = false, showHidden = config.shouldShowHidden(), showFAB = true, showFavoritesButton = true) {
Expand Down Expand Up @@ -72,4 +85,18 @@ class SaveAsActivity : SimpleActivity() {
return filename.replace("[/\\\\<>:\"|?*\u0000-\u001F]".toRegex(), "_")
.takeIf { it.isNotBlank() } ?: "unnamed_file"
}

@SuppressLint("NewApi")
override fun onActivityResult(requestCode: Int, resultCode: Int, dataIntent: Intent?) {
super.onActivityResult(requestCode, resultCode, dataIntent)

if (requestCode == MANAGE_STORAGE_RC && isRPlus()) {
if (Environment.isExternalStorageManager()) {
recreate()
} else {
toast(R.string.no_storage_permissions)
finish()
}
}
}
}
Loading