Resolves #567 Login connection timeout issue
This commit is contained in:
		| @@ -108,7 +108,7 @@ class AppSettings { | |||||||
|     Hive.box(DEFAULT_HIVE_BOX).delete(AUTH_TOKEN_KEY); |     Hive.box(DEFAULT_HIVE_BOX).delete(AUTH_TOKEN_KEY); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   Future saveLongLivedToken(token) async { |   void saveLongLivedToken(token) { | ||||||
|     longLivedToken = token; |     longLivedToken = token; | ||||||
|     tempToken = null; |     tempToken = null; | ||||||
|     Hive.box(DEFAULT_HIVE_BOX).put(AUTH_TOKEN_KEY, longLivedToken); |     Hive.box(DEFAULT_HIVE_BOX).put(AUTH_TOKEN_KEY, longLivedToken); | ||||||
|   | |||||||
| @@ -254,6 +254,7 @@ class ConnectionManager { | |||||||
|     sendSocketMessage(type: "auth/long_lived_access_token", additionalData: {"client_name": "HA Client app ${DateTime.now().millisecondsSinceEpoch}", "lifespan": 365}).then((data) { |     sendSocketMessage(type: "auth/long_lived_access_token", additionalData: {"client_name": "HA Client app ${DateTime.now().millisecondsSinceEpoch}", "lifespan": 365}).then((data) { | ||||||
|       Logger.d("Got long-lived token."); |       Logger.d("Got long-lived token."); | ||||||
|       AppSettings().saveLongLivedToken(data); |       AppSettings().saveLongLivedToken(data); | ||||||
|  |       completer.complete(); | ||||||
|     }).catchError((e) { |     }).catchError((e) { | ||||||
|       completer.completeError(HACException("Authentication error: $e", actions: [HAErrorAction.reload(title: "Retry"), HAErrorAction.loginAgain(title: "Relogin")])); |       completer.completeError(HACException("Authentication error: $e", actions: [HAErrorAction.reload(title: "Retry"), HAErrorAction.loginAgain(title: "Relogin")])); | ||||||
|     }); |     }); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user