1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 12:59:21 +00:00

Fix application settings on iOS

This commit is contained in:
Pierre HUBERT 2021-04-27 09:44:11 +02:00
parent 3555c602e9
commit 508286423b
6 changed files with 30 additions and 11 deletions

View File

@ -8,6 +8,7 @@ import 'package:comunic/ui/widgets/dialogs/auto_sized_dialog_content_widget.dart
import 'package:comunic/ui/widgets/new_password_input_widget.dart'; import 'package:comunic/ui/widgets/new_password_input_widget.dart';
import 'package:comunic/ui/widgets/settings/header_spacer_section.dart'; import 'package:comunic/ui/widgets/settings/header_spacer_section.dart';
import 'package:comunic/utils/account_utils.dart'; import 'package:comunic/utils/account_utils.dart';
import 'package:comunic/utils/flutter_utils.dart';
import 'package:comunic/utils/intl_utils.dart'; import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart'; import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -39,14 +40,18 @@ class _AccountSecuritySettingsScreenState
), ),
SettingsTile( SettingsTile(
title: tr("Change your security questions"), title: tr("Change your security questions"),
subtitle: tr( subtitle: isIOS
? null
: tr(
"Your security questions can be used to recover an access to your account when you loose your password..."), "Your security questions can be used to recover an access to your account when you loose your password..."),
onPressed: (_) => _changeSecurityQuestions(), onPressed: (_) => _changeSecurityQuestions(),
subtitleMaxLines: 3, subtitleMaxLines: 3,
), ),
SettingsTile( SettingsTile(
title: tr("Disconnect all your devices"), title: tr("Disconnect all your devices"),
subtitle: tr( subtitle: isIOS
? null
: tr(
"Disconnect all your devices from Comunic, including the current one. Use this option if one of the device you use for Comunic was stolen."), "Disconnect all your devices from Comunic, including the current one. Use this option if one of the device you use for Comunic was stolen."),
onPressed: (_) => _disconnectAllDevices(), onPressed: (_) => _disconnectAllDevices(),
subtitleMaxLines: 6, subtitleMaxLines: 6,

View File

@ -7,6 +7,7 @@ import 'package:comunic/ui/routes/settings/general_account_settings.dart';
import 'package:comunic/ui/routes/settings/notifications_settings.dart'; import 'package:comunic/ui/routes/settings/notifications_settings.dart';
import 'package:comunic/ui/routes/tour_route.dart'; import 'package:comunic/ui/routes/tour_route.dart';
import 'package:comunic/ui/widgets/settings/header_spacer_section.dart'; import 'package:comunic/ui/widgets/settings/header_spacer_section.dart';
import 'package:comunic/utils/flutter_utils.dart';
import 'package:comunic/utils/intl_utils.dart'; import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart'; import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -184,7 +185,7 @@ class __AccountSettingsBodyState extends State<_AccountSettingsBody> {
.map((f) => SettingsTile( .map((f) => SettingsTile(
title: f.title, title: f.title,
leading: Icon(f.icon), leading: Icon(f.icon),
subtitle: f.subtitle, subtitle: isIOS ? null : f.subtitle,
onPressed: (_) => _openSectionsAsNewRoute(f), onPressed: (_) => _openSectionsAsNewRoute(f),
subtitleMaxLines: 3, subtitleMaxLines: 3,
)) ))

View File

@ -2,6 +2,7 @@ import 'package:comunic/helpers/preferences_helper.dart';
import 'package:comunic/helpers/server_config_helper.dart'; import 'package:comunic/helpers/server_config_helper.dart';
import 'package:comunic/ui/widgets/async_screen_widget.dart'; import 'package:comunic/ui/widgets/async_screen_widget.dart';
import 'package:comunic/ui/widgets/settings/header_spacer_section.dart'; import 'package:comunic/ui/widgets/settings/header_spacer_section.dart';
import 'package:comunic/utils/flutter_utils.dart';
import 'package:comunic/utils/intl_utils.dart'; import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart'; import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -69,7 +70,7 @@ class _ApplicationSettingsState extends State<ApplicationSettings> {
), ),
SettingsTile( SettingsTile(
title: tr("About this application"), title: tr("About this application"),
subtitle: tr("Learn more about us"), subtitle: isIOS ? null : tr("Learn more about us"),
onPressed: (_) => showAboutAppDialog(context), onPressed: (_) => showAboutAppDialog(context),
) )
], ],
@ -83,7 +84,9 @@ class _ApplicationSettingsState extends State<ApplicationSettings> {
_PreferencesSettingsTile( _PreferencesSettingsTile(
preferencesKey: PreferencesKeyList.FORCE_MOBILE_MODE, preferencesKey: PreferencesKeyList.FORCE_MOBILE_MODE,
title: tr("Force mobile mode"), title: tr("Force mobile mode"),
subtitle: tr( subtitle: isIOS
? null
: tr(
"Force the smartphone mode of the application to be used, even when tablet mode could be used."), "Force the smartphone mode of the application to be used, even when tablet mode could be used."),
onChange: _updatedSettings, onChange: _updatedSettings,
helper: _preferencesHelper, helper: _preferencesHelper,
@ -130,7 +133,7 @@ class _PreferencesSettingsTile extends SettingsTile {
onToggle: _doChange, onToggle: _doChange,
switchValue: helper.getBool(preferencesKey), switchValue: helper.getBool(preferencesKey),
titleMaxLines: 2, titleMaxLines: 2,
subtitleMaxLines: 3, subtitleMaxLines: 4,
); );
} }

View File

@ -1,5 +1,7 @@
import 'package:comunic/ui/dialogs/single_input_dialog.dart'; import 'package:comunic/ui/dialogs/single_input_dialog.dart';
import 'package:comunic/utils/flutter_utils.dart';
import 'package:comunic/utils/intl_utils.dart'; import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/string_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:settings_ui/settings_ui.dart'; import 'package:settings_ui/settings_ui.dart';
@ -39,7 +41,7 @@ class TextEditSettingsTile extends SettingsTile {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SettingsTile( return SettingsTile(
title: title, title: title,
subtitle: currValue, subtitle: isIOS ? reduceString(currValue, 20) :currValue,
onPressed: readOnly ? null : (_) => _changeValue(context), onPressed: readOnly ? null : (_) => _changeValue(context),
); );
} }

View File

@ -8,3 +8,5 @@ import 'package:flutter/foundation.dart' show kIsWeb;
bool get isWeb => kIsWeb; bool get isWeb => kIsWeb;
bool get isAndroid => !isWeb && Platform.isAndroid; bool get isAndroid => !isWeb && Platform.isAndroid;
bool get isIOS => !isWeb && Platform.isIOS;

View File

@ -0,0 +1,6 @@
/// String utilities
///
/// @author Pierre Hubert
String reduceString(String str, int maxLen) =>
str.length <= maxLen ? str : str.substring(0, maxLen - 3) + "...";