Added IDB cleaning after upgrade

This commit is contained in:
Igor Zhukov 2015-07-09 20:01:17 +03:00
parent 7a8a221fa9
commit c43e20692d
3 changed files with 13 additions and 20 deletions

View File

@ -339,7 +339,7 @@ angular.module('izhukov.utils', [])
var dbName = 'cachedFiles';
var dbStoreName = 'files';
var dbVersion = 1;
var dbVersion = 2;
var openDbPromise;
var storageIsAvailable = $window.indexedDB !== undefined &&
$window.IDBTransaction !== undefined;
@ -387,21 +387,7 @@ angular.module('izhukov.utils', [])
deferred.reject(error);
};
// Interim solution for Google Chrome to create an objectStore. Will be deprecated
if (db.setVersion) {
if (db.version != dbVersion) {
db.setVersion(dbVersion).onsuccess = function () {
createObjectStore(db);
deferred.resolve(db);
};
}
else {
deferred.resolve(db);
}
}
else {
deferred.resolve(db);
}
deferred.resolve(db);
};
request.onerror = function (event) {
@ -411,7 +397,12 @@ angular.module('izhukov.utils', [])
}
request.onupgradeneeded = function (event) {
createObjectStore(event.target.result);
console.warn('performing idb upgrade from', event.oldVersion, 'to', event.newVersion);
var db = event.target.result;
if (event.oldVersion == 1) {
db.deleteObjectStore(dbStoreName);
}
createObjectStore(db);
};
return openDbPromise = deferred.promise;

View File

@ -1225,7 +1225,9 @@ Scroller.prototype.updateHeight = function () {
} else {
height = this.scroller[0].offsetHeight;
}
$(this.scroller).nanoScroller();
if (this.useNano) {
$(this.scroller).nanoScroller();
}
return height;
}

View File

@ -3138,8 +3138,8 @@ a.contacts_modal_contact:hover .md_modal_list_peer_description,
height: 96px;
}
.stickerset_modal_sticker img {
width: 96px;
height: 96px;
max-width: 96px;
max-height: 96px;
}
.stickerset_modal_sticker_alt {
position: absolute;