[Flutter] Use deviceName instead of hostName for clients

This commit is contained in:
2025-12-18 14:51:15 +01:00
parent b2de793758
commit 54c4f873fc
6 changed files with 49 additions and 15 deletions

View File

@@ -99,7 +99,7 @@ class AppAuth extends ChangeNotifier implements TokenSource {
final user = await APIClient.getUser(DirectTokenSource(oldUserID, oldUserKey), oldUserID);
final client = await APIClient.addClient(DirectTokenSource(oldUserID, oldUserKey), fcmToken, Globals().deviceModel, Globals().version, Globals().hostname, Globals().clientType);
final client = await APIClient.addClient(DirectTokenSource(oldUserID, oldUserKey), fcmToken, Globals().deviceModel, Globals().version, Globals().nameForClient(), Globals().clientType);
set(user, client, oldUserKey, newTokenSend.token);
@@ -232,7 +232,7 @@ class AppAuth extends ChangeNotifier implements TokenSource {
return _user?.$1;
}
Future<Client?> loadClient({bool force = false, Duration? forceIfOlder = null}) async {
Future<Client?> loadClient({bool force = false, Duration? forceIfOlder = null, bool onlyCached = false}) async {
if (forceIfOlder != null && _client != null && _client!.$2.difference(DateTime.now()) > forceIfOlder) {
force = true;
}
@@ -245,6 +245,10 @@ class AppAuth extends ChangeNotifier implements TokenSource {
throw Exception('Not authenticated');
}
if (onlyCached) {
return null;
}
try {
final client = await APIClient.getClient(this, _clientID!);