WIP #523 Change device name for integration
This commit is contained in:
@ -19,6 +19,7 @@ class ConnectionManager {
|
||||
String _tempToken;
|
||||
String oauthUrl;
|
||||
String webhookId;
|
||||
String mobileAppDeviceName;
|
||||
bool settingsLoaded = false;
|
||||
int appIntegrationVersion;
|
||||
bool get isAuthenticated => _token != null;
|
||||
@ -45,6 +46,7 @@ class ConnectionManager {
|
||||
_port = prefs.getString('hassio-port');
|
||||
webhookId = prefs.getString('app-webhook-id');
|
||||
appIntegrationVersion = prefs.getInt('app-integration-version') ?? 0;
|
||||
mobileAppDeviceName = prefs.getString('app-integration-device-name');
|
||||
displayHostname = "$_domain:$_port";
|
||||
_webSocketAPIEndpoint =
|
||||
"${prefs.getString('hassio-protocol')}://$_domain:$_port/api/websocket";
|
||||
|
@ -16,9 +16,13 @@ class MobileAppIntegrationManager {
|
||||
}
|
||||
};
|
||||
|
||||
static String getDefaultDeviceName() {
|
||||
return '${HomeAssistant().userName}\'s ${DeviceInfoManager().model}';
|
||||
}
|
||||
|
||||
static Future checkAppRegistration({bool forceRegister: false, bool showOkDialog: false}) {
|
||||
Completer completer = Completer();
|
||||
_appRegistrationData["device_name"] = "${HomeAssistant().userName}'s ${DeviceInfoManager().model}";
|
||||
_appRegistrationData["device_name"] = ConnectionManager().mobileAppDeviceName ?? getDefaultDeviceName();
|
||||
(_appRegistrationData["app_data"] as Map)["push_token"] = "${HomeAssistant().fcmToken}";
|
||||
if (ConnectionManager().webhookId == null || forceRegister) {
|
||||
Logger.d("Mobile app was not registered yet or need to be reseted. Registering...");
|
||||
|
Reference in New Issue
Block a user