-
Notifications
You must be signed in to change notification settings - Fork 7
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
Fix file access permission #1022
Changes from 7 commits
d64d442
164ffec
5dd88a5
c432446
64b5ffd
fb7fb84
8341f46
efdec04
8af2f48
83f2aef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,9 @@ class FilePicker : Picker<MultiPickerBaseType>() { | |
*/ | ||
override fun getSelectedFiles(context: Context, data: Intent?): List<MultiPickerBaseType> { | ||
return getSelectedUriList(data).mapNotNull { selectedUri -> | ||
// Tchap: Grant permission to access the selected file. | ||
context.grantUriPermission(context.applicationContext.packageName, selectedUri, Intent.FLAG_GRANT_READ_URI_PERMISSION) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pourrais être mutualisé dans la classe parente multipicker/Picker::getSelectedUriList |
||
|
||
val type = context.contentResolver.getType(selectedUri) | ||
|
||
when { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,8 @@ class ImagePicker : Picker<MultiPickerImageType>() { | |
*/ | ||
override fun getSelectedFiles(context: Context, data: Intent?): List<MultiPickerImageType> { | ||
return getSelectedUriList(data).mapNotNull { selectedUri -> | ||
// Tchap: Grant permission to access the selected file. | ||
context.grantUriPermission(context.applicationContext.packageName, selectedUri, Intent.FLAG_GRANT_READ_URI_PERMISSION) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pourrais être mutualisé dans la classe parente multipicker/Picker::getSelectedUriList |
||
selectedUri.toMultiPickerImageType(context) | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,9 @@ class MediaPicker : Picker<MultiPickerBaseMediaType>() { | |
*/ | ||
override fun getSelectedFiles(context: Context, data: Intent?): List<MultiPickerBaseMediaType> { | ||
return getSelectedUriList(data).mapNotNull { selectedUri -> | ||
// Tchap: Grant permission to access the selected file. | ||
context.grantUriPermission(context.applicationContext.packageName, selectedUri, Intent.FLAG_GRANT_READ_URI_PERMISSION) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pourrais être mutualisé dans la classe parente multipicker/Picker::getSelectedUriList |
||
|
||
val mimeType = context.contentResolver.getType(selectedUri) | ||
|
||
if (mimeType.isMimeTypeVideo()) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,8 @@ class VideoPicker : Picker<MultiPickerVideoType>() { | |
*/ | ||
override fun getSelectedFiles(context: Context, data: Intent?): List<MultiPickerVideoType> { | ||
return getSelectedUriList(data).mapNotNull { selectedUri -> | ||
// Tchap: Grant permission to access the selected file. | ||
context.grantUriPermission(context.applicationContext.packageName, selectedUri, Intent.FLAG_GRANT_READ_URI_PERMISSION) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pourrais être mutualisé dans la classe parente multipicker/Picker::getSelectedUriList |
||
selectedUri.toMultiPickerVideoType(context) | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,7 @@ sealed class RoomDetailAction : VectorViewModelAction { | |
|
||
data class ResendMessage(val eventId: String) : RoomDetailAction() | ||
data class RemoveFailedEcho(val eventId: String) : RoomDetailAction() | ||
data class CancelSend(val eventId: String, val force: Boolean) : RoomDetailAction() | ||
data class CancelSend(val event: TimelineEvent, val force: Boolean) : RoomDetailAction() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ajouter un Tchap commentaire There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. je préfère ne pas en mettre. le lint oblige d'ajouter un saut de ligne au dessus du commentaire. ca rajoute de la complexité inutile en cas de conflit. |
||
|
||
data class VoteToPoll(val eventId: String, val optionKey: String) : RoomDetailAction() | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ import im.vector.app.core.platform.VectorSharedAction | |
import im.vector.app.features.home.room.detail.timeline.item.MessageInformationData | ||
import org.matrix.android.sdk.api.session.room.model.message.MessageContent | ||
import org.matrix.android.sdk.api.session.room.model.message.MessageWithAttachmentContent | ||
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent | ||
|
||
sealed class EventSharedAction( | ||
@StringRes val titleRes: Int, | ||
|
@@ -71,7 +72,7 @@ sealed class EventSharedAction( | |
data class Redact(val eventId: String, val askForReason: Boolean, val dialogTitleRes: Int, val dialogDescriptionRes: Int) : | ||
EventSharedAction(R.string.message_action_item_redact, R.drawable.ic_delete, true) | ||
|
||
data class Cancel(val eventId: String, val force: Boolean) : | ||
data class Cancel(val event: TimelineEvent, val force: Boolean) : | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add Tchap commentaire There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. je préfère ne pas en mettre. le lint oblige d'ajouter un saut de ligne au dessus du commentaire. ca rajoute de la complexité inutile en cas de conflit. |
||
EventSharedAction(R.string.action_cancel, R.drawable.ic_close_round) | ||
|
||
data class ViewSource(val content: String) : | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pourrais être mutualisé dans la classe parente multipicker/Picker::getSelectedUriList