Skip to content

Commit

Permalink
app: Remove duplicate haptics
Browse files Browse the repository at this point in the history
  • Loading branch information
YuKongA committed Oct 28, 2024
1 parent e2abf23 commit 9a03cda
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
7 changes: 1 addition & 6 deletions composeApp/src/commonMain/kotlin/ui/AboutDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.SpanStyle
Expand All @@ -49,13 +47,10 @@ import updater.composeapp.generated.resources.view_source
fun AboutDialog() {
val showDialog = remember { mutableStateOf(false) }

val hapticFeedback = LocalHapticFeedback.current

IconButton(
modifier = Modifier.padding(start = 15.dp),
modifier = Modifier.padding(start = 18.dp),
onClick = {
showDialog.value = true
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
}) {
Icon(
imageVector = Icons.Rounded.Update,
Expand Down
10 changes: 0 additions & 10 deletions composeApp/src/commonMain/kotlin/ui/LoginDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation
Expand Down Expand Up @@ -71,8 +70,6 @@ fun LoginDialog(
var savePassword by remember { mutableStateOf(perfGet("savePassword") ?: "0") }
val showDialog = remember { mutableStateOf(false) }

val hapticFeedback = LocalHapticFeedback.current

val icon = when (isLogin.value) {
1 -> Icons.AutoMirrored.Rounded.Logout
else -> Icons.AutoMirrored.Rounded.Login
Expand All @@ -89,7 +86,6 @@ fun LoginDialog(
IconButton(
onClick = {
showDialog.value = true
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
}
) {
Icon(
Expand Down Expand Up @@ -153,7 +149,6 @@ fun LoginDialog(
checked = global,
onCheckedChange = {
global = it
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
}
)
}
Expand All @@ -166,7 +161,6 @@ fun LoginDialog(
checked = savePassword == "1",
onCheckedChange = {
savePassword = if (it) "1" else "0"
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
}
)
}
Expand All @@ -179,7 +173,6 @@ fun LoginDialog(
onClick = {
dismissDialog(showDialog)
showMessage(message = messageLoginIn)
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
coroutineScope.launch {
val int = login(account, password, global, savePassword, isLogin)
when (int) {
Expand All @@ -198,7 +191,6 @@ fun LoginDialog(
text = stringResource(Res.string.cancel),
onClick = {
dismissDialog(showDialog)
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
}
)
}
Expand Down Expand Up @@ -226,7 +218,6 @@ fun LoginDialog(
if (boolean) showMessage(message = messageLogoutSuccessful)
}
dismissDialog(showDialog)
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
}
)
Spacer(Modifier.width(20.dp))
Expand All @@ -235,7 +226,6 @@ fun LoginDialog(
text = stringResource(Res.string.cancel),
onClick = {
dismissDialog(showDialog)
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
}
)
}
Expand Down

0 comments on commit 9a03cda

Please sign in to comment.