From 27a311260a90ab972da78a4f1f3e2432b531bc17 Mon Sep 17 00:00:00 2001 From: Dixit Sabharwal Date: Wed, 4 Nov 2026 21:20:25 +0100 Subject: [PATCH] android: merge duplicate companion object in LoginViewModel #414 added a second companion object for the 2FA result codes, but the class already had one holding the OAuth constants. Kotlin allows only one per class, so compileDebugKotlin failed with "Only one companion object is allowed per class" and unresolved OAUTH_* references. Move the two constants into the existing companion object. Verified with ./gradlew :app:assembleDebug on JDK 21. --- .../org/cloudreve/android/ui/login/LoginViewModel.kt | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/android/app/src/main/java/org/cloudreve/android/ui/login/LoginViewModel.kt b/android/app/src/main/java/org/cloudreve/android/ui/login/LoginViewModel.kt index 67833d3687..7c5ad98ab3 100644 --- a/android/app/src/main/java/org/cloudreve/android/ui/login/LoginViewModel.kt +++ b/android/app/src/main/java/org/cloudreve/android/ui/login/LoginViewModel.kt @@ -33,13 +33,6 @@ class LoginViewModel( private val api: ApiClient, ) : ViewModel() { - private companion object { - /** serializer.CodeNotFullySuccess: password accepted, 2FA code still required. */ - const val CODE_NOT_FULLY_SUCCESS = 203 - /** serializer.CodeNotFound: here, the 2FA session expired. */ - const val CODE_NOT_FOUND = 404 - } - private val _state = MutableStateFlow(LoginUiState()) val state: StateFlow = _state @@ -202,6 +195,11 @@ class LoginViewModel( .trim() companion object { + /** serializer.CodeNotFullySuccess: password accepted, 2FA code still required. */ + private const val CODE_NOT_FULLY_SUCCESS = 203 + /** serializer.CodeNotFound: here, the 2FA session expired. */ + private const val CODE_NOT_FOUND = 404 + // Built-in public OAuth client (seeded by the server migration). private const val OAUTH_CLIENT_ID = "393a1839-f52e-498e-9972-e77cc2241eee" private const val OAUTH_REDIRECT = "/callback/desktop"