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', [])
var dbName = 'cachedFiles'; var dbName = 'cachedFiles';
var dbStoreName = 'files'; var dbStoreName = 'files';
var dbVersion = 1; var dbVersion = 2;
var openDbPromise; var openDbPromise;
var storageIsAvailable = $window.indexedDB !== undefined && var storageIsAvailable = $window.indexedDB !== undefined &&
$window.IDBTransaction !== undefined; $window.IDBTransaction !== undefined;
@ -387,21 +387,7 @@ angular.module('izhukov.utils', [])
deferred.reject(error); 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) { request.onerror = function (event) {
@ -411,7 +397,12 @@ angular.module('izhukov.utils', [])
} }
request.onupgradeneeded = function (event) { 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; return openDbPromise = deferred.promise;

2
app/js/message_composer.js

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

4
app/less/app.less

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

Loading…
Cancel
Save