Skip to content

Commit

Permalink
Fix issue with async prefs fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
corcoran committed May 31, 2019
1 parent afdb98c commit 87484d3
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions app/settings/lib/models/behavior_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,37 @@ import 'package:settings/utils.dart';

class BehaviorData extends PreferenceData {
Future refresh() async {
Utils.getSharedPrefs().then((sp) {
prefSet.add(PrefSet("Notification", [
RadioChoicePref<int>(
"jobInterval",
"Update interval",
["Every %s"],
sp,
15000,
[
["5 seconds", 5000],
["10 seconds", 10000],
["15 seconds", 15000],
["20 seconds", 20000],
["30 seconds", 30000],
["1 minute", 60000],
["2 minutes", 120000]
])
]));
prefSet.add(PrefSet("Sorting", [
RadioChoicePref<String>(
"notificationWeight",
"Order priority",
["%s"],
sp,
"lastUsed",
[
["Last used", "lastUsed"],
["Time spend in app", "foregroundTime"],
["Most launched", "timesLaunched"]
])
]));
});
var sp = await Utils.getSharedPrefs();

prefSet.add(PrefSet("Notification", [
RadioChoicePref<int>(
"jobInterval",
"Update interval",
["Every %s"],
sp,
15000,
[
["5 seconds", 5000],
["10 seconds", 10000],
["15 seconds", 15000],
["20 seconds", 20000],
["30 seconds", 30000],
["1 minute", 60000],
["2 minutes", 120000]
])
]));
prefSet.add(PrefSet("Sorting", [
RadioChoicePref<String>(
"notificationWeight",
"Order priority",
["%s"],
sp,
"lastUsed",
[
["Last used", "lastUsed"],
["Time spend in app", "foregroundTime"],
["Most launched", "timesLaunched"]
])
]));
}
}

0 comments on commit 87484d3

Please sign in to comment.