1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-12-25 20:38:50 +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/settings/header_spacer_section.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/ui_utils.dart';
import 'package:flutter/material.dart';
@ -39,15 +40,19 @@ class _AccountSecuritySettingsScreenState
),
SettingsTile(
title: tr("Change your security questions"),
subtitle: tr(
"Your security questions can be used to recover an access to your account when you loose your password..."),
subtitle: isIOS
? null
: tr(
"Your security questions can be used to recover an access to your account when you loose your password..."),
onPressed: (_) => _changeSecurityQuestions(),
subtitleMaxLines: 3,
),
SettingsTile(
title: tr("Disconnect all your devices"),
subtitle: 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."),
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."),
onPressed: (_) => _disconnectAllDevices(),
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/tour_route.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/ui_utils.dart';
import 'package:flutter/material.dart';
@ -184,7 +185,7 @@ class __AccountSettingsBodyState extends State<_AccountSettingsBody> {
.map((f) => SettingsTile(
title: f.title,
leading: Icon(f.icon),
subtitle: f.subtitle,
subtitle: isIOS ? null : f.subtitle,
onPressed: (_) => _openSectionsAsNewRoute(f),
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/ui/widgets/async_screen_widget.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/ui_utils.dart';
import 'package:flutter/material.dart';
@ -69,7 +70,7 @@ class _ApplicationSettingsState extends State<ApplicationSettings> {
),
SettingsTile(
title: tr("About this application"),
subtitle: tr("Learn more about us"),
subtitle: isIOS ? null : tr("Learn more about us"),
onPressed: (_) => showAboutAppDialog(context),
)
],
@ -83,8 +84,10 @@ class _ApplicationSettingsState extends State<ApplicationSettings> {
_PreferencesSettingsTile(
preferencesKey: PreferencesKeyList.FORCE_MOBILE_MODE,
title: tr("Force mobile mode"),
subtitle: tr(
"Force the smartphone mode of the application to be used, even when tablet mode could be used."),
subtitle: isIOS
? null
: tr(
"Force the smartphone mode of the application to be used, even when tablet mode could be used."),
onChange: _updatedSettings,
helper: _preferencesHelper,
),
@ -130,7 +133,7 @@ class _PreferencesSettingsTile extends SettingsTile {
onToggle: _doChange,
switchValue: helper.getBool(preferencesKey),
titleMaxLines: 2,
subtitleMaxLines: 3,
subtitleMaxLines: 4,
);
}

View File

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

View File

@ -7,4 +7,6 @@ import 'package:flutter/foundation.dart' show 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) + "...";