mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 07:46:01 +00:00
feat(frontend): launch from every frontend file format and store, with per-store game files (#2872)
This commit is contained in:
1 parent
45c31a480a
commit
dc9d1b81cc
10 files changed
+399
-53
No files matched your search
@@ -875,7 +875,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
runCatching { com.droiddeck.launcher.frontend.AutoComponents.restoreMissing(this) }.onFailure { Log.w(TAG, "components: restore failed", it) }
|
||||
}, "components-restore").start()
|
||||
}
|
||||
private var pendingGameLink: String? = null
|
||||
private var pendingGameLink: com.droiddeck.launcher.frontend.GameRequest? = null
|
||||
private var gameLinkReading = false
|
||||
private var gameLinkTried = false
|
||||
private var gameSyncFolder by mutableStateOf<String?>(null)
|
||||
@@ -947,12 +947,12 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
com.droiddeck.launcher.ui.DualScreenPanel.hide(taskId)
|
||||
val copy = Intent(request)
|
||||
Thread({
|
||||
val id = GameLaunchIntent.read(this, copy)
|
||||
val game = GameLaunchIntent.read(this, copy)
|
||||
ui.post {
|
||||
if (intent === request && !isDestroyed) {
|
||||
gameLinkReading = false
|
||||
pendingGameLink = id
|
||||
if (id == null) {
|
||||
pendingGameLink = game
|
||||
if (game == null) {
|
||||
syncDualPanel()
|
||||
android.widget.Toast.makeText(this, R.string.game_link_invalid, android.widget.Toast.LENGTH_LONG).show()
|
||||
} else {
|
||||
@@ -1202,16 +1202,16 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
|
||||
private fun handleGameLink(games: List<Library.SteamGame>, scanned: Boolean = true) {
|
||||
if (!lifecycle.currentState.isAtLeast(androidx.lifecycle.Lifecycle.State.RESUMED)) return
|
||||
val id = pendingGameLink ?: return
|
||||
if (!scanned && games.none { it.gameIdString == id }) return
|
||||
val request = pendingGameLink ?: return
|
||||
val game = request.find(games, byTitle = scanned)
|
||||
if (!scanned && game == null) return
|
||||
gameLinkTried = true
|
||||
ui.postDelayed({
|
||||
if (!isDestroyed && lifecycle.currentState.isAtLeast(androidx.lifecycle.Lifecycle.State.RESUMED)) syncDualPanel()
|
||||
}, LINK_PANEL_MS)
|
||||
val game = games.firstOrNull { it.gameIdString == id }
|
||||
val link = intent
|
||||
fun consume() {
|
||||
if (intent !== link || pendingGameLink != id) return
|
||||
if (intent !== link || pendingGameLink !== request) return
|
||||
pendingGameLink = null
|
||||
link.data = null
|
||||
link.action = Intent.ACTION_MAIN
|
||||
@@ -1220,7 +1220,9 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
if (game == null) {
|
||||
consume()
|
||||
syncDualPanel()
|
||||
android.widget.Toast.makeText(this, R.string.game_link_missing, android.widget.Toast.LENGTH_LONG).show()
|
||||
android.widget.Toast.makeText(this,
|
||||
if (request.program != null) R.string.game_link_program_unknown else R.string.game_link_missing,
|
||||
android.widget.Toast.LENGTH_LONG).show()
|
||||
} else launchGame(game, returnHome = true, onSettled = ::consume)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user