Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 1b4570f

Browse files
authored
Merge pull request #2178 from matrix-org/bwindels/resynconlltoggle
resync when LL is toggled, show message when enabled
2 parents b9f57d8 + 9c78610 commit 1b4570f

File tree

3 files changed

+63
-7
lines changed

3 files changed

+63
-7
lines changed

src/Lifecycle.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import RtsClient from './RtsClient';
3131
import Modal from './Modal';
3232
import sdk from './index';
3333
import ActiveWidgetStore from './stores/ActiveWidgetStore';
34+
import PlatformPeg from "./PlatformPeg";
3435

3536
/**
3637
* Called at startup, to attempt to build a logged-in Matrix session. It tries
@@ -237,6 +238,27 @@ async function _restoreFromLocalStorage() {
237238
function _handleLoadSessionFailure(e) {
238239
console.log("Unable to load session", e);
239240

241+
if (e instanceof Matrix.InvalidStoreError) {
242+
if (e.reason === Matrix.InvalidStoreError.TOGGLED_LAZY_LOADING) {
243+
return Promise.resolve().then(() => {
244+
const lazyLoadEnabled = e.value;
245+
if (lazyLoadEnabled) {
246+
const LazyLoadingResyncDialog =
247+
sdk.getComponent("views.dialogs.LazyLoadingResyncDialog");
248+
return new Promise((resolve) => {
249+
Modal.createDialog(LazyLoadingResyncDialog, {
250+
onFinished: resolve,
251+
});
252+
});
253+
}
254+
}).then(() => {
255+
return MatrixClientPeg.get().store.deleteAllData();
256+
}).then(() => {
257+
PlatformPeg.get().reload();
258+
});
259+
}
260+
}
261+
240262
const def = Promise.defer();
241263
const SessionRestoreErrorDialog =
242264
sdk.getComponent('views.dialogs.SessionRestoreErrorDialog');
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
Copyright 2018 New Vector Ltd
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
import React from 'react';
18+
import QuestionDialog from './QuestionDialog';
19+
import { _t } from '../../../languageHandler';
20+
21+
export default (props) => {
22+
const description =
23+
_t("Riot now uses 3-5x less memory, by only loading information about other users when needed. Please wait whilst we resynchronise with the server!");
24+
25+
return (<QuestionDialog
26+
hasCancelButton={false}
27+
title={_t("Updating Riot")}
28+
description={<div>{description}</div>}
29+
button={_t("OK")}
30+
onFinished={props.onFinished}
31+
/>);
32+
};

src/i18n/strings/en_EN.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,13 @@
174174
"%(senderDisplayName)s removed the room name.": "%(senderDisplayName)s removed the room name.",
175175
"%(senderDisplayName)s changed the room name to %(roomName)s.": "%(senderDisplayName)s changed the room name to %(roomName)s.",
176176
"%(senderDisplayName)s sent an image.": "%(senderDisplayName)s sent an image.",
177+
"%(senderName)s added %(count)s %(addedAddresses)s as addresses for this room.|other": "%(senderName)s added %(addedAddresses)s as addresses for this room.",
178+
"%(senderName)s added %(count)s %(addedAddresses)s as addresses for this room.|one": "%(senderName)s added %(addedAddresses)s as an address for this room.",
179+
"%(senderName)s removed %(count)s %(removedAddresses)s as addresses for this room.|other": "%(senderName)s removed %(removedAddresses)s as addresses for this room.",
180+
"%(senderName)s removed %(count)s %(removedAddresses)s as addresses for this room.|one": "%(senderName)s removed %(removedAddresses)s as an address for this room.",
181+
"%(senderName)s added %(addedAddresses)s and removed %(removedAddresses)s as addresses for this room.": "%(senderName)s added %(addedAddresses)s and removed %(removedAddresses)s as addresses for this room.",
182+
"%(senderName)s set the main address for this room to %(address)s.": "%(senderName)s set the main address for this room to %(address)s.",
183+
"%(senderName)s removed the main address for this room.": "%(senderName)s removed the main address for this room.",
177184
"Someone": "Someone",
178185
"(not supported by this browser)": "(not supported by this browser)",
179186
"%(senderName)s answered the call.": "%(senderName)s answered the call.",
@@ -877,6 +884,8 @@
877884
"Ignore request": "Ignore request",
878885
"Loading device info...": "Loading device info...",
879886
"Encryption key request": "Encryption key request",
887+
"Riot now uses 3-5x less memory, by only loading information about other users when needed. Please wait whilst we resynchronise with the server!": "Riot now uses 3-5x less memory, by only loading information about other users when needed. Please wait whilst we resynchronise with the server!",
888+
"Updating Riot": "Updating Riot",
880889
"Failed to upgrade room": "Failed to upgrade room",
881890
"The room upgrade could not be completed": "The room upgrade could not be completed",
882891
"Upgrade this room to version %(version)s": "Upgrade this room to version %(version)s",
@@ -1246,13 +1255,6 @@
12461255
"Import room keys": "Import room keys",
12471256
"This process allows you to import encryption keys that you had previously exported from another Matrix client. You will then be able to decrypt any messages that the other client could decrypt.": "This process allows you to import encryption keys that you had previously exported from another Matrix client. You will then be able to decrypt any messages that the other client could decrypt.",
12481257
"The export file will be protected with a passphrase. You should enter the passphrase here, to decrypt the file.": "The export file will be protected with a passphrase. You should enter the passphrase here, to decrypt the file.",
1249-
"%(senderName)s added %(count)s %(addedAddresses)s as addresses for this room.|one": "%(senderName)s added %(addedAddresses)s as an address for this room.",
1250-
"%(senderName)s added %(count)s %(addedAddresses)s as addresses for this room.|other": "%(senderName)s added %(addedAddresses)s as addresses for this room.",
1251-
"%(senderName)s removed %(count)s %(removedAddresses)s as addresses for this room.|one": "%(senderName)s removed %(removedAddresses)s as an address for this room.",
1252-
"%(senderName)s removed %(count)s %(removedAddresses)s as addresses for this room.|other": "%(senderName)s removed %(removedAddresses)s as addresses for this room.",
1253-
"%(senderName)s added %(addedAddresses)s and removed %(removedAddresses)s as addresses for this room.": "%(senderName)s added %(addedAddresses)s and removed %(removedAddresses)s as addresses for this room.",
1254-
"%(senderName)s set the main address for this room to %(address)s.": "%(senderName)s set the main address for this room to %(address)s.",
1255-
"%(senderName)s removed the main address for this room.": "%(senderName)s removed the main address for this room.",
12561258
"File to import": "File to import",
12571259
"Import": "Import",
12581260
"Failed to set direct chat tag": "Failed to set direct chat tag",

0 commit comments

Comments
 (0)