fix(android) detekt: extract VersionTooOldViewModel to its own file
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -20,29 +20,10 @@ import androidx.compose.ui.Alignment
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.hilt.navigation.compose.hiltViewModel
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
import androidx.lifecycle.SavedStateHandle
|
|
||||||
import androidx.lifecycle.ViewModel
|
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import com.composables.icons.lucide.Lucide
|
import com.composables.icons.lucide.Lucide
|
||||||
import com.composables.icons.lucide.TriangleAlert
|
import com.composables.icons.lucide.TriangleAlert
|
||||||
import com.fabledsword.minstrel.update.data.VersionCheckController
|
|
||||||
import com.fabledsword.minstrel.update.data.VersionResult
|
import com.fabledsword.minstrel.update.data.VersionResult
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tiny VM that exposes the [VersionCheckController]'s current
|
|
||||||
* [VersionResult] plus its recheck trigger for the banner button.
|
|
||||||
*/
|
|
||||||
@HiltViewModel
|
|
||||||
class VersionTooOldViewModel @Inject constructor(
|
|
||||||
private val controller: VersionCheckController,
|
|
||||||
@Suppress("UnusedPrivateProperty") savedStateHandle: SavedStateHandle,
|
|
||||||
) : ViewModel() {
|
|
||||||
val result: StateFlow<VersionResult> = controller.result
|
|
||||||
fun recheck() = controller.recheck()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shell-level banner shown when the server reports `min_client_version`
|
* Shell-level banner shown when the server reports `min_client_version`
|
||||||
|
|||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
package com.fabledsword.minstrel.update.ui
|
||||||
|
|
||||||
|
import androidx.lifecycle.SavedStateHandle
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
import com.fabledsword.minstrel.update.data.VersionCheckController
|
||||||
|
import com.fabledsword.minstrel.update.data.VersionResult
|
||||||
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tiny VM that exposes the [VersionCheckController]'s current
|
||||||
|
* [VersionResult] plus its recheck trigger for the banner button.
|
||||||
|
*/
|
||||||
|
@HiltViewModel
|
||||||
|
class VersionTooOldViewModel @Inject constructor(
|
||||||
|
private val controller: VersionCheckController,
|
||||||
|
@Suppress("UnusedPrivateProperty") savedStateHandle: SavedStateHandle,
|
||||||
|
) : ViewModel() {
|
||||||
|
val result: StateFlow<VersionResult> = controller.result
|
||||||
|
fun recheck() = controller.recheck()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user