From f8fc8ace8e509c253b3e6798b84cc67f45476bde Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Tue, 5 May 2026 14:10:15 +0200 Subject: [PATCH] fix(perception): detect bottom sheet modals structurally to prevent phantom interactions --- GramAddict/core/perception/screen_identity.py | 4 ++++ GramAddict/core/situational_awareness.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/GramAddict/core/perception/screen_identity.py b/GramAddict/core/perception/screen_identity.py index 0f8f668..385715a 100644 --- a/GramAddict/core/perception/screen_identity.py +++ b/GramAddict/core/perception/screen_identity.py @@ -198,12 +198,16 @@ class ScreenIdentity: "next_button_textview", ) browser_markers = ("ig_browser_text_title", "ig_browser_close_button", "ig_chrome_subsection") + bottom_sheet_markers = ("bottom_sheet_container", "action_sheet_container") if not is_normal_override and any(marker in ids_str for marker in creation_flow_markers): logger.info("🛡️ [ScreenIdentity] Content-creation overlay detected → MODAL") return ScreenType.MODAL if not is_normal_override and any(marker in ids_str for marker in browser_markers): logger.info("🛡️ [ScreenIdentity] In-App Browser detected → MODAL") return ScreenType.MODAL + if not is_normal_override and any(marker in ids_str for marker in bottom_sheet_markers): + logger.info("🛡️ [ScreenIdentity] Bottom Sheet Modal detected → MODAL") + return ScreenType.MODAL # Priority 2: Structural Heuristics (100% Deterministic) if "unified_follow_list_tab_layout" in ids or "follow_list_container" in ids: diff --git a/GramAddict/core/situational_awareness.py b/GramAddict/core/situational_awareness.py index 3627bad..1e125bf 100644 --- a/GramAddict/core/situational_awareness.py +++ b/GramAddict/core/situational_awareness.py @@ -486,6 +486,8 @@ class SituationalAwarenessEngine: "ig_browser_text_title", # In-App Browser Title "ig_browser_close_button", # In-App Browser Close Button "ig_chrome_subsection", # In-App Browser Chrome + "bottom_sheet_container", # Bottom sheet modal (e.g., following options) + "action_sheet_container", # Action sheet modal ) if any( re.search(rf'resource-id="[^"]*{marker}[^"]*"', xml_dump, re.IGNORECASE)