Browse Source

Added IDB cleaning after upgrade

master
Igor Zhukov 10 years ago
parent
commit
c43e20692d
  1. 23
      app/js/lib/ng_utils.js
  2. 2
      app/js/message_composer.js
  3. 4
      app/less/app.less

23
app/js/lib/ng_utils.js

@ -339,7 +339,7 @@ angular.module('izhukov.utils', []) @@ -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', []) @@ -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);
}
};
request.onerror = function (event) {
@ -411,7 +397,12 @@ angular.module('izhukov.utils', []) @@ -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;

2
app/js/message_composer.js

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

4
app/less/app.less

@ -3138,8 +3138,8 @@ a.contacts_modal_contact:hover .md_modal_list_peer_description, @@ -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;

Loading…
Cancel
Save