fix custom client settings tab visibility (#8752)

* fix custom client settings tab visibility

only control with tabKeys

Signed-off-by: 21pages <sunboeasy@gmail.com>

* fix preset-user-name typo

Signed-off-by: 21pages <sunboeasy@gmail.com>

---------

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages 2024-07-18 22:27:31 +08:00 committed by GitHub
parent 2be05608d8
commit 04c175c62e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 33 additions and 18 deletions

View File

@ -61,9 +61,13 @@ class DesktopSettingPage extends StatefulWidget {
final SettingsTabKey initialTabkey; final SettingsTabKey initialTabkey;
static final List<SettingsTabKey> tabKeys = [ static final List<SettingsTabKey> tabKeys = [
SettingsTabKey.general, SettingsTabKey.general,
if (!bind.isOutgoingOnly() && !bind.isDisableSettings()) if (!bind.isOutgoingOnly() &&
!bind.isDisableSettings() &&
bind.mainGetLocalOption(key: "hide-security-settings") != 'Y')
SettingsTabKey.safety, SettingsTabKey.safety,
if (!bind.isDisableSettings()) SettingsTabKey.network, if (!bind.isDisableSettings() &&
bind.mainGetLocalOption(key: "hide-network-settings") != 'Y')
SettingsTabKey.network,
if (!bind.isIncomingOnly()) SettingsTabKey.display, if (!bind.isIncomingOnly()) SettingsTabKey.display,
if (!isWeb && !bind.isIncomingOnly() && bind.pluginFeatureIsEnabled()) if (!isWeb && !bind.isIncomingOnly() && bind.pluginFeatureIsEnabled())
SettingsTabKey.plugin, SettingsTabKey.plugin,
@ -173,21 +177,32 @@ class _DesktopSettingPageState extends State<DesktopSettingPage>
} }
List<Widget> _children() { List<Widget> _children() {
final hideSecurity = final children = List<Widget>.empty(growable: true);
bind.mainGetLocalOption(key: "hide-security-settings") == 'Y'; for (final tab in DesktopSettingPage.tabKeys) {
final hideNetwork = switch (tab) {
bind.mainGetLocalOption(key: "hide-network-settings") == 'Y'; case SettingsTabKey.general:
final children = [ children.add(const _General());
_General(), break;
if (!bind.isOutgoingOnly() && !bind.isDisableSettings() && !hideSecurity) case SettingsTabKey.safety:
_Safety(), children.add(const _Safety());
if (!bind.isDisableSettings() && !hideNetwork) _Network(), break;
if (!bind.isIncomingOnly()) _Display(), case SettingsTabKey.network:
if (!isWeb && !bind.isIncomingOnly() && bind.pluginFeatureIsEnabled()) children.add(const _Network());
_Plugin(), break;
if (!bind.isDisableAccount()) _Account(), case SettingsTabKey.display:
_About(), children.add(const _Display());
]; break;
case SettingsTabKey.plugin:
children.add(const _Plugin());
break;
case SettingsTabKey.account:
children.add(const _Account());
break;
case SettingsTabKey.about:
children.add(const _About());
break;
}
}
return children; return children;
} }

View File

@ -2096,7 +2096,7 @@ pub mod keys {
pub const OPTION_KEY: &str = "key"; pub const OPTION_KEY: &str = "key";
pub const OPTION_PRESET_ADDRESS_BOOK_NAME: &str = "preset-address-book-name"; pub const OPTION_PRESET_ADDRESS_BOOK_NAME: &str = "preset-address-book-name";
pub const OPTION_PRESET_ADDRESS_BOOK_TAG: &str = "preset-address-book-tag"; pub const OPTION_PRESET_ADDRESS_BOOK_TAG: &str = "preset-address-book-tag";
pub const OPTION_PRESET_USERNAME: &str = "preset-username"; pub const OPTION_PRESET_USERNAME: &str = "preset-user-name";
pub const OPTION_PRESET_STRATEGY_NAME: &str = "preset-strategy-name"; pub const OPTION_PRESET_STRATEGY_NAME: &str = "preset-strategy-name";
pub const OPTION_ENABLE_DIRECTX_CAPTURE: &str = "enable-directx-capture"; pub const OPTION_ENABLE_DIRECTX_CAPTURE: &str = "enable-directx-capture";
pub const OPTION_ENABLE_ANDROID_SOFTWARE_ENCODING_HALF_SCALE: &str = pub const OPTION_ENABLE_ANDROID_SOFTWARE_ENCODING_HALF_SCALE: &str =