Merge pull request #4738 from dignow/refact/store_user_info

Refact/store user info
This commit is contained in:
RustDesk
2023-06-22 15:42:37 +08:00
committed by GitHub
4 changed files with 13 additions and 45 deletions

View File

@@ -101,13 +101,15 @@ class LoginRequest {
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['username'] = username ?? '';
data['password'] = password ?? '';
data['id'] = id ?? '';
data['uuid'] = uuid ?? '';
data['trustThisDevice'] = trustThisDevice ?? '';
data['type'] = type ?? '';
data['verificationCode'] = verificationCode ?? '';
if (username != null) data['username'] = username;
if (password != null) data['password'] = password;
if (id != null) data['id'] = id;
if (uuid != null) data['uuid'] = uuid;
if (trustThisDevice != null) data['trustThisDevice'] = trustThisDevice;
if (type != null) data['type'] = type;
if (verificationCode != null) {
data['verificationCode'] = verificationCode;
}
data['deviceInfo'] = deviceInfo;
return data;
}

View File

@@ -64,7 +64,7 @@ class UserModel {
try {
return json.decode(userInfo);
} catch (e) {
debugPrint('Failed to get local user info "$userInfo": $e');
debugPrint('Failed to get local user info, json decode "$userInfo": $e');
}
return null;
}