aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/shareFranz/index.js
blob: 9add0f65efb51864fc220315d64d09d545e5d607 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { reaction } from 'mobx';
import ms from 'ms';
import { state as ModalState } from './store';

export { default as Component } from './Component';

const debug = require('debug')('Ferdi:feature:shareFranz');

const state = ModalState;

export default function initialize(stores) {
  debug('Initialize shareFerdi feature');

  window.ferdi.features.shareFerdi = {
    state,
  };

  function showModal() {
    debug('Would have showed share window');
  }

  reaction(
    () => stores.user.isLoggedIn,
    () => {
      setTimeout(() => {
        if (stores.settings.stats.appStarts % 50 === 0) {
          showModal();
        }
      }, ms('2s'));
    },
    {
      fireImmediately: true,
    },
  );
}