app version and whats new

This commit is contained in:
Yegor Vialov 2020-05-06 18:19:41 +00:00
parent 02ea45469f
commit b86602bcdb
4 changed files with 10 additions and 8 deletions

View File

@ -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<void> _reportError(dynamic error, dynamic stackTrace) async {
// Print the exception to the console.

View File

@ -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"));
});
}

View File

@ -24,7 +24,7 @@ class _WhatsNewPageState extends State<WhatsNewPage> {
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;

View File

@ -4,6 +4,7 @@ import 'dart:io';
Future<void> 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';