move to new sdk

This commit is contained in:
Sorunome 2020-06-10 08:07:01 +00:00 committed by Christian Pauly
commit 6868f38c7c
26 changed files with 172 additions and 201 deletions

View file

@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:io';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:famedlysdk/encryption.dart';
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
import 'package:fluffychat/utils/firebase_controller.dart';
import 'package:flutter/foundation.dart';
@ -84,7 +85,7 @@ class MatrixState extends State<Matrix> {
}
}
Map<String, dynamic> getAuthByPassword(String password, String session) => {
Map<String, dynamic> getAuthByPassword(String password, [String session]) => {
'type': 'm.login.password',
'identifier': {
'type': 'm.id.user',
@ -92,7 +93,7 @@ class MatrixState extends State<Matrix> {
},
'user': client.userID,
'password': password,
'session': session,
if (session != null) 'session': session,
};
StreamSubscription onRoomKeyRequestSub;
@ -102,7 +103,7 @@ class MatrixState extends State<Matrix> {
final event = Event.fromJson(
eventUpdate.content, client.getRoomById(eventUpdate.roomID));
if (DateTime.now().millisecondsSinceEpoch -
event.time.millisecondsSinceEpoch >
event.originServerTs.millisecondsSinceEpoch >
1000 * 60 * 5) {
return;
}
@ -227,11 +228,12 @@ class _InheritedMatrix extends InheritedWidget {
@override
bool updateShouldNotify(_InheritedMatrix old) {
var update = old.data.client.accessToken != data.client.accessToken ||
old.data.client.userID != data.client.userID ||
old.data.client.deviceID != data.client.deviceID ||
old.data.client.deviceName != data.client.deviceName ||
old.data.client.homeserver != data.client.homeserver;
var update =
old.data.client.api.accessToken != data.client.api.accessToken ||
old.data.client.userID != data.client.userID ||
old.data.client.deviceID != data.client.deviceID ||
old.data.client.deviceName != data.client.deviceName ||
old.data.client.api.homeserver != data.client.api.homeserver;
return update;
}
}