Skip to content

Commit bd41f20

Browse files
committed
add setting for syncing only over wifi
Issue: #541
1 parent f58cd6d commit bd41f20

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

Diff for: lib/data/prefs.dart

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ abstract class Prefs {
6262

6363
static late final PlainPref<Uint8List?> pfp;
6464
static late final PlainPref<bool> syncInBackground;
65+
static late final PlainPref<bool> onlySyncOverWifi;
6566

6667
static late final PlainPref<ThemeMode> appTheme;
6768

@@ -168,6 +169,7 @@ abstract class Prefs {
168169

169170
pfp = PlainPref('pfp', null);
170171
syncInBackground = PlainPref('syncInBackground', true);
172+
onlySyncOverWifi = PlainPref('onlySyncOverWifi', true);
171173

172174
appTheme = PlainPref('appTheme', ThemeMode.system);
173175
platform = PlainPref('platform', defaultTargetPlatform);

Diff for: lib/pages/home/settings.dart

+9
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,15 @@ class _SettingsPageState extends State<SettingsPage> {
329329
},
330330
pref: Prefs.hyperlegibleFont,
331331
),
332+
SettingsSwitch(
333+
title: 'Sync notes only over WiFi',
334+
subtitle: 'If disabled mobile data may be used to sync notes',
335+
iconBuilder: (i) => switch (Prefs.platform.value) {
336+
TargetPlatform.iOS || TargetPlatform.macOS => Icons.wifi_rounded,
337+
_ => Icons.wifi_sharp,
338+
},
339+
pref: Prefs.onlySyncOverWifi,
340+
),
332341
SettingsSubtitle(subtitle: t.settings.prefCategories.writing),
333342
SettingsSwitch(
334343
title: t.settings.prefLabels.preferGreyscale,

0 commit comments

Comments
 (0)