mirror of
https://github.com/bitwarden/android.git
synced 2026-04-28 20:08:27 -05:00
PM-23293: Remove unused Toast events from the app (#5463)
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.bitwarden.authenticator.ui.auth.unlock
|
||||
|
||||
import android.widget.Toast
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
@@ -21,7 +20,6 @@ import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -51,18 +49,11 @@ fun UnlockScreen(
|
||||
biometricsManager: BiometricsManager = LocalBiometricsManager.current,
|
||||
onUnlocked: () -> Unit,
|
||||
) {
|
||||
|
||||
val state by viewModel.stateFlow.collectAsStateWithLifecycle()
|
||||
val context = LocalContext.current
|
||||
val resources = context.resources
|
||||
var showBiometricsPrompt by remember { mutableStateOf(true) }
|
||||
|
||||
EventsEffect(viewModel = viewModel) { event ->
|
||||
when (event) {
|
||||
is UnlockEvent.ShowToast -> {
|
||||
Toast.makeText(context, event.message(resources), Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
UnlockEvent.NavigateToItemListing -> onUnlocked()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,13 +118,6 @@ sealed class UnlockEvent {
|
||||
* Navigates to the item listing screen.
|
||||
*/
|
||||
data object NavigateToItemListing : UnlockEvent()
|
||||
|
||||
/**
|
||||
* Displays a toast to the user.
|
||||
*/
|
||||
data class ShowToast(
|
||||
val message: Text,
|
||||
) : UnlockEvent()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.bitwarden.authenticator.ui.authenticator.feature.qrcodescan
|
||||
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
|
||||
import android.widget.Toast
|
||||
import androidx.camera.core.CameraSelector
|
||||
import androidx.camera.core.ImageAnalysis
|
||||
import androidx.camera.core.Preview
|
||||
@@ -90,15 +89,8 @@ fun QrCodeScanScreen(
|
||||
{ viewModel.trySendAction(QrCodeScanAction.ManualEntryTextClick) }
|
||||
}
|
||||
val state by viewModel.stateFlow.collectAsStateWithLifecycle()
|
||||
val context = LocalContext.current
|
||||
EventsEffect(viewModel = viewModel) { event ->
|
||||
when (event) {
|
||||
is QrCodeScanEvent.ShowToast -> {
|
||||
Toast
|
||||
.makeText(context, event.message.invoke(context.resources), Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
|
||||
is QrCodeScanEvent.NavigateBack -> {
|
||||
onNavigateBack.invoke()
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import com.bitwarden.authenticator.ui.platform.feature.settings.data.model.Defau
|
||||
import com.bitwarden.authenticatorbridge.manager.AuthenticatorBridgeManager
|
||||
import com.bitwarden.ui.platform.base.BaseViewModel
|
||||
import com.bitwarden.ui.platform.base.util.isBase32
|
||||
import com.bitwarden.ui.util.Text
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import kotlinx.coroutines.flow.update
|
||||
import kotlinx.parcelize.Parcelize
|
||||
@@ -256,11 +255,6 @@ sealed class QrCodeScanEvent {
|
||||
* Navigate to manual code entry screen.
|
||||
*/
|
||||
data object NavigateToManualCodeEntry : QrCodeScanEvent()
|
||||
|
||||
/**
|
||||
* Show a toast with the given [message].
|
||||
*/
|
||||
data class ShowToast(val message: Text) : QrCodeScanEvent()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user