Skip to content

Commit

Permalink
Try to fix CI Failed
Browse files Browse the repository at this point in the history
[Added system version check to clickFeedback]
  • Loading branch information
Z-Siqi committed Nov 21, 2024
1 parent 3df45bc commit 1f3b729
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.sqz.checklist.ui.main.backup
import android.content.Context
import android.media.AudioManager
import android.net.Uri
import android.os.Build
import android.os.VibrationEffect
import android.os.Vibrator
import android.util.Log
Expand Down Expand Up @@ -242,9 +243,11 @@ private fun TitleText(text: String, modifier: Modifier = Modifier) = Text(
)

private fun clickFeedback(view: View, audioManager: AudioManager) {
if (audioManager.ringerMode == AudioManager.RINGER_MODE_VIBRATE) {
val vibrate = view.context?.let { getSystemService(it, Vibrator::class.java) }
vibrate?.vibrate(VibrationEffect.createPredefined(VibrationEffect.EFFECT_TICK))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
if (audioManager.ringerMode == AudioManager.RINGER_MODE_VIBRATE) {
val vibrate = view.context?.let { getSystemService(it, Vibrator::class.java) }
vibrate?.vibrate(VibrationEffect.createPredefined(VibrationEffect.EFFECT_TICK))
} else view.playSoundEffect(SoundEffectConstants.CLICK)
} else {
view.playSoundEffect(SoundEffectConstants.CLICK)
}
Expand Down

0 comments on commit 1f3b729

Please sign in to comment.