From 279a4bf802d14f83e2785246c6ed43ca9b2d85d6 Mon Sep 17 00:00:00 2001 From: Thiflict <121az348@gmail.com> Date: Thu, 16 Apr 2026 00:09:03 +0500 Subject: [PATCH] =?UTF-8?q?#1:=20TODO:=20=D0=94=D0=BE=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B0=D1=82=D1=8C=20=D0=BE=D1=82=D0=BC=D0=BE=D0=BD=D1=82=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20Samba?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/Main.kt | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt index a38f3bd..570549a 100644 --- a/src/main/kotlin/Main.kt +++ b/src/main/kotlin/Main.kt @@ -167,8 +167,8 @@ class USBVirusScanner { } SystemState.SAMBA -> { - blinkLed(greenLed, 1000) - blinkLed(yellowLed, 1000) + blinkLed(greenLed, 200) + blinkLed(yellowLed, 200) redLed.setValue(0) } } @@ -228,6 +228,7 @@ class USBVirusScanner { if (result.infectedFiles.size > 10) { println(if (isDebug) " ... и ещё ${result.infectedFiles.size - 10} файлов" else "") } + unmount() } else if (result.error != null) { println(if (isDebug) "❌ Ошибка сканирования: ${result.error}" else "") } else { @@ -259,7 +260,16 @@ class USBVirusScanner { currentState = SystemState.SAMBA sambaStartSharing() - while (isUsbSharing()) {} + val buttonListener = ButtonListener() + var isEventHappened = false + + buttonListener.addLongPressListener { event -> + isEventHappened = true + } + buttonListener.startListening() + while (!isEventHappened) { + delay(500.milliseconds) + } } currentState = SystemState.IDLE @@ -453,12 +463,6 @@ class USBVirusScanner { } } - fun isUsbSharing(isActive: Boolean): Boolean { - var defaultState: Boolean = false - defaultState = isActive - return defaultState - } - suspend fun sambaStartSharing() { try { currentState = SystemState.SAMBA