Merge branch 'client-refactor-remove-lazyloadingcheck' into 'master'
[Client] Remove lazyloadingcheck See merge request famedly/famedlysdk!257
This commit is contained in:
commit
31871235a5
|
@ -113,10 +113,6 @@ class Client {
|
|||
List<String> get matrixVersions => _matrixVersions;
|
||||
List<String> _matrixVersions;
|
||||
|
||||
/// Wheither the server supports lazy load members.
|
||||
bool get lazyLoadMembers => _lazyLoadMembers;
|
||||
bool _lazyLoadMembers = false;
|
||||
|
||||
/// Returns the current login state.
|
||||
bool isLogged() => accessToken != null;
|
||||
|
||||
|
@ -210,7 +206,7 @@ class Client {
|
|||
|
||||
/// Checks the supported versions of the Matrix protocol and the supported
|
||||
/// login types. Returns false if the server is not compatible with the
|
||||
/// client. Automatically sets [matrixVersions] and [lazyLoadMembers].
|
||||
/// client. Automatically sets [matrixVersions].
|
||||
/// Throws FormatException, TimeoutException and MatrixException on error.
|
||||
Future<bool> checkServer(serverUrl) async {
|
||||
try {
|
||||
|
@ -230,14 +226,6 @@ class Client {
|
|||
|
||||
_matrixVersions = versions;
|
||||
|
||||
if (versionResp.containsKey('unstable_features') &&
|
||||
versionResp['unstable_features'].containsKey('m.lazy_load_members')) {
|
||||
_lazyLoadMembers = versionResp['unstable_features']
|
||||
['m.lazy_load_members']
|
||||
? true
|
||||
: false;
|
||||
}
|
||||
|
||||
final loginResp =
|
||||
await jsonRequest(type: HTTPType.GET, action: '/client/r0/login');
|
||||
|
||||
|
@ -303,8 +291,7 @@ class Client {
|
|||
newHomeserver: homeserver,
|
||||
newDeviceName: initialDeviceDisplayName ?? '',
|
||||
newDeviceID: response['device_id'],
|
||||
newMatrixVersions: matrixVersions,
|
||||
newLazyLoadMembers: lazyLoadMembers);
|
||||
newMatrixVersions: matrixVersions);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
@ -346,7 +333,6 @@ class Client {
|
|||
newDeviceName: initialDeviceDisplayName ?? '',
|
||||
newDeviceID: loginResp['device_id'],
|
||||
newMatrixVersions: matrixVersions,
|
||||
newLazyLoadMembers: lazyLoadMembers,
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
@ -676,7 +662,6 @@ class Client {
|
|||
String newDeviceName,
|
||||
String newDeviceID,
|
||||
List<String> newMatrixVersions,
|
||||
bool newLazyLoadMembers,
|
||||
String newPrevBatch,
|
||||
String newOlmAccount,
|
||||
}) async {
|
||||
|
@ -686,7 +671,6 @@ class Client {
|
|||
_deviceID = newDeviceID;
|
||||
_deviceName = newDeviceName;
|
||||
_matrixVersions = newMatrixVersions;
|
||||
_lazyLoadMembers = newLazyLoadMembers;
|
||||
prevBatch = newPrevBatch;
|
||||
|
||||
// Try to create a new olm account or restore a previous one.
|
||||
|
@ -762,8 +746,8 @@ class Client {
|
|||
});
|
||||
_olmAccount?.free();
|
||||
storeAPI?.clear();
|
||||
_accessToken = _homeserver = _userID = _deviceID =
|
||||
_deviceName = _matrixVersions = _lazyLoadMembers = prevBatch = null;
|
||||
_accessToken = _homeserver =
|
||||
_userID = _deviceID = _deviceName = _matrixVersions = prevBatch = null;
|
||||
onLoginStateChanged.add(LoginState.loggedOut);
|
||||
}
|
||||
|
||||
|
|
|
@ -129,7 +129,6 @@ void main() {
|
|||
newDeviceName: 'Text Matrix Client',
|
||||
newDeviceID: resp['device_id'],
|
||||
newMatrixVersions: matrix.matrixVersions,
|
||||
newLazyLoadMembers: matrix.lazyLoadMembers,
|
||||
newOlmAccount: pickledOlmAccount,
|
||||
);
|
||||
|
||||
|
@ -281,7 +280,6 @@ void main() {
|
|||
expect(matrix.deviceID == null, true);
|
||||
expect(matrix.deviceName == null, true);
|
||||
expect(matrix.matrixVersions == null, true);
|
||||
expect(matrix.lazyLoadMembers == null, true);
|
||||
expect(matrix.prevBatch == null, true);
|
||||
|
||||
var loginState = await loginStateFuture;
|
||||
|
@ -654,7 +652,6 @@ void main() {
|
|||
'r0.4.0',
|
||||
'r0.5.0'
|
||||
],
|
||||
newLazyLoadMembers: true,
|
||||
newOlmAccount: pickledOlmAccount,
|
||||
);
|
||||
|
||||
|
@ -683,7 +680,6 @@ void main() {
|
|||
expect(client2.deviceID, client1.deviceID);
|
||||
expect(client2.deviceName, client1.deviceName);
|
||||
expect(client2.matrixVersions, client1.matrixVersions);
|
||||
expect(client2.lazyLoadMembers, client1.lazyLoadMembers);
|
||||
if (client2.encryptionEnabled) {
|
||||
expect(client2.pickledOlmAccount, client1.pickledOlmAccount);
|
||||
expect(json.encode(client2.rooms[1].sessionKeys[sessionKey]),
|
||||
|
|
|
@ -31,7 +31,6 @@ class FakeStore implements StoreAPI {
|
|||
newDeviceID: credentials['deviceID'],
|
||||
newDeviceName: credentials['deviceName'],
|
||||
newHomeserver: credentials['homeserver'],
|
||||
newLazyLoadMembers: credentials['lazyLoadMembers'],
|
||||
newMatrixVersions: List<String>.from(credentials['matrixVersions']),
|
||||
newToken: credentials['token'],
|
||||
newUserID: credentials['userID'],
|
||||
|
@ -47,7 +46,6 @@ class FakeStore implements StoreAPI {
|
|||
'deviceID': client.deviceID,
|
||||
'deviceName': client.deviceName,
|
||||
'homeserver': client.homeserver,
|
||||
'lazyLoadMembers': client.lazyLoadMembers,
|
||||
'matrixVersions': client.matrixVersions,
|
||||
'token': client.accessToken,
|
||||
'userID': client.userID,
|
||||
|
|
Loading…
Reference in a new issue