diff --git a/lib/main.dart b/lib/main.dart index 99d006e..a1467b6 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -157,10 +157,11 @@ part 'popups.dart'; EventBus eventBus = new EventBus(); final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = new FlutterLocalNotificationsPlugin(); -const String appName = "HA Client"; -const appVersionNumber = "1.0.1"; -const appVersionAdd = ""; -const appVersion = "$appVersionNumber$appVersionAdd"; +const String appName = 'HA Client'; +const appVersionNumber = '1.0.1'; +final String appVersionAdd = secrets['version_type'] ?? ''; +final String appVersion = '$appVersionNumber${appVersionAdd.isNotEmpty ? '-' : ''}$appVersionAdd'; +const whatsNewUrl = 'http://ha-client.app/service/whats_new_1.0.1.md'; Future _reportError(dynamic error, dynamic stackTrace) async { // Print the exception to the console. diff --git a/lib/managers/startup_user_messages_manager.class.dart b/lib/managers/startup_user_messages_manager.class.dart index 09dcfe8..19d045c 100644 --- a/lib/managers/startup_user_messages_manager.class.dart +++ b/lib/managers/startup_user_messages_manager.class.dart @@ -14,13 +14,13 @@ class StartupUserMessagesManager { bool _supportAppDevelopmentMessageShown; bool _whatsNewMessageShown; static final _supportAppDevelopmentMessageKey = "user-message-shown-support-development_3"; - static final _whatsNewMessageKey = "user-message-shown-whats-new-1006"; + static final _whatsNewMessageKey = "user-msg-whats-new-url"; void checkMessagesToShow() async { SharedPreferences prefs = await SharedPreferences.getInstance(); await prefs.reload(); _supportAppDevelopmentMessageShown = prefs.getBool(_supportAppDevelopmentMessageKey) ?? false; - _whatsNewMessageShown = prefs.getBool(_whatsNewMessageKey) ?? false; + _whatsNewMessageShown = '${prefs.getString(_whatsNewMessageKey)}' == whatsNewUrl; if (!_whatsNewMessageShown) { _showWhatsNewMessage(); } else if (!_supportAppDevelopmentMessageShown) { @@ -52,7 +52,7 @@ class StartupUserMessagesManager { void _showWhatsNewMessage() { SharedPreferences.getInstance().then((prefs) { - prefs.setBool(_whatsNewMessageKey, true); + prefs.setString(_whatsNewMessageKey, whatsNewUrl); eventBus.fire(ShowPageEvent(path: "/whats-new")); }); } diff --git a/lib/pages/whats_new.page.dart b/lib/pages/whats_new.page.dart index aed5f58..2be0cb8 100644 --- a/lib/pages/whats_new.page.dart +++ b/lib/pages/whats_new.page.dart @@ -24,7 +24,7 @@ class _WhatsNewPageState extends State { error = ""; }); http.Response response; - response = await http.get("http://ha-client.app/service/whats_new_1.0.0_stable.md"); + response = await http.get(whatsNewUrl); if (response.statusCode == 200) { setState(() { data = response.body; diff --git a/tool/secrets.dart b/tool/secrets.dart index 1e13d8d..986af0c 100644 --- a/tool/secrets.dart +++ b/tool/secrets.dart @@ -4,6 +4,7 @@ import 'dart:io'; Future main() async { final config = { 'syncfusion_license_key': Platform.environment['SYNCFUSION_LICENSE_KEY'], + 'version_type': Platform.environment['HA_CLIENT_VERSION_TYPE'] }; final filename = 'lib/.secrets.dart';