Remove config after unlink, clear db when linked with new number

This commit is contained in:
Scott Nonnenberg 2018-02-23 17:40:02 -08:00 committed by Scott Nonnenberg
parent fd056e1b4c
commit 9acb189650
No known key found for this signature in database
GPG key ID: 5F82280C35134661
7 changed files with 108 additions and 11 deletions

View file

@ -913,9 +913,13 @@
}
function clearAllStores(idb_db) {
return clearStores(idb_db);
}
function clearStores(idb_db, names) {
return new Promise(function(resolve, reject) {
console.log('Clearing all indexeddb stores');
var storeNames = idb_db.objectStoreNames;
var storeNames = names || idb_db.objectStoreNames;
console.log('Clearing these indexeddb stores:', storeNames);
var transaction = idb_db.transaction(storeNames, 'readwrite');
var finished = false;
@ -930,7 +934,7 @@
transaction.oncomplete = finish.bind(null, 'transaction complete');
transaction.onerror = function(e) {
handleDOMException(
'clearAllStores transaction error',
'clearStores transaction error',
transaction.error,
reject
);
@ -953,7 +957,7 @@
request.onerror = function(e) {
handleDOMException(
'clearAllStores request error',
'clearStores request error',
request.error,
reject
);
@ -973,6 +977,11 @@
return clearAllStores(idb_db);
});
},
clearStores: function(storeNames) {
return openDatabase().then(function(idb_db) {
return clearStores(idb_db, storeNames);
});
},
getDirectoryForExport: function() {
var options = {
title: i18n('exportChooserTitle'),