Skip to content

Commit f15af61

Browse files
committed
chore: replace sentinel monitor showcase GIF
1 parent e44d90f commit f15af61

6 files changed

Lines changed: 17 additions & 13 deletions

File tree

.github/art/Sentinel-Monitor.gif

14.8 MB
Loading

.github/art/Sentinel-Monitor.mov

12.8 MB
Binary file not shown.

.github/art/sentinel-monitor.gif

-3.98 MB
Binary file not shown.

.github/art/sentinel-monitor.mov

-7.03 MB
Binary file not shown.

sentinel-ui/src/commonMain/kotlin/sentinel/ui/screen/scan/SentinelScanScreen.kt

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ internal fun SentinelScanScreen(
5757
}
5858
}
5959

60-
fun updateDetectionsFromReport(currentReport: SecurityReport?) {
61-
currentReport ?: return
60+
fun updateDetectionsFromReport(report: SecurityReport?) {
61+
report ?: return
6262

6363
scanDetectionResults.clear()
6464

65-
if (currentReport.isCompromised) {
65+
if (report.isCompromised) {
6666
addDetectionIfNotExist(
67-
type = if (currentReport.isRooted) {
67+
type = if (report.isRooted) {
6868
ScanDetectionType.ROOT
6969
} else {
7070
ScanDetectionType.JAILBREAK
@@ -73,23 +73,23 @@ internal fun SentinelScanScreen(
7373
)
7474
}
7575

76-
if (currentReport.isTampered) {
76+
if (report.isTampered) {
7777
addDetectionIfNotExist(
7878
type = ScanDetectionType.TAMPER,
7979
position = Offset(0.4f, 145f)
8080
)
8181
}
8282

83-
if (currentReport.isHooked) {
83+
if (report.isHooked) {
8484
addDetectionIfNotExist(
8585
type = ScanDetectionType.HOOK,
8686
position = Offset(1.75f, 250f)
8787
)
8888
}
8989

90-
if (currentReport.isEmulator || currentReport.isSimulator) {
90+
if (report.isEmulator || report.isSimulator) {
9191
addDetectionIfNotExist(
92-
type = if (currentReport.isEmulator) {
92+
type = if (report.isEmulator) {
9393
ScanDetectionType.EMULATOR
9494
} else {
9595
ScanDetectionType.SIMULATOR
@@ -98,7 +98,7 @@ internal fun SentinelScanScreen(
9898
)
9999
}
100100

101-
if (currentReport.isDebugged) {
101+
if (report.isDebugged) {
102102
addDetectionIfNotExist(
103103
type = ScanDetectionType.DEBUGGER,
104104
position = Offset(3.0f, 275f)
@@ -108,7 +108,7 @@ internal fun SentinelScanScreen(
108108

109109
val refreshReport: suspend () -> Unit = {
110110
report = sentinel.inspect()
111-
updateDetectionsFromReport(report)
111+
updateDetectionsFromReport(report = report)
112112
}
113113

114114
LaunchedEffect(Unit) {
@@ -210,6 +210,7 @@ internal fun SentinelScanScreen(
210210

211211
SentinelScanEffectIndicator(
212212
results = scanDetectionResults,
213+
riskLevel = report?.riskLevel,
213214
showResults = showResults
214215
)
215216
}

sentinel-ui/src/commonMain/kotlin/sentinel/ui/screen/scan/composable/SentinelScanEffectIndicator.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,17 @@ import androidx.compose.runtime.mutableStateOf
2121
import androidx.compose.runtime.remember
2222
import androidx.compose.ui.Alignment
2323
import androidx.compose.ui.Modifier
24-
import androidx.compose.ui.graphics.Color
2524
import androidx.compose.ui.graphics.graphicsLayer
2625
import androidx.compose.ui.layout.onSizeChanged
2726
import androidx.compose.ui.platform.LocalDensity
2827
import androidx.compose.ui.unit.IntSize
2928
import androidx.compose.ui.unit.dp
3029
import kotlinx.coroutines.delay
3130
import kotlinx.coroutines.launch
31+
import sentinel.core.type.RiskLevel
3232
import sentinel.ui.component.SentinelCard
3333
import sentinel.ui.component.SentinelChip
34+
import sentinel.ui.ext.getWaveColor
3435
import sentinel.ui.screen.scan.model.ScanDetectionResult
3536
import kotlin.math.PI
3637
import kotlin.math.cos
@@ -39,6 +40,7 @@ import kotlin.math.sin
3940
@Composable
4041
internal fun SentinelScanEffectIndicator(
4142
modifier: Modifier = Modifier,
43+
riskLevel: RiskLevel?,
4244
results: List<ScanDetectionResult>,
4345
showResults: Boolean = false,
4446
rippleCount: Int = 6,
@@ -68,7 +70,7 @@ internal fun SentinelScanEffectIndicator(
6870
val scale = remember { Animatable(0f) }
6971
val alphaAnim = remember { Animatable(0f) }
7072

71-
LaunchedEffect(showResults) {
73+
LaunchedEffect(result.type) {
7274
delay(timeMillis = (100..300).random().toLong())
7375

7476
launch {
@@ -80,6 +82,7 @@ internal fun SentinelScanEffectIndicator(
8082
)
8183
)
8284
}
85+
8386
launch {
8487
alphaAnim.animateTo(
8588
targetValue = 1f,
@@ -119,7 +122,7 @@ internal fun SentinelScanEffectIndicator(
119122
modifier = Modifier
120123
.size(size = 8.dp)
121124
.background(
122-
color = Color.Red.copy(alpha = 0.3f),
125+
color = riskLevel.getWaveColor().copy(alpha = 0.3f),
123126
shape = CircleShape
124127
)
125128
)

0 commit comments

Comments
 (0)