2018-04-29 08:17:15 +00:00
|
|
|
import Vuex from 'vuex';
|
2018-05-20 17:13:39 +00:00
|
|
|
import createPersistedState from 'vuex-persistedstate';
|
2018-08-22 00:10:39 +00:00
|
|
|
import * as nestedProperty from 'nested-property';
|
2018-05-20 17:13:39 +00:00
|
|
|
|
2018-04-29 12:37:51 +00:00
|
|
|
import MiOS from './mios';
|
2018-05-27 04:49:09 +00:00
|
|
|
import { hostname } from './config';
|
2018-09-06 15:02:55 +00:00
|
|
|
import { erase } from '../../prelude/array';
|
2018-10-19 05:34:51 +00:00
|
|
|
import getNoteSummary from '../../misc/get-note-summary';
|
2018-04-29 08:17:15 +00:00
|
|
|
|
|
|
|
const defaultSettings = {
|
2018-06-05 18:03:56 +00:00
|
|
|
home: null,
|
2018-05-17 07:24:01 +00:00
|
|
|
mobileHome: [],
|
2018-06-05 18:12:06 +00:00
|
|
|
deck: null,
|
2018-10-18 21:18:33 +00:00
|
|
|
deckNav: true,
|
2018-09-17 00:00:20 +00:00
|
|
|
tagTimelines: [],
|
2018-04-29 08:17:15 +00:00
|
|
|
fetchOnScroll: true,
|
|
|
|
showMaps: true,
|
2018-11-16 14:13:37 +00:00
|
|
|
remainDeletedNote: false,
|
2018-04-29 08:17:15 +00:00
|
|
|
showPostFormOnTopOfTl: false,
|
2018-08-16 21:03:03 +00:00
|
|
|
suggestRecentHashtags: true,
|
2018-08-28 22:10:42 +00:00
|
|
|
showClockOnHeader: true,
|
2018-09-22 11:39:12 +00:00
|
|
|
useShadow: true,
|
|
|
|
roundedCorners: false,
|
2018-04-29 08:17:15 +00:00
|
|
|
circleIcons: true,
|
2018-09-06 20:45:13 +00:00
|
|
|
contrastedAcct: true,
|
2018-09-14 11:33:27 +00:00
|
|
|
showFullAcct: false,
|
2018-11-09 12:10:21 +00:00
|
|
|
showVia: true,
|
2018-04-29 08:17:15 +00:00
|
|
|
showReplyTarget: true,
|
|
|
|
showMyRenotes: true,
|
2018-05-25 11:19:14 +00:00
|
|
|
showRenotedMyNotes: true,
|
2018-08-16 14:59:22 +00:00
|
|
|
showLocalRenotes: true,
|
2018-05-25 11:19:14 +00:00
|
|
|
loadRemoteMedia: true,
|
2018-05-27 13:39:20 +00:00
|
|
|
disableViaMobile: false,
|
2018-06-18 08:25:20 +00:00
|
|
|
memo: null,
|
2018-06-23 07:55:52 +00:00
|
|
|
iLikeSushi: false,
|
2018-09-07 12:13:15 +00:00
|
|
|
rememberNoteVisibility: false,
|
|
|
|
defaultNoteVisibility: 'public',
|
2018-11-11 12:17:51 +00:00
|
|
|
mutedWords: [],
|
2018-08-22 00:10:39 +00:00
|
|
|
games: {
|
|
|
|
reversi: {
|
|
|
|
showBoardLabels: false,
|
|
|
|
useContrastStones: false
|
|
|
|
}
|
|
|
|
}
|
2018-04-29 08:17:15 +00:00
|
|
|
};
|
|
|
|
|
2018-05-20 17:13:39 +00:00
|
|
|
const defaultDeviceSettings = {
|
2018-09-16 12:40:48 +00:00
|
|
|
reduceMotion: false,
|
2018-05-20 17:13:39 +00:00
|
|
|
apiViaStream: true,
|
|
|
|
autoPopout: false,
|
2018-05-23 20:28:46 +00:00
|
|
|
darkmode: false,
|
2018-09-28 15:01:11 +00:00
|
|
|
darkTheme: 'dark',
|
|
|
|
lightTheme: 'light',
|
|
|
|
themes: [],
|
2018-05-20 17:13:39 +00:00
|
|
|
enableSounds: true,
|
|
|
|
soundVolume: 0.5,
|
|
|
|
lang: null,
|
|
|
|
preventUpdate: false,
|
|
|
|
debug: false,
|
|
|
|
lightmode: false,
|
2018-05-25 11:19:14 +00:00
|
|
|
loadRawImages: false,
|
2018-09-14 06:14:59 +00:00
|
|
|
alwaysShowNsfw: false,
|
2018-09-05 04:47:26 +00:00
|
|
|
postStyle: 'standard',
|
2018-10-14 10:44:30 +00:00
|
|
|
navbar: 'top',
|
2018-10-18 21:47:55 +00:00
|
|
|
deckColumnAlign: 'center',
|
2018-10-18 21:18:33 +00:00
|
|
|
mobileNotificationPosition: 'bottom',
|
2018-10-19 02:10:49 +00:00
|
|
|
deckTemporaryColumn: null,
|
2018-11-05 10:20:35 +00:00
|
|
|
deckDefault: false,
|
|
|
|
useOsDefaultEmojis: false
|
2018-05-20 17:13:39 +00:00
|
|
|
};
|
|
|
|
|
2018-04-29 08:17:15 +00:00
|
|
|
export default (os: MiOS) => new Vuex.Store({
|
2018-05-27 04:49:09 +00:00
|
|
|
plugins: [createPersistedState({
|
|
|
|
paths: ['i', 'device', 'settings']
|
2018-05-20 17:13:39 +00:00
|
|
|
})],
|
2018-04-29 08:17:15 +00:00
|
|
|
|
|
|
|
state: {
|
2018-05-27 04:49:09 +00:00
|
|
|
i: null,
|
2018-05-17 14:53:55 +00:00
|
|
|
indicate: false,
|
2018-10-18 21:18:33 +00:00
|
|
|
uiHeaderHeight: 0,
|
2018-10-19 05:34:51 +00:00
|
|
|
navHook: null,
|
|
|
|
behindNotes: []
|
2018-04-29 08:17:15 +00:00
|
|
|
},
|
|
|
|
|
2018-05-27 04:49:09 +00:00
|
|
|
getters: {
|
|
|
|
isSignedIn: state => state.i != null
|
|
|
|
},
|
|
|
|
|
2018-04-29 08:17:15 +00:00
|
|
|
mutations: {
|
2018-05-27 04:49:09 +00:00
|
|
|
updateI(state, x) {
|
|
|
|
state.i = x;
|
|
|
|
},
|
|
|
|
|
|
|
|
updateIKeyValue(state, x) {
|
|
|
|
state.i[x.key] = x.value;
|
|
|
|
},
|
|
|
|
|
2018-05-17 14:53:55 +00:00
|
|
|
indicate(state, x) {
|
|
|
|
state.indicate = x;
|
|
|
|
},
|
|
|
|
|
2018-04-29 08:17:15 +00:00
|
|
|
setUiHeaderHeight(state, height) {
|
|
|
|
state.uiHeaderHeight = height;
|
2018-10-18 21:18:33 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
navHook(state, callback) {
|
|
|
|
state.navHook = callback;
|
2018-10-19 05:34:51 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
pushBehindNote(state, note) {
|
|
|
|
if (note.userId === state.i.id) return;
|
|
|
|
if (state.behindNotes.some(n => n.id === note.id)) return;
|
|
|
|
state.behindNotes.push(note);
|
|
|
|
document.title = `(${state.behindNotes.length}) ${getNoteSummary(note)}`;
|
|
|
|
},
|
|
|
|
|
|
|
|
clearBehindNotes(state) {
|
|
|
|
state.behindNotes = [];
|
|
|
|
document.title = os.instanceName;
|
2018-04-29 08:17:15 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2018-05-27 04:49:09 +00:00
|
|
|
actions: {
|
|
|
|
login(ctx, i) {
|
|
|
|
ctx.commit('updateI', i);
|
|
|
|
ctx.dispatch('settings/merge', i.clientSettings);
|
|
|
|
},
|
|
|
|
|
|
|
|
logout(ctx) {
|
|
|
|
ctx.commit('updateI', null);
|
|
|
|
document.cookie = `i=; domain=${hostname}; expires=Thu, 01 Jan 1970 00:00:01 GMT;`;
|
|
|
|
},
|
|
|
|
|
|
|
|
mergeMe(ctx, me) {
|
|
|
|
Object.entries(me).forEach(([key, value]) => {
|
|
|
|
ctx.commit('updateIKeyValue', { key, value });
|
|
|
|
});
|
|
|
|
|
|
|
|
if (me.clientSettings) {
|
|
|
|
ctx.dispatch('settings/merge', me.clientSettings);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2018-04-29 08:17:15 +00:00
|
|
|
modules: {
|
2018-05-20 17:13:39 +00:00
|
|
|
device: {
|
|
|
|
namespaced: true,
|
|
|
|
|
|
|
|
state: defaultDeviceSettings,
|
|
|
|
|
|
|
|
mutations: {
|
|
|
|
set(state, x: { key: string; value: any }) {
|
|
|
|
state[x.key] = x.value;
|
2018-05-26 15:18:44 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
setTl(state, x) {
|
|
|
|
state.tl = {
|
|
|
|
src: x.src,
|
|
|
|
arg: x.arg
|
|
|
|
};
|
2018-08-17 07:35:04 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
setVisibility(state, visibility) {
|
|
|
|
state.visibility = visibility;
|
2018-05-20 17:13:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2018-04-29 08:17:15 +00:00
|
|
|
settings: {
|
|
|
|
namespaced: true,
|
|
|
|
|
2018-05-20 17:13:39 +00:00
|
|
|
state: defaultSettings,
|
2018-04-29 08:17:15 +00:00
|
|
|
|
|
|
|
mutations: {
|
|
|
|
set(state, x: { key: string; value: any }) {
|
2018-08-22 00:10:39 +00:00
|
|
|
nestedProperty.set(state, x.key, x.value);
|
2018-04-29 08:17:15 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
setHome(state, data) {
|
2018-05-20 17:13:39 +00:00
|
|
|
state.home = data;
|
2018-04-29 08:17:15 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
addHomeWidget(state, widget) {
|
2018-05-20 17:13:39 +00:00
|
|
|
state.home.unshift(widget);
|
2018-05-17 07:24:01 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
setMobileHome(state, data) {
|
2018-05-20 17:13:39 +00:00
|
|
|
state.mobileHome = data;
|
2018-05-17 07:24:01 +00:00
|
|
|
},
|
|
|
|
|
2018-06-06 10:22:45 +00:00
|
|
|
setWidget(state, x) {
|
|
|
|
let w;
|
|
|
|
|
|
|
|
//#region Decktop home
|
|
|
|
if (state.home) {
|
|
|
|
w = state.home.find(w => w.id == x.id);
|
|
|
|
if (w) {
|
|
|
|
w.data = x.data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
//#region Mobile home
|
|
|
|
if (state.mobileHome) {
|
|
|
|
w = state.mobileHome.find(w => w.id == x.id);
|
|
|
|
if (w) {
|
|
|
|
w.data = x.data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
//#region Deck
|
|
|
|
if (state.deck && state.deck.columns) {
|
|
|
|
state.deck.columns.filter(c => c.type == 'widgets').forEach(c => {
|
|
|
|
c.widgets.forEach(w => {
|
|
|
|
if (w.id == x.id) w.data = x.data;
|
|
|
|
});
|
|
|
|
});
|
2018-05-17 07:24:01 +00:00
|
|
|
}
|
2018-06-06 10:22:45 +00:00
|
|
|
//#endregion
|
2018-05-17 07:24:01 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
addMobileHomeWidget(state, widget) {
|
2018-05-20 17:13:39 +00:00
|
|
|
state.mobileHome.unshift(widget);
|
2018-05-17 07:24:01 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
removeMobileHomeWidget(state, widget) {
|
2018-05-20 17:13:39 +00:00
|
|
|
state.mobileHome = state.mobileHome.filter(w => w.id != widget.id);
|
2018-06-05 20:18:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
addDeckColumn(state, column) {
|
|
|
|
state.deck.columns.push(column);
|
2018-06-07 19:21:06 +00:00
|
|
|
state.deck.layout.push([column.id]);
|
2018-06-05 20:18:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
removeDeckColumn(state, id) {
|
|
|
|
state.deck.columns = state.deck.columns.filter(c => c.id != id);
|
2018-09-06 15:02:55 +00:00
|
|
|
state.deck.layout = state.deck.layout.map(ids => erase(id, ids));
|
2018-06-09 13:25:15 +00:00
|
|
|
state.deck.layout = state.deck.layout.filter(ids => ids.length > 0);
|
2018-06-05 20:18:08 +00:00
|
|
|
},
|
|
|
|
|
2018-06-07 23:38:32 +00:00
|
|
|
swapDeckColumn(state, x) {
|
|
|
|
const a = x.a;
|
|
|
|
const b = x.b;
|
|
|
|
const aX = state.deck.layout.findIndex(ids => ids.indexOf(a) != -1);
|
|
|
|
const aY = state.deck.layout[aX].findIndex(id => id == a);
|
|
|
|
const bX = state.deck.layout.findIndex(ids => ids.indexOf(b) != -1);
|
|
|
|
const bY = state.deck.layout[bX].findIndex(id => id == b);
|
|
|
|
state.deck.layout[aX][aY] = b;
|
|
|
|
state.deck.layout[bX][bY] = a;
|
|
|
|
},
|
|
|
|
|
2018-06-05 20:18:08 +00:00
|
|
|
swapLeftDeckColumn(state, id) {
|
2018-06-07 19:21:06 +00:00
|
|
|
state.deck.layout.some((ids, i) => {
|
|
|
|
if (ids.indexOf(id) != -1) {
|
|
|
|
const left = state.deck.layout[i - 1];
|
2018-06-05 20:18:08 +00:00
|
|
|
if (left) {
|
2018-06-07 19:21:06 +00:00
|
|
|
state.deck.layout[i - 1] = state.deck.layout[i];
|
|
|
|
state.deck.layout[i] = left;
|
2018-06-05 20:18:08 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
swapRightDeckColumn(state, id) {
|
2018-06-07 19:21:06 +00:00
|
|
|
state.deck.layout.some((ids, i) => {
|
|
|
|
if (ids.indexOf(id) != -1) {
|
|
|
|
const right = state.deck.layout[i + 1];
|
2018-06-05 20:18:08 +00:00
|
|
|
if (right) {
|
2018-06-07 19:21:06 +00:00
|
|
|
state.deck.layout[i + 1] = state.deck.layout[i];
|
|
|
|
state.deck.layout[i] = right;
|
2018-06-05 20:18:08 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
2018-06-06 10:22:45 +00:00
|
|
|
},
|
|
|
|
|
2018-06-07 19:34:15 +00:00
|
|
|
swapUpDeckColumn(state, id) {
|
|
|
|
const ids = state.deck.layout.find(ids => ids.indexOf(id) != -1);
|
|
|
|
ids.some((x, i) => {
|
|
|
|
if (x == id) {
|
|
|
|
const up = ids[i - 1];
|
|
|
|
if (up) {
|
|
|
|
ids[i - 1] = id;
|
|
|
|
ids[i] = up;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
swapDownDeckColumn(state, id) {
|
|
|
|
const ids = state.deck.layout.find(ids => ids.indexOf(id) != -1);
|
|
|
|
ids.some((x, i) => {
|
|
|
|
if (x == id) {
|
|
|
|
const down = ids[i + 1];
|
|
|
|
if (down) {
|
|
|
|
ids[i + 1] = id;
|
|
|
|
ids[i] = down;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2018-06-07 19:21:06 +00:00
|
|
|
stackLeftDeckColumn(state, id) {
|
|
|
|
const i = state.deck.layout.findIndex(ids => ids.indexOf(id) != -1);
|
2018-09-06 15:02:55 +00:00
|
|
|
state.deck.layout = state.deck.layout.map(ids => erase(id, ids));
|
2018-06-07 19:21:06 +00:00
|
|
|
const left = state.deck.layout[i - 1];
|
|
|
|
if (left) state.deck.layout[i - 1].push(id);
|
|
|
|
state.deck.layout = state.deck.layout.filter(ids => ids.length > 0);
|
|
|
|
},
|
|
|
|
|
|
|
|
popRightDeckColumn(state, id) {
|
|
|
|
const i = state.deck.layout.findIndex(ids => ids.indexOf(id) != -1);
|
2018-09-06 15:02:55 +00:00
|
|
|
state.deck.layout = state.deck.layout.map(ids => erase(id, ids));
|
2018-06-07 19:21:06 +00:00
|
|
|
state.deck.layout.splice(i + 1, 0, [id]);
|
|
|
|
state.deck.layout = state.deck.layout.filter(ids => ids.length > 0);
|
|
|
|
},
|
|
|
|
|
2018-06-06 10:22:45 +00:00
|
|
|
addDeckWidget(state, x) {
|
|
|
|
const column = state.deck.columns.find(c => c.id == x.id);
|
|
|
|
if (column == null) return;
|
|
|
|
column.widgets.unshift(x.widget);
|
|
|
|
},
|
|
|
|
|
|
|
|
removeDeckWidget(state, x) {
|
|
|
|
const column = state.deck.columns.find(c => c.id == x.id);
|
|
|
|
if (column == null) return;
|
|
|
|
column.widgets = column.widgets.filter(w => w.id != x.widget.id);
|
2018-06-06 21:13:57 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
renameDeckColumn(state, x) {
|
|
|
|
const column = state.deck.columns.find(c => c.id == x.id);
|
|
|
|
if (column == null) return;
|
|
|
|
column.name = x.name;
|
2018-04-29 08:17:15 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
actions: {
|
2018-04-29 08:54:50 +00:00
|
|
|
merge(ctx, settings) {
|
2018-06-05 17:48:26 +00:00
|
|
|
if (settings == null) return;
|
2018-04-29 08:54:50 +00:00
|
|
|
Object.entries(settings).forEach(([key, value]) => {
|
|
|
|
ctx.commit('set', { key, value });
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2018-04-29 08:17:15 +00:00
|
|
|
set(ctx, x) {
|
|
|
|
ctx.commit('set', x);
|
|
|
|
|
2018-05-27 04:49:09 +00:00
|
|
|
if (ctx.rootGetters.isSignedIn) {
|
2018-04-29 08:17:15 +00:00
|
|
|
os.api('i/update_client_setting', {
|
|
|
|
name: x.key,
|
|
|
|
value: x.value
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2018-06-06 10:22:45 +00:00
|
|
|
saveDeck(ctx) {
|
2018-06-05 20:18:08 +00:00
|
|
|
os.api('i/update_client_setting', {
|
|
|
|
name: 'deck',
|
|
|
|
value: ctx.state.deck
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2018-06-06 10:22:45 +00:00
|
|
|
addDeckColumn(ctx, column) {
|
|
|
|
ctx.commit('addDeckColumn', column);
|
|
|
|
ctx.dispatch('saveDeck');
|
|
|
|
},
|
|
|
|
|
2018-06-05 20:18:08 +00:00
|
|
|
removeDeckColumn(ctx, id) {
|
|
|
|
ctx.commit('removeDeckColumn', id);
|
2018-06-06 10:22:45 +00:00
|
|
|
ctx.dispatch('saveDeck');
|
2018-06-05 20:18:08 +00:00
|
|
|
},
|
|
|
|
|
2018-06-07 23:38:32 +00:00
|
|
|
swapDeckColumn(ctx, id) {
|
|
|
|
ctx.commit('swapDeckColumn', id);
|
|
|
|
ctx.dispatch('saveDeck');
|
|
|
|
},
|
|
|
|
|
2018-06-05 20:18:08 +00:00
|
|
|
swapLeftDeckColumn(ctx, id) {
|
|
|
|
ctx.commit('swapLeftDeckColumn', id);
|
2018-06-06 10:22:45 +00:00
|
|
|
ctx.dispatch('saveDeck');
|
2018-06-05 20:18:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
swapRightDeckColumn(ctx, id) {
|
|
|
|
ctx.commit('swapRightDeckColumn', id);
|
2018-06-06 10:22:45 +00:00
|
|
|
ctx.dispatch('saveDeck');
|
|
|
|
},
|
2018-06-05 20:18:08 +00:00
|
|
|
|
2018-06-07 19:34:15 +00:00
|
|
|
swapUpDeckColumn(ctx, id) {
|
|
|
|
ctx.commit('swapUpDeckColumn', id);
|
|
|
|
ctx.dispatch('saveDeck');
|
|
|
|
},
|
|
|
|
|
|
|
|
swapDownDeckColumn(ctx, id) {
|
|
|
|
ctx.commit('swapDownDeckColumn', id);
|
|
|
|
ctx.dispatch('saveDeck');
|
|
|
|
},
|
|
|
|
|
2018-06-07 19:21:06 +00:00
|
|
|
stackLeftDeckColumn(ctx, id) {
|
|
|
|
ctx.commit('stackLeftDeckColumn', id);
|
|
|
|
ctx.dispatch('saveDeck');
|
|
|
|
},
|
|
|
|
|
|
|
|
popRightDeckColumn(ctx, id) {
|
|
|
|
ctx.commit('popRightDeckColumn', id);
|
|
|
|
ctx.dispatch('saveDeck');
|
|
|
|
},
|
|
|
|
|
2018-06-06 10:22:45 +00:00
|
|
|
addDeckWidget(ctx, x) {
|
|
|
|
ctx.commit('addDeckWidget', x);
|
|
|
|
ctx.dispatch('saveDeck');
|
|
|
|
},
|
|
|
|
|
|
|
|
removeDeckWidget(ctx, x) {
|
|
|
|
ctx.commit('removeDeckWidget', x);
|
|
|
|
ctx.dispatch('saveDeck');
|
2018-06-05 20:18:08 +00:00
|
|
|
},
|
|
|
|
|
2018-06-06 21:13:57 +00:00
|
|
|
renameDeckColumn(ctx, x) {
|
|
|
|
ctx.commit('renameDeckColumn', x);
|
|
|
|
ctx.dispatch('saveDeck');
|
|
|
|
},
|
|
|
|
|
2018-04-29 08:17:15 +00:00
|
|
|
addHomeWidget(ctx, widget) {
|
|
|
|
ctx.commit('addHomeWidget', widget);
|
|
|
|
|
|
|
|
os.api('i/update_home', {
|
2018-05-20 17:13:39 +00:00
|
|
|
home: ctx.state.home
|
2018-04-29 08:17:15 +00:00
|
|
|
});
|
2018-05-17 07:24:01 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
addMobileHomeWidget(ctx, widget) {
|
|
|
|
ctx.commit('addMobileHomeWidget', widget);
|
|
|
|
|
|
|
|
os.api('i/update_mobile_home', {
|
2018-05-20 17:13:39 +00:00
|
|
|
home: ctx.state.mobileHome
|
2018-05-17 07:24:01 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
removeMobileHomeWidget(ctx, widget) {
|
|
|
|
ctx.commit('removeMobileHomeWidget', widget);
|
|
|
|
|
|
|
|
os.api('i/update_mobile_home', {
|
2018-05-20 17:13:39 +00:00
|
|
|
home: ctx.state.mobileHome.filter(w => w.id != widget.id)
|
2018-05-17 07:24:01 +00:00
|
|
|
});
|
2018-04-29 08:17:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|