CWA-168 | added app version to settings page (added currentVersion to settings store and item to item_headers)

Oleksandr Sobol committed Jan 28, 2020 at 20:43 UTC 50d857f23a7537befe37c8f81a78cf903d994cd0
3 files changed +12 -2
lib/src/screens/settings/items/item_headers.dart
+1
@@ -14,4 +14,5 @@ class ItemHeaders {
14 static const support = 'Support';
15 static const termsAndConditions = 'Terms and conditions';
16 static const faq = 'FAQ';
17 + static const version = 'Version';
18 }
\ No newline at end of file
lib/src/screens/settings/settings.dart
+6 -1
@@ -279,7 +279,12 @@ class SettingsFormState extends State<SettingsForm> {
279 SettingsItem(
280 onTaped: () => Navigator.pushNamed(context, Routes.faq),
281 title: ItemHeaders.faq,
282 - attribute: Attributes.arrow)
282 + attribute: Attributes.arrow),
283 + SettingsItem(
284 + onTaped: () {},
285 + title: ItemHeaders.version,
286 + widget: null,
287 + attribute: Attributes.widget)
288 ]);
289 setState(() {});
290 }
lib/src/stores/settings/settings_store.dart
+5 -1
@@ -46,6 +46,8 @@ abstract class SettingsStoreBase with Store {
46 (dynamic _) => _sharedPreferences.setInt(displayActionListModeKey,
47 serializeActionlistDisplayModes(actionlistDisplayMode)),
48 fireImmediately: false);
49 +
50 + currentVersion = _sharedPreferences.getInt('current_default_settings_migration_version');
51 }
52
53 static const currentNodeIdKey = 'current_node_id';
@@ -143,6 +145,7 @@ abstract class SettingsStoreBase with Store {
145
146 SharedPreferences _sharedPreferences;
147 Box<Node> _nodes;
148 + int currentVersion;
149
150 @action
151 Future setAllowBiometricalAuthentication(
@@ -264,7 +267,8 @@ abstract class SettingsStoreBase with Store {
267 ItemHeaders.darkMode: S.current.settings_dark_mode,
268 ItemHeaders.support: S.current.settings_support,
269 ItemHeaders.termsAndConditions: S.current.settings_terms_and_conditions,
267 - ItemHeaders.faq: S.current.faq
270 + ItemHeaders.faq: S.current.faq,
271 + ItemHeaders.version: 'Version 1.0.$currentVersion'
272 });
273 }
274