Skip to content
Snippets Groups Projects
Commit 263247db authored by Nicolas Pomepuy's avatar Nicolas Pomepuy Committed by Duncan McNamara
Browse files

Fix intent result propagation when launched by another app

Fixes #2776
parent 33d7d4f0
No related branches found
No related tags found
1 merge request!1738Fix intent result propagation when launched by another app
Pipeline #355304 passed with stage
in 7 minutes and 10 seconds
......@@ -39,11 +39,33 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.videolan.libvlc.util.AndroidUtil
import org.videolan.medialibrary.MLServiceLocator
import org.videolan.resources.*
import org.videolan.resources.ACTION_PLAY_FROM_SEARCH
import org.videolan.resources.ACTION_SEARCH_GMS
import org.videolan.resources.ACTION_VIEW_ARC
import org.videolan.resources.AndroidDevices
import org.videolan.resources.AppContextProvider
import org.videolan.resources.EXTRA_FIRST_RUN
import org.videolan.resources.EXTRA_PATH
import org.videolan.resources.EXTRA_SEARCH_BUNDLE
import org.videolan.resources.EXTRA_TARGET
import org.videolan.resources.EXTRA_UPGRADE
import org.videolan.resources.MOBILE_MAIN_ACTIVITY
import org.videolan.resources.MOBILE_SEARCH_ACTIVITY
import org.videolan.resources.PREF_FIRST_RUN
import org.videolan.resources.TV_MAIN_ACTIVITY
import org.videolan.resources.TV_ONBOARDING_ACTIVITY
import org.videolan.resources.TV_SEARCH_ACTIVITY
import org.videolan.resources.util.getFromMl
import org.videolan.resources.util.launchForeground
import org.videolan.resources.util.startMedialibrary
import org.videolan.tools.*
import org.videolan.tools.AppScope
import org.videolan.tools.BETA_WELCOME
import org.videolan.tools.KEY_CURRENT_SETTINGS_VERSION
import org.videolan.tools.KEY_TV_ONBOARDING_DONE
import org.videolan.tools.Settings
import org.videolan.tools.awaitAppIsForegroung
import org.videolan.tools.getContextWithLocale
import org.videolan.tools.putSingle
import org.videolan.vlc.gui.BetaWelcomeActivity
import org.videolan.vlc.gui.helpers.hf.StoragePermissionsDelegate.Companion.getStoragePermission
import org.videolan.vlc.gui.onboarding.ONBOARDING_DONE_KEY
......@@ -207,6 +229,7 @@ class StartActivity : FragmentActivity() {
}
if (requestCode == PROPAGATE_RESULT) {
setResult(resultCode, data)
finish()
}
}
......@@ -251,6 +274,7 @@ class StartActivity : FragmentActivity() {
if (Permissions.canReadStorage(applicationContext) || getStoragePermission()) when {
intent.type?.startsWith("video") == true -> try {
startActivityForResult(intent.setClass(this@StartActivity, VideoPlayerActivity::class.java).apply { putExtra(VideoPlayerActivity.FROM_EXTERNAL, true) }, PROPAGATE_RESULT, Util.getFullScreenBundle())
return@launch
} catch (ex: SecurityException) {
intent.data?.let { MediaUtils.openMediaNoUi(it) }
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment