Apply received patches from upstream

Change-Id: I0d4be766d0f75c3ba64494599e8f3c5d589d3410
This commit is contained in:
SpiritCroc 2024-02-16 09:35:21 +01:00
parent f05af3f8b3
commit f7a4cc4b31
3 changed files with 22 additions and 3 deletions

View file

@ -24,7 +24,7 @@ import java.util.Locale
internal fun createTemporaryMediaFile(context: Context, mediaType: MediaType): File {
val timeStamp: String = SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(Date())
val storageDir: File = context.filesDir.also { it.mkdirs() }
val storageDir: File = File(context.filesDir, "media").also { it.mkdirs() }
val fileSuffix = when (mediaType) {
MediaType.IMAGE -> ".jpg"
MediaType.VIDEO -> ".mp4"

View file

@ -2,5 +2,5 @@
<paths>
<files-path
name="external_files"
path="." />
</paths>
path="media" />
</paths>

View file

@ -39,6 +39,9 @@ import im.vector.app.features.analytics.VectorAnalytics
import im.vector.app.features.analytics.plan.ViewRoom
import im.vector.app.features.home.HomeActivity
import im.vector.app.features.home.ShortcutsHandler
import im.vector.app.features.home.room.detail.RoomDetailActivity
import im.vector.app.features.home.room.threads.ThreadsActivity
import im.vector.app.features.location.live.map.LiveLocationMapViewActivity
import im.vector.app.features.notifications.NotificationDrawerManager
import im.vector.app.features.pin.UnlockedActivity
import im.vector.app.features.pin.lockscreen.crypto.LockScreenKeyRepository
@ -115,6 +118,14 @@ class MainActivity : VectorBaseActivity<ActivityMainBinding>(), UnlockedActivity
putExtra(EXTRA_ROOM_ID, roomId)
}
}
val allowList = listOf(
HomeActivity::class.java.name,
MainActivity::class.java.name,
RoomDetailActivity::class.java.name,
ThreadsActivity::class.java.name,
LiveLocationMapViewActivity::class.java.name,
)
}
private val startAppViewModel: StartAppViewModel by viewModel()
@ -186,6 +197,7 @@ class MainActivity : VectorBaseActivity<ActivityMainBinding>(), UnlockedActivity
// Start the next Activity
startSyncing()
val nextIntent = intent.getParcelableExtraCompat<Intent>(EXTRA_NEXT_INTENT)
?.takeIf { it.isValid() }
startIntentAndFinish(nextIntent)
} else if (intent.hasExtra(EXTRA_INIT_SESSION)) {
startSyncing()
@ -380,4 +392,11 @@ class MainActivity : VectorBaseActivity<ActivityMainBinding>(), UnlockedActivity
intent?.let { startActivity(it) }
finish()
}
private fun Intent.isValid(): Boolean {
val componentName = resolveActivity(packageManager) ?: return false
val packageName = componentName.packageName
val className = componentName.className
return packageName == buildMeta.applicationId && className in allowList
}
}