fix(ui): open sync-setup modal when Connect clicked from Settings
Android Release / build-apk (push) Successful in 3m49s
Android Release / build-apk (push) Successful in 3m49s
The sync-setup modal was silently blocked by its own guard: other_modal_scrims checks for any ModalScrim without SyncSetupScreen, but the Settings panel IS a ModalScrim, so clicking Connect from within Settings always hit the guard and returned early. Two fixes: - handle_sync_buttons: set SettingsScreen.0 = false when ConnectSync is pressed so settings closes as the event is fired - open_sync_setup_modal: exclude SettingsPanel from other_modal_scrims to handle the deferred-despawn timing window (settings scrim entity still exists in the world until command buffers flush at frame end) - Make SettingsPanel pub so sync_setup_plugin can reference it Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -52,7 +52,7 @@ use crate::events::{
|
||||
SyncLogoutRequestEvent,
|
||||
};
|
||||
use crate::font_plugin::FontResource;
|
||||
use crate::settings_plugin::{SettingsResource, SettingsScreen, SettingsStoragePath};
|
||||
use crate::settings_plugin::{SettingsPanel, SettingsResource, SettingsScreen, SettingsStoragePath};
|
||||
use crate::resources::TokioRuntimeResource;
|
||||
use crate::sync_plugin::SyncProviderResource;
|
||||
use crate::ui_modal::{spawn_modal, ModalScrim};
|
||||
@@ -205,10 +205,14 @@ impl Plugin for SyncSetupPlugin {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// Opens the sync-setup modal when `SyncConfigureRequestEvent` is received.
|
||||
#[allow(clippy::type_complexity)]
|
||||
fn open_sync_setup_modal(
|
||||
mut events: MessageReader<SyncConfigureRequestEvent>,
|
||||
existing: Query<(), With<SyncSetupScreen>>,
|
||||
other_modal_scrims: Query<(), (With<ModalScrim>, Without<SyncSetupScreen>)>,
|
||||
// Exclude SettingsPanel: the Connect button closes settings in the same
|
||||
// frame it fires SyncConfigureRequestEvent, but Bevy despawns are deferred
|
||||
// so the settings scrim still exists in the world during this system.
|
||||
other_modal_scrims: Query<(), (With<ModalScrim>, Without<SyncSetupScreen>, Without<SettingsPanel>)>,
|
||||
mut commands: Commands,
|
||||
mut focused: ResMut<SyncFocusedField>,
|
||||
font_res: Option<Res<FontResource>>,
|
||||
|
||||
Reference in New Issue
Block a user