1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-28 15:22:05 +03:00

Remove unused option for disabling IndexedDB

`createMatrixClient` and surrounding paths support an argument to disable
IndexedDB, but it is never actually used. This removes the option to simplify
the code.
This commit is contained in:
J. Ryan Stinnett
2019-03-25 16:22:53 +00:00
parent dbc4735b06
commit 90dbeefcfb
2 changed files with 5 additions and 10 deletions

View File

@ -171,7 +171,7 @@ class MatrixClientPeg {
return matches[1]; return matches[1];
} }
_createClient(creds: MatrixClientCreds, useIndexedDb) { _createClient(creds: MatrixClientCreds) {
const opts = { const opts = {
baseUrl: creds.homeserverUrl, baseUrl: creds.homeserverUrl,
idBaseUrl: creds.identityServerUrl, idBaseUrl: creds.identityServerUrl,
@ -183,7 +183,7 @@ class MatrixClientPeg {
verificationMethods: [verificationMethods.SAS] verificationMethods: [verificationMethods.SAS]
}; };
this.matrixClient = createMatrixClient(opts, useIndexedDb); this.matrixClient = createMatrixClient(opts);
// we're going to add eventlisteners for each matrix event tile, so the // we're going to add eventlisteners for each matrix event tile, so the
// potential number of event listeners is quite high. // potential number of event listeners is quite high.

View File

@ -32,23 +32,18 @@ try {
* @param {Object} opts options to pass to Matrix.createClient. This will be * @param {Object} opts options to pass to Matrix.createClient. This will be
* extended with `sessionStore` and `store` members. * extended with `sessionStore` and `store` members.
* *
* @param {bool} useIndexedDb True to attempt to use indexeddb, or false to force
* use of the memory store. Default: true.
*
* @property {string} indexedDbWorkerScript Optional URL for a web worker script * @property {string} indexedDbWorkerScript Optional URL for a web worker script
* for IndexedDB store operations. By default, indexeddb ops are done on * for IndexedDB store operations. By default, indexeddb ops are done on
* the main thread. * the main thread.
* *
* @returns {MatrixClient} the newly-created MatrixClient * @returns {MatrixClient} the newly-created MatrixClient
*/ */
export default function createMatrixClient(opts, useIndexedDb) { export default function createMatrixClient(opts) {
if (useIndexedDb === undefined) useIndexedDb = true;
const storeOpts = { const storeOpts = {
useAuthorizationHeader: true, useAuthorizationHeader: true,
}; };
if (indexedDB && localStorage && useIndexedDb) { if (indexedDB && localStorage) {
storeOpts.store = new Matrix.IndexedDBStore({ storeOpts.store = new Matrix.IndexedDBStore({
indexedDB: indexedDB, indexedDB: indexedDB,
dbName: "riot-web-sync", dbName: "riot-web-sync",
@ -61,7 +56,7 @@ export default function createMatrixClient(opts, useIndexedDb) {
storeOpts.sessionStore = new Matrix.WebStorageSessionStore(localStorage); storeOpts.sessionStore = new Matrix.WebStorageSessionStore(localStorage);
} }
if (indexedDB && useIndexedDb) { if (indexedDB) {
storeOpts.cryptoStore = new Matrix.IndexedDBCryptoStore( storeOpts.cryptoStore = new Matrix.IndexedDBCryptoStore(
indexedDB, "matrix-js-sdk:crypto", indexedDB, "matrix-js-sdk:crypto",
); );