mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 12:35:42 +00:00
fix(stores): let a newer game link supersede opening the Nexon Launcher
Take the launch ticket before the worker resolves the Nexon entry and pass it on, so a game link that arrives meanwhile wins. Drop the Battle.net wrappers the client refactor left unused, and clear the test runtime root without following links.
This commit is contained in:
1 parent
6be30d07b4
commit
3716455994
6 files changed
+11
-14
No files matched your search
@@ -2802,10 +2802,11 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
|
||||
private fun openNexon() {
|
||||
val app = applicationContext
|
||||
val ticket = beginUiLaunch()
|
||||
Thread({
|
||||
val entry = com.droiddeck.launcher.runtime.Nexon.entry(app)
|
||||
if (entry == null) com.droiddeck.launcher.stores.SetupDownload.openOrFetch(app, com.droiddeck.launcher.runtime.Nexon.CLIENT)
|
||||
else ui.post { if (!isDestroyed) launchWithoutSteam(entry, false) }
|
||||
else ui.post { if (!isDestroyed && launchCoordinator.isCurrent(ticket)) launchWithoutSteam(entry, false, ticket = ticket) }
|
||||
}, "nexon-open").start()
|
||||
}
|
||||
|
||||
|
||||
@@ -143,12 +143,6 @@ object BattleNet {
|
||||
|
||||
fun installed(context: Context) = CLIENT.installed(context)
|
||||
|
||||
fun profile(context: Context): Pair<String, String>? = CLIENT.profile(context)
|
||||
|
||||
fun icon(context: Context): File? = CLIENT.icon(context)
|
||||
|
||||
fun launcherEntry(installed: Boolean, art: File? = null): com.droiddeck.launcher.frontend.Library.SteamGame? = CLIENT.launcherEntry(installed, art)
|
||||
|
||||
internal fun title(uid: String): Title? {
|
||||
val id = uid.lowercase()
|
||||
TITLES.firstOrNull { it.uid == id }?.let { return it }
|
||||
|
||||
@@ -28,7 +28,7 @@ class WindowsClient(
|
||||
|
||||
fun setup(context: Context) = File(LinuxRuntime.rootDir(context), setupPath)
|
||||
|
||||
val guestPrefix: String get() = "/$COMPATDATA/$appId"
|
||||
private val guestPrefix: String get() = "/$COMPATDATA/$appId"
|
||||
|
||||
val guestLauncher: String get() = "$guestPrefix/pfx/drive_c/$launcherPath"
|
||||
|
||||
@@ -37,9 +37,9 @@ class WindowsClient(
|
||||
fun profile(context: Context): Pair<String, String>? =
|
||||
(appId.toString() to context.getString(nameRes)).takeIf { installed(context) }
|
||||
|
||||
fun launcherEntry(installed: Boolean, art: File? = null): Library.SteamGame? =
|
||||
fun launcherEntry(installed: Boolean): Library.SteamGame? =
|
||||
if (!installed) null
|
||||
else Library.SteamGame(appId = appId.toInt(), name = store.label, art = art, library = library, gameId = appId, source = store.id)
|
||||
else Library.SteamGame(appId = appId.toInt(), name = store.label, art = null, library = library, gameId = appId, source = store.id)
|
||||
|
||||
fun icon(context: Context): File? {
|
||||
val out = File(context.filesDir, "${store.id}-art/launcher/icon.png")
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
object BattleNetClient {
|
||||
private const val TAG = "BattleNetClient"
|
||||
val DOWNLOAD_KEY: String get() = BattleNet.CLIENT.downloadKey
|
||||
const val REQUEST = "battlenet-request"
|
||||
private const val CONFIG = "pfx/drive_c/users/steamuser/AppData/Roaming/Battle.net/Battle.net.config"
|
||||
private val work = Executors.newSingleThreadExecutor { r -> Thread(r, "battlenet-client") }
|
||||
|
||||
@@ -80,9 +80,9 @@ class BattleNetTest {
|
||||
}
|
||||
|
||||
@Test fun theEnvironmentEditorNamesBattleNetsProfileOnceItIsInstalled() {
|
||||
assertNull(BattleNet.profile(context))
|
||||
assertNull(BattleNet.CLIENT.profile(context))
|
||||
launcher().apply { parentFile!!.mkdirs(); writeText("MZ") }
|
||||
assertEquals(BattleNet.APP_ID.toString() to "Battle.net", BattleNet.profile(context))
|
||||
assertEquals(BattleNet.APP_ID.toString() to "Battle.net", BattleNet.CLIENT.profile(context))
|
||||
}
|
||||
|
||||
@Test fun removeTakesThePrefixItsMenuEntryAndCacheButNothingItLinksTo() {
|
||||
|
||||
@@ -18,7 +18,10 @@ import org.robolectric.RuntimeEnvironment
|
||||
import org.robolectric.annotation.Config
|
||||
import java.io.File
|
||||
import java.util.zip.CRC32
|
||||
import kotlin.io.path.ExperimentalPathApi
|
||||
import kotlin.io.path.deleteRecursively
|
||||
|
||||
@OptIn(ExperimentalPathApi::class)
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [28], manifest = Config.NONE)
|
||||
class WindowsClientTest {
|
||||
@@ -26,7 +29,7 @@ class WindowsClientTest {
|
||||
|
||||
@Before fun setUp() {
|
||||
context = RuntimeEnvironment.getApplication()
|
||||
LinuxRuntime.rootDir(context).deleteRecursively()
|
||||
LinuxRuntime.rootDir(context).toPath().deleteRecursively()
|
||||
}
|
||||
|
||||
@Test fun eachClientHasItsOwnShortcutIdPrefixAndDownload() {
|
||||
|
||||
Reference in new issue
Block a user