From 296769af4949effde6779e6e98c7d95ff880f38b Mon Sep 17 00:00:00 2001 From: particle-box Date: Mon, 26 Jan 2026 13:37:27 +0530 Subject: [PATCH] redesign: PurrAura Indicator(thanks to RSR) --- ...otlin-compiler-18191923325565558990.salive | 0 common/src/main/assets/lang/bn.json | 4 + common/src/main/assets/lang/da.json | 4 + common/src/main/assets/lang/de_DE.json | 4 + common/src/main/assets/lang/en_UK.json | 4 + common/src/main/assets/lang/en_US.json | 4 + common/src/main/assets/lang/es_ES.json | 4 + common/src/main/assets/lang/fi.json | 4 + common/src/main/assets/lang/fr_FR.json | 4 + common/src/main/assets/lang/hi_IN.json | 4 + common/src/main/assets/lang/hu_HU.json | 4 + common/src/main/assets/lang/id.json | 4 + common/src/main/assets/lang/it_IT.json | 4 + common/src/main/assets/lang/ja_JP.json | 4 + common/src/main/assets/lang/ko_KR.json | 4 + common/src/main/assets/lang/ku_KU.json | 4 + common/src/main/assets/lang/lv_LV.json | 4 + common/src/main/assets/lang/nb_NO.json | 4 + common/src/main/assets/lang/nl.json | 4 + common/src/main/assets/lang/pl.json | 4 + common/src/main/assets/lang/pt.json | 4 + common/src/main/assets/lang/ro.json | 4 + common/src/main/assets/lang/ru.json | 4 + common/src/main/assets/lang/sl_SI.json | 4 + common/src/main/assets/lang/sv.json | 4 + common/src/main/assets/lang/tr_TR.json | 4 + common/src/main/assets/lang/uk_UA.json | 4 + .../src/main/assets/lang/zh_SIMPLIFIED.json | 4 + .../features/impl/global/EndpointsBlocker.kt | 59 +------- .../purrfectsnap/core/ui/InAppOverlay.kt | 134 ++++++++++++++++++ 30 files changed, 243 insertions(+), 58 deletions(-) create mode 100644 .kotlin/sessions/kotlin-compiler-18191923325565558990.salive diff --git a/.kotlin/sessions/kotlin-compiler-18191923325565558990.salive b/.kotlin/sessions/kotlin-compiler-18191923325565558990.salive new file mode 100644 index 00000000..e69de29b diff --git a/common/src/main/assets/lang/bn.json b/common/src/main/assets/lang/bn.json index a29623e0..a3d8718b 100644 --- a/common/src/main/assets/lang/bn.json +++ b/common/src/main/assets/lang/bn.json @@ -148,6 +148,10 @@ "clear_history": "অনুসন্ধানের তথ্য মুছে ফেলুন", "subtitle": "অনুসন্ধান ও পরিচালনা করুন" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "নিষ্ক্রিয়", "disable_state_subtext": "কোন বন্ধু/ কোরোর প্রভাবিত হবে না", diff --git a/common/src/main/assets/lang/da.json b/common/src/main/assets/lang/da.json index 45d5f180..ea73cb92 100644 --- a/common/src/main/assets/lang/da.json +++ b/common/src/main/assets/lang/da.json @@ -148,6 +148,10 @@ "clear_history": "Ryd søgehistorik", "subtitle": "Søg og administrere funktioner" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "Deaktiveret", "disable_state_subtext": "Ingen venner / grupper vil blive påvirket", diff --git a/common/src/main/assets/lang/de_DE.json b/common/src/main/assets/lang/de_DE.json index 48721a0b..05a23cd0 100644 --- a/common/src/main/assets/lang/de_DE.json +++ b/common/src/main/assets/lang/de_DE.json @@ -148,6 +148,10 @@ "clear_history": "Suchverlauf löschen", "subtitle": "Funktionen suchen und verwalten" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "Behinderte", "disable_state_subtext": "Keine Freunde / Gruppen betroffen", diff --git a/common/src/main/assets/lang/en_UK.json b/common/src/main/assets/lang/en_UK.json index 105013e3..5f878421 100644 --- a/common/src/main/assets/lang/en_UK.json +++ b/common/src/main/assets/lang/en_UK.json @@ -148,6 +148,10 @@ "clear_history": "Clear search history", "subtitle": "Search and manage features" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "Disabled", "disable_state_subtext": "No friends/groups will be affected", diff --git a/common/src/main/assets/lang/en_US.json b/common/src/main/assets/lang/en_US.json index 679539fc..929febf9 100644 --- a/common/src/main/assets/lang/en_US.json +++ b/common/src/main/assets/lang/en_US.json @@ -148,6 +148,10 @@ "clear_history": "Clear search history", "subtitle": "Search and manage features" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "Disabled", "disable_state_subtext": "No friends/groups will be affected", diff --git a/common/src/main/assets/lang/es_ES.json b/common/src/main/assets/lang/es_ES.json index 16343f82..02c95901 100644 --- a/common/src/main/assets/lang/es_ES.json +++ b/common/src/main/assets/lang/es_ES.json @@ -148,6 +148,10 @@ "clear_history": "Historial de búsqueda clara", "subtitle": "Buscar y gestionar características" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "Discapacitados", "disable_state_subtext": "Ningún amigo/grupos será afectado", diff --git a/common/src/main/assets/lang/fi.json b/common/src/main/assets/lang/fi.json index e1390e46..e364037f 100644 --- a/common/src/main/assets/lang/fi.json +++ b/common/src/main/assets/lang/fi.json @@ -148,6 +148,10 @@ "clear_history": "Tyhjennä hakuhistoria", "subtitle": "Etsi ja hallitse ominaisuuksia" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "Ei käytössä", "disable_state_subtext": "Ystäviä tai ryhmiä ei muuteta", diff --git a/common/src/main/assets/lang/fr_FR.json b/common/src/main/assets/lang/fr_FR.json index 7c15f838..4d4adafa 100644 --- a/common/src/main/assets/lang/fr_FR.json +++ b/common/src/main/assets/lang/fr_FR.json @@ -148,6 +148,10 @@ "clear_history": "Effacer l'historique de la recherche", "subtitle": "Recherche et gestion des fonctionnalités" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "Handicapés", "disable_state_subtext": "Aucun ami/groupe ne sera affecté", diff --git a/common/src/main/assets/lang/hi_IN.json b/common/src/main/assets/lang/hi_IN.json index 99a975ee..7b0d1155 100644 --- a/common/src/main/assets/lang/hi_IN.json +++ b/common/src/main/assets/lang/hi_IN.json @@ -148,6 +148,10 @@ "clear_history": "खोज इतिहास साफ़ करें", "subtitle": "सुविधाओं को खोजें और प्रबंधित करें" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "विकलांग", "disable_state_subtext": "कोई मित्र/समूह प्रभावित नहीं होंगे", diff --git a/common/src/main/assets/lang/hu_HU.json b/common/src/main/assets/lang/hu_HU.json index 51a56235..cecb1d5b 100644 --- a/common/src/main/assets/lang/hu_HU.json +++ b/common/src/main/assets/lang/hu_HU.json @@ -148,6 +148,10 @@ "clear_history": "A keresési előzmények törlése", "subtitle": "Keresési és kezelési funkciók" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "Fogyatékos", "disable_state_subtext": "Nem lesz hatással a barátok / csoportok", diff --git a/common/src/main/assets/lang/id.json b/common/src/main/assets/lang/id.json index 25c38b85..24b40853 100644 --- a/common/src/main/assets/lang/id.json +++ b/common/src/main/assets/lang/id.json @@ -148,6 +148,10 @@ "clear_history": "Bersihkan riwayat pencarian", "subtitle": "Cari dan kelola fitur" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "Dinonaktifkan", "disable_state_subtext": "Tidak ada teman / kelompok yang akan terpengaruh", diff --git a/common/src/main/assets/lang/it_IT.json b/common/src/main/assets/lang/it_IT.json index bd2494c3..e8e4ab35 100644 --- a/common/src/main/assets/lang/it_IT.json +++ b/common/src/main/assets/lang/it_IT.json @@ -148,6 +148,10 @@ "clear_history": "Cancella la cronologia di ricerca", "subtitle": "Ricerca e gestione delle funzionalità" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "Disabili", "disable_state_subtext": "Nessun amico/gruppo sarà interessato", diff --git a/common/src/main/assets/lang/ja_JP.json b/common/src/main/assets/lang/ja_JP.json index bcf7b81a..d82342b2 100644 --- a/common/src/main/assets/lang/ja_JP.json +++ b/common/src/main/assets/lang/ja_JP.json @@ -148,6 +148,10 @@ "clear_history": "明確な検索履歴", "subtitle": "機能の検索と管理" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "バリアフリー", "disable_state_subtext": "友だち/グループが影響しません", diff --git a/common/src/main/assets/lang/ko_KR.json b/common/src/main/assets/lang/ko_KR.json index 2f7a3cfd..ac7be7a4 100644 --- a/common/src/main/assets/lang/ko_KR.json +++ b/common/src/main/assets/lang/ko_KR.json @@ -148,6 +148,10 @@ "clear_history": "자주 묻는 질문", "subtitle": "검색 및 관리 기능" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "지원하다", "disable_state_subtext": "친구 / 그룹은 영향을받지 않습니다", diff --git a/common/src/main/assets/lang/ku_KU.json b/common/src/main/assets/lang/ku_KU.json index 700b42db..81c7ed50 100644 --- a/common/src/main/assets/lang/ku_KU.json +++ b/common/src/main/assets/lang/ku_KU.json @@ -148,6 +148,10 @@ "clear_history": "پاککردنەوەی مێژووی گەڕان", "subtitle": "گەڕان و بەڕێوەبردنی تایبەتمەندییەکان" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "ناچالاک کراوە", "disable_state_subtext": "هیچ هاوڕێ/گرووپێک کاریگەر نابێت", diff --git a/common/src/main/assets/lang/lv_LV.json b/common/src/main/assets/lang/lv_LV.json index 25cc0874..c03456f0 100644 --- a/common/src/main/assets/lang/lv_LV.json +++ b/common/src/main/assets/lang/lv_LV.json @@ -148,6 +148,10 @@ "clear_history": "Tīrīt meklēšanas vēsturi", "subtitle": "Meklēt un pārvaldīt funkcijas" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "Atslēgts", "disable_state_subtext": "Nekādi draugi/grupas netiks ietekmēti", diff --git a/common/src/main/assets/lang/nb_NO.json b/common/src/main/assets/lang/nb_NO.json index 3e9c8faa..ecc33e79 100644 --- a/common/src/main/assets/lang/nb_NO.json +++ b/common/src/main/assets/lang/nb_NO.json @@ -148,6 +148,10 @@ "clear_history": "Tøm søkehistorikken", "subtitle": "Søk og administrere funksjoner" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "Deaktivert", "disable_state_subtext": "Ingen venner/grupper vil bli berørt", diff --git a/common/src/main/assets/lang/nl.json b/common/src/main/assets/lang/nl.json index 0d5f2ba8..d2de7170 100644 --- a/common/src/main/assets/lang/nl.json +++ b/common/src/main/assets/lang/nl.json @@ -148,6 +148,10 @@ "clear_history": "Zoekgeschiedenis wissen", "subtitle": "Functies zoeken en beheren" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "Uitgeschakeld", "disable_state_subtext": "Geen vrienden/groepen worden beïnvloed", diff --git a/common/src/main/assets/lang/pl.json b/common/src/main/assets/lang/pl.json index d77cd639..07da172a 100644 --- a/common/src/main/assets/lang/pl.json +++ b/common/src/main/assets/lang/pl.json @@ -148,6 +148,10 @@ "clear_history": "Wyczyść historię wyszukiwania", "subtitle": "Funkcja wyszukiwania i zarządzania" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "Wyłączone", "disable_state_subtext": "Nie wpłynie to na przyjaciół / grupy", diff --git a/common/src/main/assets/lang/pt.json b/common/src/main/assets/lang/pt.json index b3095b21..725c60e2 100644 --- a/common/src/main/assets/lang/pt.json +++ b/common/src/main/assets/lang/pt.json @@ -148,6 +148,10 @@ "clear_history": "Limpar o histórico de pesquisa", "subtitle": "Procurar e gerenciar recursos" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "Desactivado", "disable_state_subtext": "Nenhum amigo/grupo será afetado", diff --git a/common/src/main/assets/lang/ro.json b/common/src/main/assets/lang/ro.json index 5f3b7b44..58906302 100644 --- a/common/src/main/assets/lang/ro.json +++ b/common/src/main/assets/lang/ro.json @@ -148,6 +148,10 @@ "clear_history": "Șterge istoricul căutării", "subtitle": "Caută și gestionează caracteristicile" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "Dezactivat", "disable_state_subtext": "Niciun prieten/grup nu va fi afectat", diff --git a/common/src/main/assets/lang/ru.json b/common/src/main/assets/lang/ru.json index 856af8cf..df3dc481 100644 --- a/common/src/main/assets/lang/ru.json +++ b/common/src/main/assets/lang/ru.json @@ -148,6 +148,10 @@ "clear_history": "Ясная история поиска", "subtitle": "Поиск и управление функциями" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "Инвалид", "disable_state_subtext": "Друзья/группы не будут затронуты", diff --git a/common/src/main/assets/lang/sl_SI.json b/common/src/main/assets/lang/sl_SI.json index 59ceaf57..1945702f 100644 --- a/common/src/main/assets/lang/sl_SI.json +++ b/common/src/main/assets/lang/sl_SI.json @@ -148,6 +148,10 @@ "clear_history": "Počisti zgodovino iskanja", "subtitle": "Iskanje in upravljanje funkcij" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "Onemogočeno", "disable_state_subtext": "Na prijatelje/skupine ne bo vpliva", diff --git a/common/src/main/assets/lang/sv.json b/common/src/main/assets/lang/sv.json index a1f8dbdd..4d99c8db 100644 --- a/common/src/main/assets/lang/sv.json +++ b/common/src/main/assets/lang/sv.json @@ -148,6 +148,10 @@ "clear_history": "Tydlig sökhistoria", "subtitle": "Sök och hantera funktioner" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "Inaktiverad", "disable_state_subtext": "Inga vänner/grupper kommer att påverkas", diff --git a/common/src/main/assets/lang/tr_TR.json b/common/src/main/assets/lang/tr_TR.json index dd723f11..a376dec4 100644 --- a/common/src/main/assets/lang/tr_TR.json +++ b/common/src/main/assets/lang/tr_TR.json @@ -148,6 +148,10 @@ "clear_history": "Arama geçmişini temizle", "subtitle": "Özellikleri ara ve yönet" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "Devre Dışı", "disable_state_subtext": "Hiçbir arkadaş/grup etkilenmeyecek", diff --git a/common/src/main/assets/lang/uk_UA.json b/common/src/main/assets/lang/uk_UA.json index bdffda08..d7a2e6d2 100644 --- a/common/src/main/assets/lang/uk_UA.json +++ b/common/src/main/assets/lang/uk_UA.json @@ -148,6 +148,10 @@ "clear_history": "Історія пошуку", "subtitle": "Пошук і управління функціями" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "Вимкнено", "disable_state_subtext": "Ніяких друзів/груп", diff --git a/common/src/main/assets/lang/zh_SIMPLIFIED.json b/common/src/main/assets/lang/zh_SIMPLIFIED.json index 61290e35..c55b3c3f 100644 --- a/common/src/main/assets/lang/zh_SIMPLIFIED.json +++ b/common/src/main/assets/lang/zh_SIMPLIFIED.json @@ -148,6 +148,10 @@ "clear_history": "清除搜索历史", "subtitle": "搜索和管理特性" }, + "bypass_status": { + "active": "PurrAura Active", + "inactive": "PurrAura Inactive" + }, "manage_rule_feature": { "disable_state_option": "已禁用", "disable_state_subtext": "没有朋友或团体受到影响", diff --git a/core/src/main/kotlin/me/eternal/purrfectsnap/core/features/impl/global/EndpointsBlocker.kt b/core/src/main/kotlin/me/eternal/purrfectsnap/core/features/impl/global/EndpointsBlocker.kt index 664e5597..61cff34e 100644 --- a/core/src/main/kotlin/me/eternal/purrfectsnap/core/features/impl/global/EndpointsBlocker.kt +++ b/core/src/main/kotlin/me/eternal/purrfectsnap/core/features/impl/global/EndpointsBlocker.kt @@ -1,24 +1,8 @@ package me.eternal.purrfectsnap.core.features.impl.global -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.* -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.Check -import androidx.compose.material.icons.filled.Close -import androidx.compose.material3.Icon -import androidx.compose.material3.Text -import androidx.compose.runtime.* -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp -import kotlinx.coroutines.delay import me.eternal.purrfectsnap.core.features.Feature import me.eternal.purrfectsnap.core.event.events.impl.NetworkApiRequestEvent import me.eternal.purrfectsnap.core.event.events.impl.UnaryCallEvent -import me.eternal.purrfectsnap.core.ui.CustomComposable import me.eternal.purrfectsnap.core.util.dataBuilder import me.eternal.purrfectsnap.core.util.hook.HookStage import me.eternal.purrfectsnap.core.util.hook.hook @@ -32,47 +16,6 @@ class EndpointsBlocker : Feature("EndpointsBlocker") { @Volatile private var isInLoginSignup = false - private fun showBypassStatusIndicator(isWorking: Boolean) { - if (context.bridgeClient.getDebugProp("disable_bypass_indicator", "false") == "true") { - return - } - - lateinit var composable: CustomComposable - composable = { - Row( - modifier = Modifier - .padding(16.dp) - .align(Alignment.TopCenter) - .background( - color = Color.Black.copy(alpha = 0.8f), - shape = RoundedCornerShape(8.dp) - ) - .padding(horizontal = 12.dp, vertical = 8.dp), - verticalAlignment = Alignment.CenterVertically - ) { - Icon( - imageVector = if (isWorking) Icons.Filled.Check else Icons.Filled.Close, - contentDescription = null, - tint = if (isWorking) Color.Green else Color.Red, - modifier = Modifier.size(16.dp) - ) - Spacer(modifier = Modifier.width(8.dp)) - Text( - text = "PurrAura", - color = Color.White, - fontSize = 14.sp - ) - } - - LaunchedEffect(Unit) { - delay(3000) - context.inAppOverlay.removeCustomComposable(composable) - } - } - - context.inAppOverlay.addCustomComposable(composable) - } - override fun init() { val bypassToggleEnabled = context.bridgeClient.getDebugProp("test_mode", "false") == "true" @@ -101,7 +44,7 @@ class EndpointsBlocker : Feature("EndpointsBlocker") { context.log.warn("EndpointsBlocker: native self-test failed, indicator set to inactive") context.log.warn("EndpointsBlocker: Possible causes - config not loaded or self-test logic failed") } - showBypassStatusIndicator(healthy) + context.inAppOverlay.showBypassStatusIndicator(healthy) } else { context.native.setTestMode(false) } diff --git a/core/src/main/kotlin/me/eternal/purrfectsnap/core/ui/InAppOverlay.kt b/core/src/main/kotlin/me/eternal/purrfectsnap/core/ui/InAppOverlay.kt index 1ef99705..fc6f274b 100644 --- a/core/src/main/kotlin/me/eternal/purrfectsnap/core/ui/InAppOverlay.kt +++ b/core/src/main/kotlin/me/eternal/purrfectsnap/core/ui/InAppOverlay.kt @@ -6,6 +6,7 @@ import android.widget.FrameLayout import androidx.compose.animation.core.Animatable import androidx.compose.animation.core.LinearEasing import androidx.compose.animation.core.animateFloatAsState +import androidx.compose.animation.core.spring import androidx.compose.animation.core.tween import androidx.compose.animation.rememberSplineBasedDecay import androidx.compose.foundation.BorderStroke @@ -20,6 +21,8 @@ import androidx.compose.foundation.gestures.anchoredDraggable import androidx.compose.foundation.layout.* import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Check +import androidx.compose.material.icons.filled.Close import androidx.compose.material.icons.outlined.Warning import androidx.compose.material3.* import androidx.compose.runtime.* @@ -33,6 +36,7 @@ import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.dp @@ -378,4 +382,134 @@ class InAppOverlay( durationMs = durationMs )) } + + private enum class BypassAnimation { SLIDE_DOWN, ZOOM_IN } + + fun showBypassStatusIndicator(isWorking: Boolean) { + if (context.bridgeClient.getDebugProp("disable_bypass_indicator", "false") == "true") { + return + } + + val animationType = BypassAnimation.entries.random() + + lateinit var composable: CustomComposable + composable = { + var visible by remember { mutableStateOf(false) } + + LaunchedEffect(Unit) { + visible = true + delay(3000) + visible = false + delay(400) + context.inAppOverlay.removeCustomComposable(composable) + } + + val progress by animateFloatAsState( + targetValue = if (visible) 1f else 0f, + animationSpec = spring( + dampingRatio = 0.7f, + stiffness = 70f + ), + label = "progress" + ) + + val (offsetX, offsetY, scale) = when (animationType) { + BypassAnimation.SLIDE_DOWN -> Triple(0f, -80f * (1f - progress), 1f) + BypassAnimation.ZOOM_IN -> Triple(0f, 0f, progress) + } + + Box( + modifier = Modifier + .align(Alignment.TopCenter) + .padding(top = 16.dp) + .graphicsLayer { + translationX = offsetX + translationY = offsetY + scaleX = scale + scaleY = scale + alpha = progress + } + ) { + // Use PurrfectSnap UI colors - gradient for active, red tint for inactive + val backgroundColor = if (isWorking) { + Brush.linearGradient( + listOf( + PurrfectOverlayPalette.glowPrimary.copy(alpha = 0.85f), + PurrfectOverlayPalette.glowSecondary.copy(alpha = 0.75f) + ) + ) + } else { + Brush.linearGradient( + listOf( + Color(0xFFB71C1C).copy(alpha = 0.85f), + Color(0xFFD32F2F).copy(alpha = 0.75f) + ) + ) + } + + val shape = RoundedCornerShape(24.dp) + Surface( + modifier = Modifier + .shadow( + elevation = 12.dp, + shape = shape, + spotColor = if (isWorking) PurrfectOverlayPalette.glowPrimary.copy(alpha = 0.3f) else Color(0xFFB71C1C).copy(alpha = 0.25f), + ambientColor = if (isWorking) PurrfectOverlayPalette.glowSecondary.copy(alpha = 0.2f) else Color(0xFFD32F2F).copy(alpha = 0.18f) + ) + .clip(shape) + .background(backgroundColor, shape) + .border( + BorderStroke( + 1.dp, + if (isWorking) { + Brush.linearGradient( + listOf( + PurrfectOverlayPalette.glowPrimary.copy(alpha = 0.7f), + PurrfectOverlayPalette.glowSecondary.copy(alpha = 0.6f) + ) + ) + } else { + Brush.linearGradient( + listOf( + Color(0xFFB71C1C).copy(alpha = 0.7f), + Color(0xFFD32F2F).copy(alpha = 0.6f) + ) + ) + } + ), + shape + ), + color = Color.Transparent, + tonalElevation = 0.dp, + shadowElevation = 0.dp + ) { + Row( + modifier = Modifier.padding(horizontal = 16.dp, vertical = 10.dp), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(8.dp) + ) { + Icon( + imageVector = if (isWorking) Icons.Filled.Check else Icons.Filled.Close, + contentDescription = null, + tint = Color.White, + modifier = Modifier.size(18.dp) + ) + + Text( + text = if (isWorking) + context.translation.getOrNull("manager.sections.bypass_status.active") ?: "Bypass Active" + else + context.translation.getOrNull("manager.sections.bypass_status.inactive") ?: "Bypass Inactive", + color = Color.White, + fontSize = 14.sp, + fontWeight = FontWeight.Medium + ) + } + } + } + } + + context.mainActivity?.let { injectOverlay(it) } + customComposables.add(composable) + } }