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

Fix file access permission #1022

Merged
merged 10 commits into from
Apr 10, 2024
Merged

Fix file access permission #1022

merged 10 commits into from
Apr 10, 2024

Conversation

yostyle
Copy link
Contributor

@yostyle yostyle commented Apr 8, 2024

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Fix #642 #766 #851 #911

Motivation and context

Screenshots / GIFs

Tests

  • Step 1
  • Step 2
  • Step ...

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

@yostyle yostyle requested a review from NicolasBuquet April 8, 2024 19:40
@yostyle yostyle self-assigned this Apr 8, 2024
@tchap-danger-bot
Copy link

Warnings
⚠️

Please add a changelog. See instructions here

Generated by 🚫 dangerJS against 5dd88a5

@tchap-danger-bot
Copy link

Warnings
⚠️

Please add a changelog. See instructions here

Generated by 🚫 dangerJS against c432446

@tchap-danger-bot
Copy link

Warnings
⚠️

Please add a changelog. See instructions here

Generated by 🚫 dangerJS against 64b5ffd

@tchap-danger-bot
Copy link

Warnings
⚠️

Please add a changelog. See instructions here

Generated by 🚫 dangerJS against fb7fb84

@yostyle yostyle changed the title Yostyle/fix image permission Fix file acces permission Apr 8, 2024
@yostyle yostyle changed the title Fix file acces permission Fix file access permission Apr 8, 2024
@tchap-danger-bot
Copy link

Warnings
⚠️

Please add a changelog. See instructions here

Generated by 🚫 dangerJS against 8341f46

Copy link
Contributor

@NicolasBuquet NicolasBuquet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mutualiser la configuration de l'appel getSelectedUriList

@@ -32,6 +32,8 @@ class AudioPicker : Picker<MultiPickerAudioType>() {
*/
override fun getSelectedFiles(context: Context, data: Intent?): List<MultiPickerAudioType> {
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)
Copy link
Contributor

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

@@ -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)
Copy link
Contributor

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

@@ -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)
Copy link
Contributor

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

@@ -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)
Copy link
Contributor

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

@@ -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)
Copy link
Contributor

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

@@ -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()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ajouter un Tchap commentaire

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

@@ -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) :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add Tchap commentaire

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

@NicolasBuquet NicolasBuquet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ajouter un changelog STP

@tchap-danger-bot
Copy link

Warnings
⚠️

Please add a changelog. See instructions here

⚠️ Please add a reviewer to your PR.

Generated by 🚫 dangerJS against d22e847

@yostyle yostyle force-pushed the yostyle/fix_image_permission branch from d22e847 to efdec04 Compare April 10, 2024 00:42
@tchap-danger-bot
Copy link

Warnings
⚠️

Please add a changelog. See instructions here

⚠️ Please add a reviewer to your PR.

Generated by 🚫 dangerJS against efdec04

@tchap-danger-bot
Copy link

Warnings
⚠️

Please add a changelog. See instructions here

⚠️ Please add a reviewer to your PR.

Generated by 🚫 dangerJS against 8af2f48

@yostyle yostyle requested a review from NicolasBuquet April 10, 2024 08:29
Copy link
Contributor

@NicolasBuquet NicolasBuquet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR assez conséquente ! Bravo 👏

LGTM

@yostyle yostyle merged commit 1714362 into develop Apr 10, 2024
17 of 18 checks passed
@yostyle yostyle deleted the yostyle/fix_image_permission branch April 10, 2024 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants