Skip to content

Commit

Permalink
merge fix opening file
Browse files Browse the repository at this point in the history
  • Loading branch information
yostyle committed Jun 4, 2024
1 parent d69fab3 commit 872bffe
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 100 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ class AudioPicker : Picker<MultiPickerAudioType>() {
* Returns selected audio files or empty list if user did not select any files.
*/
override fun getSelectedFiles(context: Context, data: Intent?): List<MultiPickerAudioType> {
<<<<<<< HEAD
// TCHAP Grant permission to access the selected file.
=======
>>>>>>> v1.6.16
return getSelectedUriList(context, data).mapNotNull { selectedUri ->
selectedUri.toMultiPickerAudioType(context)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ class FilePicker : Picker<MultiPickerBaseType>() {
* Returns selected files or empty list if user did not select any files.
*/
override fun getSelectedFiles(context: Context, data: Intent?): List<MultiPickerBaseType> {
<<<<<<< HEAD
// TCHAP Grant permission to access the selected file.
=======
>>>>>>> v1.6.16
return getSelectedUriList(context, data).mapNotNull { selectedUri ->
val type = context.contentResolver.getType(selectedUri)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ class ImagePicker : Picker<MultiPickerImageType>() {
* Returns selected image files or empty list if user did not select any files.
*/
override fun getSelectedFiles(context: Context, data: Intent?): List<MultiPickerImageType> {
<<<<<<< HEAD
// TCHAP Grant permission to access the selected file.
=======
>>>>>>> v1.6.16
return getSelectedUriList(context, data).mapNotNull { selectedUri ->
selectedUri.toMultiPickerImageType(context)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ class MediaPicker : Picker<MultiPickerBaseMediaType>() {
* Returns selected image/video files or empty list if user did not select any files.
*/
override fun getSelectedFiles(context: Context, data: Intent?): List<MultiPickerBaseMediaType> {
<<<<<<< HEAD
// TCHAP Grant permission to access the selected file.
=======
>>>>>>> v1.6.16
return getSelectedUriList(context, data).mapNotNull { selectedUri ->
val mimeType = context.contentResolver.getType(selectedUri)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,9 @@ abstract class Picker<T> {
uriList.forEach {
for (resolveInfo in resInfoList) {
val packageName: String = resolveInfo.activityInfo.packageName
<<<<<<< HEAD
// TCHAP Replace implicit intent by an explicit to fix crash on some devices like Xiaomi.
=======

// Replace implicit intent by an explicit to fix crash on some devices like Xiaomi.
// see https://juejin.cn/post/7031736325422186510
>>>>>>> v1.6.16
try {
context.grantUriPermission(packageName, it, Intent.FLAG_GRANT_READ_URI_PERMISSION)
} catch (e: Exception) {
Expand Down Expand Up @@ -119,12 +115,6 @@ abstract class Picker<T> {
}
}
}
<<<<<<< HEAD
// TCHAP Grant permission to access the selected file.
val packageName = context.applicationContext.packageName
return selectedUriList.onEach { context.grantUriPermission(packageName, it, Intent.FLAG_GRANT_READ_URI_PERMISSION) }
=======
return selectedUriList.onEach { context.grantUriPermission(context.applicationContext.packageName, it, Intent.FLAG_GRANT_READ_URI_PERMISSION) }
>>>>>>> v1.6.16
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ class VideoPicker : Picker<MultiPickerVideoType>() {
* Returns selected video files or empty list if user did not select any files.
*/
override fun getSelectedFiles(context: Context, data: Intent?): List<MultiPickerVideoType> {
<<<<<<< HEAD
// TCHAP Grant permission to access the selected file.
=======
>>>>>>> v1.6.16
return getSelectedUriList(context, data).mapNotNull { selectedUri ->
selectedUri.toMultiPickerVideoType(context)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter
.also {
Timber.e("## Send: Work cancelled by user")

<<<<<<< HEAD
// TCHAP Revoke read permission to the local file.
=======
>>>>>>> v1.6.16
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.revokeUriPermission(context.packageName, params.attachment.queryUri, Intent.FLAG_GRANT_READ_URI_PERMISSION)
} else {
Expand Down Expand Up @@ -411,10 +407,6 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter
return Result.success(WorkerParamsFactory.toData(sendParams)).also {
Timber.v("## handleSuccess $attachmentUrl, work is stopped $isStopped")

<<<<<<< HEAD
// TCHAP Revoke read permission to the local file.
=======
>>>>>>> v1.6.16
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.revokeUriPermission(context.packageName, params.attachment.queryUri, Intent.FLAG_GRANT_READ_URI_PERMISSION)
} else {
Expand Down
4 changes: 0 additions & 4 deletions vector-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ ext.versionMinor = 11
// Note: even values are reserved for regular release, odd values for hotfix release.
// When creating a hotfix, you should decrease the value, since the current value
// is the value for the next regular release.
<<<<<<< HEAD
ext.versionPatch = 6
=======
ext.versionPatch = 16
>>>>>>> v1.6.16

static def getGitTimestamp() {
def cmd = 'git show -s --format=%ct'
Expand Down
58 changes: 24 additions & 34 deletions vector/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,40 +167,30 @@

<!-- Activity to intercept links coming from a web instance -->
<!-- exported="true" is required to handle android.intent.action.VIEW for URL redirection-->
<!-- <activity-->
<!-- android:name=".features.link.LinkHandlerActivity"-->
<!-- android:enabled="true"-->
<!-- android:exported="true">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.VIEW" />-->

<!-- <category android:name="android.intent.category.DEFAULT" />-->
<!-- <category android:name="android.intent.category.BROWSABLE" />-->

<<<<<<< HEAD
<!-- <data android:scheme="https" />-->
<!-- <data android:host="riot.im" />-->
<!-- <data android:host="app.element.io" />-->
<!-- <data android:host="mobile.element.io" />-->
<!-- <data android:host="develop.element.io" />-->
<!-- <data android:host="staging.element.io" />-->
<!-- </intent-filter>-->
<!-- </activity>-->
=======
<data android:scheme="https" />
<data android:host="riot.im" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="https" />
<data android:host="*.element.io" />
</intent-filter>
</activity>
>>>>>>> v1.6.16
<!-- TCHAP disable element link -->
<!-- <activity-->
<!-- android:name=".features.link.LinkHandlerActivity"-->
<!-- android:enabled="true"-->
<!-- android:exported="true">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.VIEW" />-->

<!-- <category android:name="android.intent.category.DEFAULT" />-->
<!-- <category android:name="android.intent.category.BROWSABLE" />-->

<!-- <data android:scheme="https" />-->
<!-- <data android:host="riot.im" />-->
<!-- </intent-filter>-->
<!-- <intent-filter android:autoVerify="true">-->
<!-- <action android:name="android.intent.action.VIEW" />-->

<!-- <category android:name="android.intent.category.DEFAULT" />-->
<!-- <category android:name="android.intent.category.BROWSABLE" />-->

<!-- <data android:scheme="https" />-->
<!-- <data android:host="*.element.io" />-->
<!-- </intent-filter>-->
<!-- </activity>-->

<!-- Activity alias for matrix.to or element permalinks -->
<!-- exported="true" is required to handle android.intent.action.VIEW for URL redirection-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ sealed class RoomDetailViewEvents : VectorViewEvents {
val mimeType: String?
) : RoomDetailViewEvents()

<<<<<<< HEAD
// TCHAP Revoke read permission to the local file.
=======
>>>>>>> v1.6.16
data class RevokeFilePermission(
val uri: Uri
) : RoomDetailViewEvents()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1606,21 +1606,13 @@ class TimelineFragment :

private fun handleCancelSend(action: EventSharedAction.Cancel) {
if (action.force) {
<<<<<<< HEAD
// TCHAP Revoke read permission to the local file.
=======
>>>>>>> v1.6.16
timelineViewModel.handle(RoomDetailAction.CancelSend(action.event, true))
} else {
MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.dialog_title_confirmation)
.setMessage(getString(R.string.event_status_cancel_sending_dialog_message))
.setNegativeButton(R.string.no, null)
.setPositiveButton(R.string.yes) { _, _ ->
<<<<<<< HEAD
// TCHAP Revoke read permission to the local file.
=======
>>>>>>> v1.6.16
timelineViewModel.handle(RoomDetailAction.CancelSend(action.event, false))
}
.show()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1101,10 +1101,6 @@ class TimelineViewModel @AssistedInject constructor(

private fun handleCancel(action: RoomDetailAction.CancelSend) {
if (room == null) return
<<<<<<< HEAD
// TCHAP Revoke read permission to the local file.
=======
>>>>>>> v1.6.16
// State must be in one of the sending states
if (action.force || action.event.root.sendState.isSending()) {
room.sendService().cancelSend(action.event.eventId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,6 @@ class MessageActionsViewModel @AssistedInject constructor(
private fun ArrayList<EventSharedAction>.addActionsForSendingState(timelineEvent: TimelineEvent) {
// TODO is uploading attachment?
if (canCancel(timelineEvent)) {
<<<<<<< HEAD
// TCHAP Revoke read permission to the local file.
=======
>>>>>>> v1.6.16
add(EventSharedAction.Cancel(timelineEvent, false))
}
}
Expand All @@ -325,10 +321,6 @@ class MessageActionsViewModel @AssistedInject constructor(
// If sent but not synced (synapse stuck at bottom bug)
// Still offer action to cancel (will only remove local echo)
timelineEvent.root.eventId?.let {
<<<<<<< HEAD
// TCHAP Revoke read permission to the local file.
=======
>>>>>>> v1.6.16
add(EventSharedAction.Cancel(timelineEvent, true))
}

Expand Down

0 comments on commit 872bffe

Please sign in to comment.