fix: use TryGet.optional
This commit is contained in:
parent
6d6830505f
commit
46b2f8898e
|
|
@ -264,7 +264,8 @@ class OlmManager {
|
||||||
// and generate and upload more if not.
|
// and generate and upload more if not.
|
||||||
|
|
||||||
// If the server did not send us a count, assume it is 0
|
// If the server did not send us a count, assume it is 0
|
||||||
final keyCount = countJson?.tryGet<int>('signed_curve25519') ?? 0;
|
final keyCount =
|
||||||
|
countJson?.tryGet<int>('signed_curve25519', TryGet.optional) ?? 0;
|
||||||
|
|
||||||
// If the server does not support fallback keys, it will not tell us about them.
|
// If the server does not support fallback keys, it will not tell us about them.
|
||||||
// If the server supports them but has no key, upload a new one.
|
// If the server supports them but has no key, upload a new one.
|
||||||
|
|
|
||||||
|
|
@ -778,11 +778,12 @@ class FamedlySdkHiveDatabase extends DatabaseApi {
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
// calculate the status
|
// calculate the status
|
||||||
final newStatus = eventUpdate.content.tryGet<int>('status') ??
|
final newStatus =
|
||||||
eventUpdate.content
|
eventUpdate.content.tryGet<int>('status', TryGet.optional) ??
|
||||||
.tryGetMap<String, dynamic>('unsigned')
|
eventUpdate.content
|
||||||
?.tryGet<int>(messageSendingStatusKey) ??
|
.tryGetMap<String, dynamic>('unsigned', TryGet.optional)
|
||||||
2;
|
?.tryGet<int>(messageSendingStatusKey, TryGet.optional) ??
|
||||||
|
2;
|
||||||
|
|
||||||
final status = newStatus == -1 || prevEvent?.status == null
|
final status = newStatus == -1 || prevEvent?.status == null
|
||||||
? newStatus
|
? newStatus
|
||||||
|
|
@ -796,8 +797,8 @@ class FamedlySdkHiveDatabase extends DatabaseApi {
|
||||||
|
|
||||||
// In case this event has sent from this account we have a transaction ID
|
// In case this event has sent from this account we have a transaction ID
|
||||||
final transactionId = eventUpdate.content
|
final transactionId = eventUpdate.content
|
||||||
.tryGetMap<String, dynamic>('unsigned')
|
.tryGetMap<String, dynamic>('unsigned', TryGet.optional)
|
||||||
?.tryGet<String>('transaction_id');
|
?.tryGet<String>('transaction_id', TryGet.optional);
|
||||||
|
|
||||||
await _eventsBox.put(MultiKey(eventUpdate.roomID, eventId).toString(),
|
await _eventsBox.put(MultiKey(eventUpdate.roomID, eventId).toString(),
|
||||||
eventUpdate.content);
|
eventUpdate.content);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue