This commit is contained in:
Bnyro 2022-08-01 14:50:53 +02:00
commit 5650752fcf

View file

@ -208,21 +208,17 @@ const mixin = {
return localSubscriptions.includes(channelId);
},
handleLocalSubscriptions(channelId) {
var localSubscriptions = this.getLocalSubscriptions();
if (localSubscriptions == null || localSubscriptions.size == 0) localSubscriptions = [channelId];
else if (localSubscriptions.includes(channelId))
var localSubscriptions = this.getLocalSubscriptions() ?? [];
if (localSubscriptions.includes(channelId))
localSubscriptions.splice(localSubscriptions.indexOf(channelId));
else localSubscriptions.push(channelId);
// Sort for better cache hits
localSubscriptions.sort();
localStorage.setItem("localSubscriptions", JSON.stringify(localSubscriptions));
},
getUnauthenticatedChannels() {
const localSubscriptions = this.getLocalSubscriptions();
var channels = "";
localSubscriptions.forEach((element, index) => {
channels += element;
if (localSubscriptions.size != index) channels += ",";
});
return channels;
return localSubscriptions.join(",");
},
importSubscriptionsLocally(newChannels) {
const subscriptions = this.getLocalSubscriptions().concat(newChannels);