Remove mobile app integration version check

This commit is contained in:
Yegor Vialov 2020-05-25 11:16:22 +00:00
parent 9608983994
commit a8efe7dbb6
2 changed files with 2 additions and 27 deletions

View File

@ -23,7 +23,6 @@ class AppSettings {
String fcmToken;
double haVersion;
bool scrollBadges;
int appIntegrationVersion;
AppTheme appTheme;
final int defaultLocationUpdateIntervalMinutes = 20;
Duration locationUpdateInterval;
@ -46,7 +45,6 @@ class AppSettings {
_port = prefs.getString('hassio-port');
webhookId = prefs.getString('app-webhook-id');
mobileAppDeviceName = prefs.getString('app-integration-device-name');
appIntegrationVersion = prefs.getInt('app-integration-version') ?? 0;
scrollBadges = prefs.getBool('scroll-badges') ?? true;
displayHostname = "$_domain:$_port";
webSocketAPIEndpoint =

View File

@ -2,8 +2,6 @@ part of '../main.dart';
class MobileAppIntegrationManager {
static const INTEGRATION_VERSION = 3;
static final _appRegistrationData = {
"device_name": "",
"app_version": "$appVersion",
@ -49,10 +47,8 @@ class MobileAppIntegrationManager {
Logger.d("Processing registration responce...");
var responseObject = json.decode(response);
AppSettings().webhookId = responseObject["webhook_id"];
AppSettings().appIntegrationVersion = INTEGRATION_VERSION;
AppSettings().save({
'app-webhook-id': responseObject["webhook_id"],
'app-integration-version': INTEGRATION_VERSION
'app-webhook-id': responseObject["webhook_id"]
}).then((prefs) {
completer.complete();
eventBus.fire(ShowPopupEvent(
@ -97,14 +93,9 @@ class MobileAppIntegrationManager {
if (registrationData == null || registrationData.isEmpty) {
Logger.w("No registration data in response. MobileApp integration was removed or broken");
_askToRegisterApp();
} else {
if (INTEGRATION_VERSION > AppSettings().appIntegrationVersion) {
Logger.d('App registration needs to be updated');
_askToRemoveAndRegisterApp();
} else {
Logger.d('App registration works fine');
}
}
completer.complete();
}).catchError((e) {
if (e is http.Response && e.statusCode == 410) {
@ -137,20 +128,6 @@ class MobileAppIntegrationManager {
));
}
static void _askToRemoveAndRegisterApp() {
eventBus.fire(ShowPopupEvent(
popup: Popup(
title: "Mobile app integration needs to be updated",
body: "You need to update HA Client integration to continue using notifications and location tracking. Please remove 'Mobile App' integration for this device from your Home Assistant and restart Home Assistant. Then go back to HA Client to create app integration again.",
positiveText: "Ok",
negativeText: "Report an issue",
onNegative: () {
Launcher.launchURLInBrowser("https://github.com/estevez-dev/ha_client/issues/new");
},
)
));
}
static void _askToRegisterApp() {
eventBus.fire(ShowPopupEvent(
popup: RegisterAppPopup(