Files: 2034e26ec445a1737076fd296563818d32051af1 / app / sync / initialize / settings.js
670 bytesRaw
1 | const nest = require('depnest') |
2 | const merge = require('lodash/merge') |
3 | |
4 | exports.gives = nest('app.sync.initialize') |
5 | |
6 | exports.needs = nest({ |
7 | 'settings.sync.set': 'first', |
8 | 'settings.sync.get': 'first' |
9 | }) |
10 | |
11 | const defaults = { |
12 | onboarded: false, |
13 | language: 'en', |
14 | ticktack: { |
15 | websharemetrics: 'public', |
16 | electron: { |
17 | zoomFactor: 1 |
18 | }, |
19 | theme: 'light' |
20 | } |
21 | } |
22 | |
23 | exports.create = function (api) { |
24 | return nest('app.sync.initialize', initialiseSettings) |
25 | |
26 | function initialiseSettings () { |
27 | console.log('> initialise: default settings') |
28 | const { get, set } = api.settings.sync |
29 | const settings = merge({}, defaults, get()) |
30 | |
31 | set(settings) |
32 | } |
33 | } |
34 |
Built with git-ssb-web