- Update AI agent conversation, task, and prompt builder - Add notebooks execution module for blocklist actions - Update Bedrock and OpenAI response translators - Refactor settings modules across multiple subsystems - Update terminal settings and window settings - Update drive settings and search command settings
50 lines
1.9 KiB
Rust
50 lines
1.9 KiB
Rust
use galaxy_core::features::FeatureFlag;
|
|
use settings::{macros::define_settings_group, SupportedPlatforms, SyncToCloud};
|
|
|
|
use super::DriveSortOrder;
|
|
|
|
pub const HAS_AUTO_OPENED_WELCOME_FOLDER: &str = "HasAutoOpenedWelcomeFolder";
|
|
|
|
define_settings_group!(WarpDriveSettings, settings: [
|
|
sorting_choice: WarpDriveSortingChoice {
|
|
type: DriveSortOrder,
|
|
default: DriveSortOrder::ByObjectType,
|
|
supported_platforms: SupportedPlatforms::ALL,
|
|
sync_to_cloud: SyncToCloud::Never,
|
|
private: false,
|
|
toml_path: "warp_drive.sorting_choice",
|
|
description: "The sort order for items in Galaxy Drive.",
|
|
},
|
|
sharing_onboarding_block_shown: WarpDriveSharingOnboardingBlockShown {
|
|
type: bool,
|
|
default: false,
|
|
supported_platforms: SupportedPlatforms::ALL,
|
|
sync_to_cloud: SyncToCloud::Never,
|
|
private: true,
|
|
},
|
|
// Controls whether Warp Drive appears in the tools panel, command palette, and command search.
|
|
enable_warp_drive: EnableWarpDrive {
|
|
type: bool,
|
|
default: true,
|
|
supported_platforms: SupportedPlatforms::ALL,
|
|
sync_to_cloud: SyncToCloud::Never,
|
|
private: false,
|
|
toml_path: "warp_drive.enabled",
|
|
description: "Whether Galaxy Drive is enabled.",
|
|
},
|
|
]);
|
|
|
|
impl WarpDriveSettings {
|
|
/// Returns whether Warp Drive should be considered enabled.
|
|
/// Returns `false` when the user is anonymous or fully logged out,
|
|
/// regardless of the user setting.
|
|
pub fn is_warp_drive_enabled(app: &galaxyui::AppContext) -> bool {
|
|
use galaxyui::SingletonEntity as _;
|
|
let is_anonymous_or_logged_out = FeatureFlag::SkipFirebaseAnonymousUser.is_enabled()
|
|
&& crate::auth::AuthStateProvider::as_ref(app)
|
|
.get()
|
|
.is_anonymous_or_logged_out();
|
|
*Self::as_ref(app).enable_warp_drive && !is_anonymous_or_logged_out
|
|
}
|
|
}
|