From 431be5faea2be53706dfe52ec1e98bddbbd0b58c Mon Sep 17 00:00:00 2001 From: Taveon Nelson <74945303+457R0@users.noreply.github.com> Date: Mon, 18 May 2026 05:46:40 -0500 Subject: [PATCH] Battlescreen login loop fix --- .../github/nacabaro/vbhelper/MainActivity.kt | 19 +++---------------- build/reports/problems/problems-report.html | 2 +- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/com/github/nacabaro/vbhelper/MainActivity.kt b/app/src/main/java/com/github/nacabaro/vbhelper/MainActivity.kt index a9676e3..c883fbc 100644 --- a/app/src/main/java/com/github/nacabaro/vbhelper/MainActivity.kt +++ b/app/src/main/java/com/github/nacabaro/vbhelper/MainActivity.kt @@ -23,9 +23,6 @@ import com.github.nacabaro.vbhelper.screens.cardScreen.CardScreenControllerImpl import com.github.nacabaro.vbhelper.screens.spriteViewer.SpriteViewerControllerImpl import com.github.nacabaro.vbhelper.screens.storageScreen.StorageScreenControllerImpl import com.github.nacabaro.vbhelper.ui.theme.VBHelperTheme -import androidx.lifecycle.lifecycleScope -import kotlinx.coroutines.launch -import kotlinx.coroutines.Dispatchers class MainActivity : ComponentActivity() { @@ -119,19 +116,9 @@ class MainActivity : ComponentActivity() { val hasAuthToken = !token.isNullOrEmpty() if (isAppAuthCallback || isLocalhostAuthCallback || hasAuthToken) { - if (!token.isNullOrEmpty()) { - val application = applicationContext as VBHelper - val authRepository = com.github.nacabaro.vbhelper.battle.BattleAuthContainer(this).authRepository - val userId = data.getQueryParameter("userId")?.toLongOrNull() - - lifecycleScope.launch(Dispatchers.IO) { - authRepository.setAuthenticated( - isAuthenticated = true, - nacatechToken = token, - userId = userId - ) - } - } + // BattlesScreen consumes the callback intent and exchanges the single-use token + // for a durable session token. Writing partial auth state here can clear an + // already-valid session token and cause the browser login loop to restart. return NavigationItems.Battles.route } } diff --git a/build/reports/problems/problems-report.html b/build/reports/problems/problems-report.html index d103092..0cf967c 100644 --- a/build/reports/problems/problems-report.html +++ b/build/reports/problems/problems-report.html @@ -650,7 +650,7 @@ code + .copy-button {