Merge branch 'client-refactor-clean-logs' into 'master'
[Client] Clean up logs See merge request famedly/famedlysdk!186
This commit is contained in:
commit
76d0167038
|
@ -885,13 +885,11 @@ class Client {
|
||||||
void _handleDeviceListsEvents(Map<String, dynamic> deviceLists) {
|
void _handleDeviceListsEvents(Map<String, dynamic> deviceLists) {
|
||||||
if (deviceLists["changed"] is List) {
|
if (deviceLists["changed"] is List) {
|
||||||
for (final userId in deviceLists["changed"]) {
|
for (final userId in deviceLists["changed"]) {
|
||||||
print("The device list of $userId has changed. Mark as outdated!");
|
|
||||||
if (_userDeviceKeys.containsKey(userId)) {
|
if (_userDeviceKeys.containsKey(userId)) {
|
||||||
_userDeviceKeys[userId].outdated = true;
|
_userDeviceKeys[userId].outdated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (final userId in deviceLists["left"]) {
|
for (final userId in deviceLists["left"]) {
|
||||||
print("The device list of $userId is no longer relevant! Remove it!");
|
|
||||||
if (_userDeviceKeys.containsKey(userId)) {
|
if (_userDeviceKeys.containsKey(userId)) {
|
||||||
_userDeviceKeys.remove(userId);
|
_userDeviceKeys.remove(userId);
|
||||||
}
|
}
|
||||||
|
@ -1220,8 +1218,6 @@ class Client {
|
||||||
Future<void> _updateUserDeviceKeys() async {
|
Future<void> _updateUserDeviceKeys() async {
|
||||||
Set<String> trackedUserIds = await _getUserIdsInEncryptedRooms();
|
Set<String> trackedUserIds = await _getUserIdsInEncryptedRooms();
|
||||||
trackedUserIds.add(this.userID);
|
trackedUserIds.add(this.userID);
|
||||||
print("We are tracking the devices of these users:");
|
|
||||||
print(trackedUserIds);
|
|
||||||
|
|
||||||
// Remove all userIds we no longer need to track the devices of.
|
// Remove all userIds we no longer need to track the devices of.
|
||||||
_userDeviceKeys
|
_userDeviceKeys
|
||||||
|
@ -1231,13 +1227,10 @@ class Client {
|
||||||
Map<String, dynamic> outdatedLists = {};
|
Map<String, dynamic> outdatedLists = {};
|
||||||
for (String userId in trackedUserIds) {
|
for (String userId in trackedUserIds) {
|
||||||
if (!userDeviceKeys.containsKey(userId)) {
|
if (!userDeviceKeys.containsKey(userId)) {
|
||||||
print("Create new device list for user $userId");
|
|
||||||
_userDeviceKeys[userId] = DeviceKeysList(userId);
|
_userDeviceKeys[userId] = DeviceKeysList(userId);
|
||||||
}
|
}
|
||||||
DeviceKeysList deviceKeysList = userDeviceKeys[userId];
|
DeviceKeysList deviceKeysList = userDeviceKeys[userId];
|
||||||
if (deviceKeysList.outdated) {
|
if (deviceKeysList.outdated) {
|
||||||
print(
|
|
||||||
"The device keys list of $userId is outdated. Add to the request");
|
|
||||||
outdatedLists[userId] = [];
|
outdatedLists[userId] = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1251,7 +1244,6 @@ class Client {
|
||||||
for (final rawDeviceKeyListEntry in response["device_keys"].entries) {
|
for (final rawDeviceKeyListEntry in response["device_keys"].entries) {
|
||||||
final String userId = rawDeviceKeyListEntry.key;
|
final String userId = rawDeviceKeyListEntry.key;
|
||||||
_userDeviceKeys[userId].deviceKeys = {};
|
_userDeviceKeys[userId].deviceKeys = {};
|
||||||
print("Got device key list of $userId. Store it now!");
|
|
||||||
for (final rawDeviceKeyEntry in rawDeviceKeyListEntry.value.entries) {
|
for (final rawDeviceKeyEntry in rawDeviceKeyListEntry.value.entries) {
|
||||||
_userDeviceKeys[userId].deviceKeys[rawDeviceKeyEntry.key] =
|
_userDeviceKeys[userId].deviceKeys[rawDeviceKeyEntry.key] =
|
||||||
DeviceKeys.fromJson(rawDeviceKeyEntry.value);
|
DeviceKeys.fromJson(rawDeviceKeyEntry.value);
|
||||||
|
|
Loading…
Reference in a new issue