Browse Source

Fixes in stickersets

master
Igor Zhukov 9 years ago
parent
commit
a7eaf37e86
  1. 19
      app/js/services.js

19
app/js/services.js

@ -1816,6 +1816,10 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
return docs[docID] || {_: 'documentEmpty'}; return docs[docID] || {_: 'documentEmpty'};
} }
function hasDoc (docID) {
return docs[docID] !== undefined;
}
function wrapForHistory (docID) { function wrapForHistory (docID) {
if (docsForHistory[docID] !== undefined) { if (docsForHistory[docID] !== undefined) {
return docsForHistory[docID]; return docsForHistory[docID];
@ -1984,6 +1988,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
return { return {
saveDoc: saveDoc, saveDoc: saveDoc,
getDoc: getDoc, getDoc: getDoc,
hasDoc: hasDoc,
wrapForHistory: wrapForHistory, wrapForHistory: wrapForHistory,
updateDocDownloaded: updateDocDownloaded, updateDocDownloaded: updateDocDownloaded,
downloadDoc: downloadDoc, downloadDoc: downloadDoc,
@ -2134,9 +2139,13 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
function getPopularStickers () { function getPopularStickers () {
return Storage.get('stickers_popular').then(function (popStickers) { return Storage.get('stickers_popular').then(function (popStickers) {
var result = []; var result = [];
var i, len, docID;
if (popStickers && popStickers.length) { if (popStickers && popStickers.length) {
for (var i = 0, len = popStickers.length; i < len; i++) { for (i = 0, len = popStickers.length; i < len; i++) {
result.push({id: popStickers[i][0], rate: popStickers[i][1]}); docID = popStickers[i][0];
if (AppDocsManager.hasDoc(docID)) {
result.push({id: docID, rate: popStickers[i][1]});
}
} }
}; };
return result; return result;
@ -2212,7 +2221,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
} }
resultStickersets.unshift({ resultStickersets.unshift({
id: 0, id: 0,
title: _('im_stickers_tab_recent'), title: _('im_stickers_tab_recent_raw'),
short_name: '', short_name: '',
installed: true, installed: true,
disabled: false, disabled: false,
@ -2333,7 +2342,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
} else { } else {
installedStickersets[set.id] = true; installedStickersets[set.id] = true;
} }
getStickers(true); Storage.remove('all_stickers').then(function () {
getStickers(true);
});
}); });
} }

Loading…
Cancel
Save