add setting to enable eviction of discovered contacts in settings
This commit is contained in:
1 parent
98f6cf3745
commit
9db2307ea0
30 files changed
+260
-40
No files matched your search
@@ -1153,9 +1153,7 @@ class AppSettingsScreen extends StatelessWidget {
|
||||
) {
|
||||
final currentApiKey = settingsService.settings.mapTileApiKey?.trim() ?? '';
|
||||
final maskedApiKey = _maskApiKey(
|
||||
currentApiKey.isEmpty
|
||||
? AppSettings.stadiaDemo
|
||||
: currentApiKey,
|
||||
currentApiKey.isEmpty ? AppSettings.stadiaDemo : currentApiKey,
|
||||
);
|
||||
final controller = TextEditingController(text: maskedApiKey);
|
||||
showDialog(
|
||||
|
||||
@@ -700,9 +700,9 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
child: Text(
|
||||
context.l10n.channels_via(
|
||||
_formatPathPrefixes(
|
||||
displayPath,
|
||||
displayPathHashWidth,
|
||||
),
|
||||
displayPath,
|
||||
displayPathHashWidth,
|
||||
),
|
||||
),
|
||||
style: MeshTheme.mono(
|
||||
fontSize: 9.5 * textScale,
|
||||
@@ -1214,25 +1214,19 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
decoration: InputDecoration(
|
||||
hintText: context.l10n.chat_typeMessage,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
MeshRadii.md,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(MeshRadii.md),
|
||||
borderSide: BorderSide(
|
||||
color: scheme.outlineVariant,
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
MeshRadii.md,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(MeshRadii.md),
|
||||
borderSide: BorderSide(
|
||||
color: scheme.outlineVariant,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
MeshRadii.md,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(MeshRadii.md),
|
||||
borderSide: BorderSide(
|
||||
color: scheme.primary,
|
||||
width: 1.5,
|
||||
|
||||
@@ -412,7 +412,8 @@ class _ChannelsScreenState extends State<ChannelsScreen>
|
||||
final messages = connector.getChannelMessages(channel);
|
||||
final lastMessage = messages.isNotEmpty ? messages.last : null;
|
||||
final lastMessageText = lastMessage?.text ?? '';
|
||||
final lastPreview = lastMessageText.isNotEmpty &&
|
||||
final lastPreview =
|
||||
lastMessageText.isNotEmpty &&
|
||||
GifHelper.parseGif(lastMessageText) != null
|
||||
? context.l10n.chat_receivedGif
|
||||
: lastMessageText;
|
||||
|
||||
@@ -1168,6 +1168,9 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
bool autoAddRoomServer = false;
|
||||
bool autoAddSensor = false;
|
||||
bool overwriteOldest = false;
|
||||
final appSettingsService = context.read<AppSettingsService>();
|
||||
bool evictDiscoveredContactsEnabled =
|
||||
appSettingsService.settings.evictDiscoveredContactsEnabled;
|
||||
|
||||
final connector = context.read<MeshCoreConnector>();
|
||||
autoAddChat = connector.autoAddUsers ?? false;
|
||||
@@ -1229,6 +1232,15 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
setDialogState(() => overwriteOldest = value);
|
||||
},
|
||||
),
|
||||
const Divider(height: 4),
|
||||
FeatureToggleRow(
|
||||
title: l10n.contactsSettings_evictDiscoveredContactsTitle,
|
||||
subtitle: l10n.contactsSettings_evictDiscoveredContactsSubtitle,
|
||||
value: evictDiscoveredContactsEnabled,
|
||||
onChanged: (value) {
|
||||
setDialogState(() => evictDiscoveredContactsEnabled = value);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -1238,7 +1250,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
child: Text(l10n.common_cancel),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
onPressed: () async {
|
||||
await appSettingsService.setEvictDiscoveredContactsEnabled(
|
||||
evictDiscoveredContactsEnabled,
|
||||
);
|
||||
_sendSettings(
|
||||
connector,
|
||||
autoAddChat,
|
||||
@@ -1247,6 +1262,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
autoAddSensor,
|
||||
overwriteOldest,
|
||||
);
|
||||
if (!mounted) return;
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text(l10n.common_save),
|
||||
|
||||
Reference in new issue
Block a user