Merge pull request #2814 from jryans/storage-edge-cases

Explicitly create `cryptoStore` in React SDK
pull/21833/head
J. Ryan Stinnett 2019-03-22 17:26:45 +00:00 committed by GitHub
commit 140e0d6a30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 4 deletions

View File

@ -48,10 +48,6 @@ export default function createMatrixClient(opts, useIndexedDb) {
useAuthorizationHeader: true,
};
if (localStorage) {
storeOpts.sessionStore = new Matrix.WebStorageSessionStore(localStorage);
}
if (indexedDB && localStorage && useIndexedDb) {
storeOpts.store = new Matrix.IndexedDBStore({
indexedDB: indexedDB,
@ -61,6 +57,16 @@ export default function createMatrixClient(opts, useIndexedDb) {
});
}
if (localStorage) {
storeOpts.sessionStore = new Matrix.WebStorageSessionStore(localStorage);
}
if (indexedDB && useIndexedDb) {
storeOpts.cryptoStore = new Matrix.IndexedDBCryptoStore(
indexedDB, "matrix-js-sdk:crypto",
);
}
opts = Object.assign(storeOpts, opts);
return Matrix.createClient(opts);