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

[New Arch] Uploads open document #3757

Merged
merged 1 commit into from
Sep 21, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import android.content.Intent
import android.content.IntentFilter
import android.net.Uri
import android.os.Bundle
import android.os.RemoteException
import android.view.Menu
import android.view.MenuItem
import android.view.View
Expand Down Expand Up @@ -568,6 +569,15 @@ class FileDisplayActivity : FileActivity(),
val currentDir = currentDir
val remotePath = currentDir?.remotePath ?: OCFile.ROOT_PATH

// Try to retain access to that file for some time, so we have enough time to upload it
streamsToUpload.forEach { uri ->
try {
contentResolver.takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION)
} catch (remoteException: RemoteException) {
Timber.w(remoteException)
}
}

transfersViewModel.uploadFilesFromContentUri(
accountName = account.name,
listOfContentUris = streamsToUpload,
Expand Down Expand Up @@ -1618,7 +1628,7 @@ class FileDisplayActivity : FileActivity(),
}

override fun uploadFromFileSystem() {
val action = Intent(Intent.ACTION_GET_CONTENT).apply {
val action = Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
setType(ALL_FILES_SAF_REGEX).addCategory(Intent.CATEGORY_OPENABLE)
putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true)
}
Expand Down