Rebrand to Galaxy, major improvements to Bedrock support, still needs some TLC though
This commit is contained in:
+10
-10
@@ -60,8 +60,8 @@ pub const fn toml_path_hierarchy(path: &str) -> Option<&str> {
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use serde::{Serialize, de::DeserializeOwned};
|
||||
use warpui::{AppContext, Entity, ModelContext};
|
||||
use warpui_extras::user_preferences::UserPreferences;
|
||||
use galaxyui::{AppContext, Entity, ModelContext};
|
||||
use galaxyui_extras::user_preferences::UserPreferences;
|
||||
|
||||
/// Whether the TOML-backed settings file is active.
|
||||
///
|
||||
@@ -117,16 +117,16 @@ impl PublicPreferences {
|
||||
}
|
||||
|
||||
/// Reloads the backing store from disk.
|
||||
pub fn reload_from_disk(&self) -> Result<(), warpui_extras::user_preferences::Error> {
|
||||
pub fn reload_from_disk(&self) -> Result<(), galaxyui_extras::user_preferences::Error> {
|
||||
self.0.reload_from_disk()
|
||||
}
|
||||
}
|
||||
|
||||
impl warpui::Entity for PublicPreferences {
|
||||
impl galaxyui::Entity for PublicPreferences {
|
||||
type Event = ();
|
||||
}
|
||||
|
||||
impl warpui::SingletonEntity for PublicPreferences {}
|
||||
impl galaxyui::SingletonEntity for PublicPreferences {}
|
||||
|
||||
/// A newtype wrapper for the private preferences backend.
|
||||
///
|
||||
@@ -150,11 +150,11 @@ impl Deref for PrivatePreferences {
|
||||
}
|
||||
}
|
||||
|
||||
impl warpui::Entity for PrivatePreferences {
|
||||
impl galaxyui::Entity for PrivatePreferences {
|
||||
type Event = ();
|
||||
}
|
||||
|
||||
impl warpui::SingletonEntity for PrivatePreferences {}
|
||||
impl galaxyui::SingletonEntity for PrivatePreferences {}
|
||||
|
||||
/// An enum representing the different platforms a setting could apply to.
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -370,7 +370,7 @@ pub trait Setting {
|
||||
fn set_value_from_cloud_sync(
|
||||
&mut self,
|
||||
new_value: Self::Value,
|
||||
ctx: &mut warpui::ModelContext<Self::Group>,
|
||||
ctx: &mut galaxyui::ModelContext<Self::Group>,
|
||||
) -> anyhow::Result<()>;
|
||||
|
||||
/// Sets the value of the setting persisting it to storage.
|
||||
@@ -386,7 +386,7 @@ pub trait Setting {
|
||||
/// Sets the value of the setting to its default and persists it to storage.
|
||||
fn set_value_to_default(
|
||||
&mut self,
|
||||
ctx: &mut warpui::ModelContext<Self::Group>,
|
||||
ctx: &mut galaxyui::ModelContext<Self::Group>,
|
||||
) -> anyhow::Result<()> {
|
||||
self.set_value(Self::default_value(), ctx)
|
||||
}
|
||||
@@ -396,7 +396,7 @@ pub trait Setting {
|
||||
/// Private settings use the platform-native store; public settings use
|
||||
/// the main preferences backend (which may be the TOML settings file).
|
||||
fn preferences_for_setting(ctx: &AppContext) -> &dyn UserPreferences {
|
||||
use warpui::SingletonEntity;
|
||||
use galaxyui::SingletonEntity;
|
||||
|
||||
if Self::is_private() {
|
||||
<PrivatePreferences as SingletonEntity>::as_ref(ctx).deref()
|
||||
|
||||
@@ -109,11 +109,11 @@
|
||||
//! Once you've defined a setting, usage is straightforward:
|
||||
//!
|
||||
//! ```
|
||||
//! # use warpui::*;
|
||||
//! # use galaxyui::*;
|
||||
//! # use settings::macros::*;
|
||||
//! # use settings::manager::SettingsManager;
|
||||
//! # use settings::*;
|
||||
//! # use warpui_extras::user_preferences;
|
||||
//! # use galaxyui_extras::user_preferences;
|
||||
//! define_settings_group!(ExampleGroup, settings: [
|
||||
//! bool_setting: BoolSetting {
|
||||
//! type: bool,
|
||||
@@ -312,7 +312,7 @@ macro_rules! define_setting {
|
||||
|
||||
fn clear_value(
|
||||
&mut self,
|
||||
ctx: &mut warpui::ModelContext<Self::Group>,
|
||||
ctx: &mut galaxyui::ModelContext<Self::Group>,
|
||||
) -> anyhow::Result<()> {
|
||||
use $crate::ChangeEventReason;
|
||||
Self::clear_from_preferences(Self::preferences_for_setting(ctx))?;
|
||||
@@ -327,7 +327,7 @@ macro_rules! define_setting {
|
||||
fn set_value_from_cloud_sync(
|
||||
&mut self,
|
||||
new_value: Self::Value,
|
||||
ctx: &mut warpui::ModelContext<Self::Group>,
|
||||
ctx: &mut galaxyui::ModelContext<Self::Group>,
|
||||
) -> anyhow::Result<()> {
|
||||
use $crate::ChangeEventReason;
|
||||
let changed_in_storage =
|
||||
@@ -345,7 +345,7 @@ macro_rules! define_setting {
|
||||
fn set_value(
|
||||
&mut self,
|
||||
new_value: Self::Value,
|
||||
ctx: &mut warpui::ModelContext<Self::Group>,
|
||||
ctx: &mut galaxyui::ModelContext<Self::Group>,
|
||||
) -> anyhow::Result<()> {
|
||||
use $crate::ChangeEventReason;
|
||||
let changed_in_storage =
|
||||
@@ -364,7 +364,7 @@ macro_rules! define_setting {
|
||||
&mut self,
|
||||
new_value: Self::Value,
|
||||
explicitly_set: bool,
|
||||
ctx: &mut warpui::ModelContext<Self::Group>,
|
||||
ctx: &mut galaxyui::ModelContext<Self::Group>,
|
||||
) -> anyhow::Result<()> {
|
||||
use $crate::ChangeEventReason;
|
||||
let validated = self.validate(new_value);
|
||||
@@ -582,7 +582,7 @@ macro_rules! implement_setting_for_enum {
|
||||
|
||||
fn clear_value(
|
||||
&mut self,
|
||||
ctx: &mut warpui::ModelContext<Self::Group>,
|
||||
ctx: &mut galaxyui::ModelContext<Self::Group>,
|
||||
) -> anyhow::Result<()> {
|
||||
use $crate::ChangeEventReason;
|
||||
Self::clear_from_preferences(Self::preferences_for_setting(ctx))?;
|
||||
@@ -596,7 +596,7 @@ macro_rules! implement_setting_for_enum {
|
||||
fn set_value_from_cloud_sync(
|
||||
&mut self,
|
||||
new_value: Self::Value,
|
||||
ctx: &mut warpui::ModelContext<Self::Group>,
|
||||
ctx: &mut galaxyui::ModelContext<Self::Group>,
|
||||
) -> anyhow::Result<()> {
|
||||
use $crate::ChangeEventReason;
|
||||
let changed_in_storage =
|
||||
@@ -613,7 +613,7 @@ macro_rules! implement_setting_for_enum {
|
||||
fn set_value(
|
||||
&mut self,
|
||||
new_value: Self::Value,
|
||||
ctx: &mut warpui::ModelContext<Self::Group>,
|
||||
ctx: &mut galaxyui::ModelContext<Self::Group>,
|
||||
) -> anyhow::Result<()> {
|
||||
use $crate::ChangeEventReason;
|
||||
let changed_in_storage =
|
||||
@@ -631,7 +631,7 @@ macro_rules! implement_setting_for_enum {
|
||||
&mut self,
|
||||
new_value: Self::Value,
|
||||
_explicitly_set: bool,
|
||||
ctx: &mut warpui::ModelContext<Self::Group>,
|
||||
ctx: &mut galaxyui::ModelContext<Self::Group>,
|
||||
) -> anyhow::Result<()> {
|
||||
use $crate::ChangeEventReason;
|
||||
let validated = self.validate(new_value);
|
||||
@@ -714,7 +714,7 @@ macro_rules! define_settings_group {
|
||||
|
||||
impl $group {
|
||||
#[allow(dead_code)]
|
||||
fn new_from_storage(ctx: &mut warpui::ModelContext<Self>) -> Self {
|
||||
fn new_from_storage(ctx: &mut galaxyui::ModelContext<Self>) -> Self {
|
||||
use $crate::Setting;
|
||||
Self {
|
||||
$(
|
||||
@@ -725,7 +725,7 @@ macro_rules! define_settings_group {
|
||||
|
||||
#[cfg(any(test, feature = "integration_tests"))]
|
||||
#[allow(dead_code)]
|
||||
pub fn new_with_defaults(_ctx: &mut warpui::ModelContext<Self>) -> Self {
|
||||
pub fn new_with_defaults(_ctx: &mut galaxyui::ModelContext<Self>) -> Self {
|
||||
use $crate::Setting;
|
||||
Self {
|
||||
$(
|
||||
@@ -735,7 +735,7 @@ macro_rules! define_settings_group {
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn register(ctx: &mut (impl warpui::GetSingletonModelHandle + warpui::AddSingletonModel + warpui::UpdateModel)) -> warpui::ModelHandle<Self> {
|
||||
pub fn register(ctx: &mut (impl galaxyui::GetSingletonModelHandle + galaxyui::AddSingletonModel + galaxyui::UpdateModel)) -> galaxyui::ModelHandle<Self> {
|
||||
let settings_group = ctx.add_singleton_model(|ctx| {
|
||||
Self::new_from_storage(ctx)
|
||||
});
|
||||
@@ -781,12 +781,12 @@ macro_rules! define_settings_group {
|
||||
)*
|
||||
}
|
||||
|
||||
impl warpui::Entity for $group {
|
||||
impl galaxyui::Entity for $group {
|
||||
type Event = EventName;
|
||||
}
|
||||
});
|
||||
|
||||
impl warpui::SingletonEntity for $group {}
|
||||
impl galaxyui::SingletonEntity for $group {}
|
||||
};
|
||||
}
|
||||
pub use define_settings_group;
|
||||
@@ -816,16 +816,16 @@ macro_rules! generate_settings_event_fn {
|
||||
#[allow(dead_code)]
|
||||
#[allow(non_snake_case)]
|
||||
fn fn_name(
|
||||
settings_group: warpui::ModelHandle<$group>,
|
||||
settings_group: galaxyui::ModelHandle<$group>,
|
||||
ctx: &mut (
|
||||
impl warpui::GetSingletonModelHandle
|
||||
+ warpui::AddSingletonModel
|
||||
+ warpui::UpdateModel
|
||||
impl galaxyui::GetSingletonModelHandle
|
||||
+ galaxyui::AddSingletonModel
|
||||
+ galaxyui::UpdateModel
|
||||
),
|
||||
) {
|
||||
use anyhow::anyhow;
|
||||
use serde_json;
|
||||
use warpui::SingletonEntity;
|
||||
use galaxyui::SingletonEntity;
|
||||
use $crate::Setting as _;
|
||||
use $crate::manager::{SettingsEvent, SettingsManager};
|
||||
SettingsManager::handle(ctx).update(ctx, |manager, ctx| {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use anyhow::Result;
|
||||
use warpui::{AppContext, SingletonEntity};
|
||||
use galaxyui::{AppContext, SingletonEntity};
|
||||
|
||||
use crate::manager::SettingsManager;
|
||||
use crate::{Setting, SupportedPlatforms, SyncToCloud};
|
||||
@@ -36,12 +36,12 @@ define_settings_group!(TestSettings, settings: [
|
||||
pub fn init_and_register_preferences(ctx: &mut AppContext) {
|
||||
ctx.add_singleton_model(move |_| {
|
||||
crate::PublicPreferences::new(Box::<
|
||||
warpui_extras::user_preferences::in_memory::InMemoryPreferences,
|
||||
galaxyui_extras::user_preferences::in_memory::InMemoryPreferences,
|
||||
>::default())
|
||||
});
|
||||
ctx.add_singleton_model(move |_| {
|
||||
crate::PrivatePreferences::new(Box::<
|
||||
warpui_extras::user_preferences::in_memory::InMemoryPreferences,
|
||||
galaxyui_extras::user_preferences::in_memory::InMemoryPreferences,
|
||||
>::default())
|
||||
});
|
||||
}
|
||||
@@ -53,7 +53,7 @@ struct EventListener {
|
||||
}
|
||||
|
||||
impl EventListener {
|
||||
fn new(ctx: &mut warpui::ModelContext<Self>) -> Self {
|
||||
fn new(ctx: &mut galaxyui::ModelContext<Self>) -> Self {
|
||||
let test_settings = TestSettings::handle(ctx);
|
||||
ctx.subscribe_to_model(&test_settings, |me, event, _ctx| {
|
||||
// Update our internal state if we get a change event for
|
||||
@@ -67,7 +67,7 @@ impl EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
impl warpui::Entity for EventListener {
|
||||
impl galaxyui::Entity for EventListener {
|
||||
type Event = ();
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ fn test_can_override_storage_key() {
|
||||
|
||||
#[test]
|
||||
fn test_set_value_raises_changed_event_no_save() {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
|
||||
@@ -124,7 +124,7 @@ fn test_set_value_raises_changed_event_no_save() {
|
||||
|
||||
#[test]
|
||||
fn test_set_value_raises_changed_event_save() {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
|
||||
@@ -156,7 +156,7 @@ fn test_set_value_raises_changed_event_save() {
|
||||
|
||||
#[test]
|
||||
fn test_save_and_load_lifecycle() {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
|
||||
@@ -195,7 +195,7 @@ fn test_save_and_load_lifecycle() {
|
||||
|
||||
#[test]
|
||||
fn test_toggleable_setting() -> Result<()> {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
|
||||
@@ -254,7 +254,7 @@ fn test_explicit_value_tracking_with_some() {
|
||||
|
||||
#[test]
|
||||
fn test_explicit_value_tracking_after_set_value() {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
|
||||
@@ -284,7 +284,7 @@ fn test_explicit_value_tracking_after_set_value() {
|
||||
|
||||
#[test]
|
||||
fn test_explicit_value_tracking_after_clear_value() {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
|
||||
@@ -325,7 +325,7 @@ fn test_explicit_value_tracking_after_clear_value() {
|
||||
|
||||
#[test]
|
||||
fn test_explicit_value_tracking_from_storage() {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
|
||||
@@ -399,7 +399,7 @@ fn test_private_setting_storage_key_is_explicit_override() {
|
||||
|
||||
#[test]
|
||||
fn test_load_value_updates_value_without_persisting() {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
TestSettings::register(&mut app);
|
||||
@@ -430,7 +430,7 @@ fn test_load_value_updates_value_without_persisting() {
|
||||
|
||||
#[test]
|
||||
fn test_load_value_emits_event_on_change() {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
TestSettings::register(&mut app);
|
||||
@@ -461,7 +461,7 @@ fn test_load_value_emits_event_on_change() {
|
||||
|
||||
#[test]
|
||||
fn test_load_value_skips_event_when_unchanged() {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
TestSettings::register(&mut app);
|
||||
@@ -490,7 +490,7 @@ fn test_load_value_skips_event_when_unchanged() {
|
||||
|
||||
#[test]
|
||||
fn test_load_value_updates_explicitly_set_flag() {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
TestSettings::register(&mut app);
|
||||
@@ -526,7 +526,7 @@ fn test_load_value_updates_explicitly_set_flag() {
|
||||
|
||||
#[test]
|
||||
fn test_load_value_resets_explicitly_set_flag() {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
TestSettings::register(&mut app);
|
||||
@@ -569,7 +569,7 @@ fn test_load_value_resets_explicitly_set_flag() {
|
||||
|
||||
#[test]
|
||||
fn test_explicit_value_tracking_cloud_sync() {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
|
||||
@@ -655,7 +655,7 @@ fn test_settings_file_enabled_flag_round_trip() {
|
||||
#[serial_test::serial]
|
||||
fn test_public_setting_writes_to_public_prefs_when_flag_enabled() {
|
||||
crate::set_settings_file_enabled(true);
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
TestSettings::register(&mut app);
|
||||
@@ -693,7 +693,7 @@ fn test_public_setting_writes_to_public_prefs_when_flag_enabled() {
|
||||
#[serial_test::serial]
|
||||
fn test_private_setting_writes_to_private_prefs_when_flag_enabled() {
|
||||
crate::set_settings_file_enabled(true);
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
TestSettings::register(&mut app);
|
||||
@@ -740,7 +740,7 @@ fn test_private_setting_writes_to_private_prefs_when_flag_enabled() {
|
||||
#[serial_test::serial]
|
||||
fn test_new_from_storage_reads_from_correct_backend_when_flag_enabled() {
|
||||
crate::set_settings_file_enabled(true);
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
TestSettings::register(&mut app);
|
||||
@@ -778,7 +778,7 @@ fn test_new_from_storage_reads_from_correct_backend_when_flag_enabled() {
|
||||
#[serial_test::serial]
|
||||
fn test_clear_value_clears_from_correct_backend() {
|
||||
crate::set_settings_file_enabled(true);
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
TestSettings::register(&mut app);
|
||||
@@ -834,7 +834,7 @@ fn test_clear_value_clears_from_correct_backend() {
|
||||
#[serial_test::serial]
|
||||
fn test_public_setting_uses_private_prefs_when_flag_disabled() {
|
||||
crate::set_settings_file_enabled(false);
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
TestSettings::register(&mut app);
|
||||
@@ -875,7 +875,7 @@ fn test_public_setting_uses_private_prefs_when_flag_disabled() {
|
||||
#[serial_test::serial]
|
||||
fn test_private_setting_uses_private_prefs_when_flag_disabled() {
|
||||
crate::set_settings_file_enabled(false);
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
TestSettings::register(&mut app);
|
||||
@@ -909,7 +909,7 @@ fn test_private_setting_uses_private_prefs_when_flag_disabled() {
|
||||
#[serial_test::serial]
|
||||
fn test_new_from_storage_reads_from_private_backend_when_flag_disabled() {
|
||||
crate::set_settings_file_enabled(false);
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
TestSettings::register(&mut app);
|
||||
@@ -950,7 +950,7 @@ fn test_new_from_storage_reads_from_private_backend_when_flag_disabled() {
|
||||
|
||||
#[test]
|
||||
fn test_manager_is_private_for_storage_key() {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
TestSettings::register(&mut app);
|
||||
@@ -975,7 +975,7 @@ fn test_manager_is_private_for_storage_key() {
|
||||
|
||||
#[test]
|
||||
fn test_manager_default_values_for_settings_file_excludes_private() {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
TestSettings::register(&mut app);
|
||||
@@ -1006,7 +1006,7 @@ fn test_manager_default_values_for_settings_file_excludes_private() {
|
||||
#[serial_test::serial]
|
||||
fn test_manager_read_local_setting_value_routes_when_flag_enabled() {
|
||||
crate::set_settings_file_enabled(true);
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
TestSettings::register(&mut app);
|
||||
@@ -1054,7 +1054,7 @@ fn test_manager_read_local_setting_value_routes_when_flag_enabled() {
|
||||
#[serial_test::serial]
|
||||
fn test_manager_read_local_setting_value_falls_back_when_flag_disabled() {
|
||||
crate::set_settings_file_enabled(false);
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
TestSettings::register(&mut app);
|
||||
@@ -1104,13 +1104,13 @@ fn test_manager_read_local_setting_value_falls_back_when_flag_disabled() {
|
||||
#[test]
|
||||
#[serial_test::serial]
|
||||
fn test_manager_read_local_setting_value_respects_hierarchy_with_settings_file() {
|
||||
use warpui_extras::user_preferences::toml_backed::TomlBackedUserPreferences;
|
||||
use galaxyui_extras::user_preferences::toml_backed::TomlBackedUserPreferences;
|
||||
|
||||
crate::set_settings_file_enabled(true);
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let file_path = dir.path().join("settings.toml");
|
||||
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
// Use the TOML-backed store for public preferences so the hierarchy
|
||||
// routing actually matters; in-memory preferences ignore hierarchy
|
||||
// entirely and would hide this bug.
|
||||
@@ -1121,7 +1121,7 @@ fn test_manager_read_local_setting_value_respects_hierarchy_with_settings_file()
|
||||
});
|
||||
app.add_singleton_model(|_| {
|
||||
crate::PrivatePreferences::new(Box::<
|
||||
warpui_extras::user_preferences::in_memory::InMemoryPreferences,
|
||||
galaxyui_extras::user_preferences::in_memory::InMemoryPreferences,
|
||||
>::default())
|
||||
});
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
|
||||
@@ -3,8 +3,8 @@ use std::collections::HashMap;
|
||||
use std::ops::Deref;
|
||||
|
||||
use anyhow::{Result, anyhow};
|
||||
use warpui::{AppContext, Entity, ModelContext, SingletonEntity};
|
||||
use warpui_extras::user_preferences::UserPreferences;
|
||||
use galaxyui::{AppContext, Entity, ModelContext, SingletonEntity};
|
||||
use galaxyui_extras::user_preferences::UserPreferences;
|
||||
|
||||
use super::PrivatePreferences;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use warpui::SingletonEntity;
|
||||
use galaxyui::SingletonEntity;
|
||||
|
||||
use crate::manager::SettingsManager;
|
||||
use crate::{Setting, SupportedPlatforms, SyncToCloud};
|
||||
@@ -51,19 +51,19 @@ define_settings_group!(TestSettings, settings: [
|
||||
pub fn init_and_register_user_preferences(ctx: &mut AppContext) {
|
||||
ctx.add_singleton_model(move |_| {
|
||||
crate::PublicPreferences::new(Box::<
|
||||
warpui_extras::user_preferences::in_memory::InMemoryPreferences,
|
||||
galaxyui_extras::user_preferences::in_memory::InMemoryPreferences,
|
||||
>::default())
|
||||
});
|
||||
ctx.add_singleton_model(move |_| {
|
||||
crate::PrivatePreferences::new(Box::<
|
||||
warpui_extras::user_preferences::in_memory::InMemoryPreferences,
|
||||
galaxyui_extras::user_preferences::in_memory::InMemoryPreferences,
|
||||
>::default())
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_is_setting_syncable_on_current_platform() {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_and_register_user_preferences);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
|
||||
@@ -155,7 +155,7 @@ fn test_is_setting_syncable_on_current_platform() {
|
||||
}
|
||||
|
||||
mod reload_all_public_settings_tests {
|
||||
use warpui::SingletonEntity;
|
||||
use galaxyui::SingletonEntity;
|
||||
|
||||
use crate::manager::SettingsManager;
|
||||
use crate::{Setting, SupportedPlatforms, SyncToCloud};
|
||||
@@ -183,12 +183,12 @@ mod reload_all_public_settings_tests {
|
||||
fn init_prefs(ctx: &mut AppContext) {
|
||||
ctx.add_singleton_model(move |_| -> crate::PublicPreferences {
|
||||
crate::PublicPreferences::new(Box::<
|
||||
warpui_extras::user_preferences::in_memory::InMemoryPreferences,
|
||||
galaxyui_extras::user_preferences::in_memory::InMemoryPreferences,
|
||||
>::default())
|
||||
});
|
||||
ctx.add_singleton_model(move |_| -> crate::PrivatePreferences {
|
||||
crate::PrivatePreferences(Box::<
|
||||
warpui_extras::user_preferences::in_memory::InMemoryPreferences,
|
||||
galaxyui_extras::user_preferences::in_memory::InMemoryPreferences,
|
||||
>::default())
|
||||
});
|
||||
}
|
||||
@@ -197,7 +197,7 @@ mod reload_all_public_settings_tests {
|
||||
/// in the preferences backend.
|
||||
#[test]
|
||||
fn test_loads_present_keys() {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_prefs);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
ReloadTestSettings::register(&mut app);
|
||||
@@ -231,7 +231,7 @@ mod reload_all_public_settings_tests {
|
||||
/// reload (the key-deletion scenario).
|
||||
#[test]
|
||||
fn test_resets_absent_keys_to_defaults() {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_prefs);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
ReloadTestSettings::register(&mut app);
|
||||
@@ -272,7 +272,7 @@ mod reload_all_public_settings_tests {
|
||||
/// This is the property that prevents the infinite watcher loop.
|
||||
#[test]
|
||||
fn test_absent_keys_are_not_written_back() {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_prefs);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
ReloadTestSettings::register(&mut app);
|
||||
@@ -313,7 +313,7 @@ mod reload_all_public_settings_tests {
|
||||
/// of settings that fail to deserialize (invalid value in file).
|
||||
#[test]
|
||||
fn test_reload_returns_failed_keys_for_invalid_values() {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_prefs);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
ReloadTestSettings::register(&mut app);
|
||||
@@ -354,7 +354,7 @@ mod reload_all_public_settings_tests {
|
||||
/// when all values are valid.
|
||||
#[test]
|
||||
fn test_reload_returns_empty_vec_on_success() {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
app.update(init_prefs);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
ReloadTestSettings::register(&mut app);
|
||||
@@ -384,7 +384,7 @@ mod reload_all_public_settings_tests {
|
||||
/// values without modifying in-memory state.
|
||||
#[test]
|
||||
fn test_validate_detects_invalid_values() {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
crate::set_settings_file_enabled(true);
|
||||
app.update(init_prefs);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
@@ -423,7 +423,7 @@ mod reload_all_public_settings_tests {
|
||||
/// stored values are valid.
|
||||
#[test]
|
||||
fn test_validate_returns_empty_when_all_valid() {
|
||||
warpui::App::test((), |mut app| async move {
|
||||
galaxyui::App::test((), |mut app| async move {
|
||||
crate::set_settings_file_enabled(true);
|
||||
app.update(init_prefs);
|
||||
app.add_singleton_model(|_| SettingsManager::default());
|
||||
@@ -507,7 +507,7 @@ mod write_to_preferences_tests {
|
||||
#[test]
|
||||
fn test_no_spurious_write_with_format_differences() {
|
||||
let prefs =
|
||||
Box::<warpui_extras::user_preferences::in_memory::InMemoryPreferences>::default();
|
||||
Box::<galaxyui_extras::user_preferences::in_memory::InMemoryPreferences>::default();
|
||||
|
||||
// Simulate what a TOML backend produces after a round-trip:
|
||||
// - null fields (optional_field) are stripped
|
||||
@@ -541,7 +541,7 @@ mod write_to_preferences_tests {
|
||||
#[test]
|
||||
fn test_no_spurious_write_with_hashmap_and_missing_options() {
|
||||
use std::collections::HashMap;
|
||||
use warpui_extras::user_preferences::toml_backed::TomlBackedUserPreferences;
|
||||
use galaxyui_extras::user_preferences::toml_backed::TomlBackedUserPreferences;
|
||||
|
||||
#[derive(
|
||||
Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, schemars::JsonSchema,
|
||||
@@ -604,7 +604,7 @@ mod write_to_preferences_tests {
|
||||
/// null-stripping and key-reordering happens.
|
||||
#[test]
|
||||
fn test_no_spurious_write_with_toml_backend() {
|
||||
use warpui_extras::user_preferences::toml_backed::TomlBackedUserPreferences;
|
||||
use galaxyui_extras::user_preferences::toml_backed::TomlBackedUserPreferences;
|
||||
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let file_path = dir.path().join("settings.toml");
|
||||
|
||||
@@ -26,7 +26,7 @@ pub struct SettingSchemaEntry {
|
||||
/// Feature flag gating this setting.
|
||||
/// If Some, the setting is only included in the schema when the flag
|
||||
/// is active for the target build channel.
|
||||
pub feature_flag: Option<warp_features::FeatureFlag>,
|
||||
pub feature_flag: Option<galaxy_features::FeatureFlag>,
|
||||
|
||||
/// Returns which platforms this setting applies to.
|
||||
pub supported_platforms_fn: fn() -> SupportedPlatforms,
|
||||
|
||||
Reference in New Issue
Block a user