summaryrefslogtreecommitdiffstats
path: root/src/features/todos/store.js
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2019-09-05 09:49:25 +0200
committerLibravatar Stefan Malzner <stefan@adlk.io>2019-09-05 09:49:25 +0200
commit24d0223fee38c36ec19d9c662579dba7d787f8b4 (patch)
tree17a50e725cef1266506fc9ac6352c15a120cba78 /src/features/todos/store.js
parentdon't warn on react/destructuring-assignment (diff)
downloadferdium-app-24d0223fee38c36ec19d9c662579dba7d787f8b4.tar.gz
ferdium-app-24d0223fee38c36ec19d9c662579dba7d787f8b4.tar.zst
ferdium-app-24d0223fee38c36ec19d9c662579dba7d787f8b4.zip
polishing
Diffstat (limited to 'src/features/todos/store.js')
-rw-r--r--src/features/todos/store.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/features/todos/store.js b/src/features/todos/store.js
index 56e117c6c..5c6abff4c 100644
--- a/src/features/todos/store.js
+++ b/src/features/todos/store.js
@@ -30,7 +30,7 @@ export default class TodoStore extends FeatureStore {
30 } 30 }
31 31
32 @computed get isTodosPanelVisible() { 32 @computed get isTodosPanelVisible() {
33 if (this.stores.services.all.length === 0 || delayAppState.isDelayAppScreenVisible) return false; 33 if (delayAppState.isDelayAppScreenVisible) return false;
34 if (this.settings.isTodosPanelVisible === undefined) return DEFAULT_TODOS_VISIBLE; 34 if (this.settings.isTodosPanelVisible === undefined) return DEFAULT_TODOS_VISIBLE;
35 35
36 return this.settings.isTodosPanelVisible; 36 return this.settings.isTodosPanelVisible;
@@ -61,6 +61,7 @@ export default class TodoStore extends FeatureStore {
61 61
62 this._allReactions = createReactions([ 62 this._allReactions = createReactions([
63 this._setFeatureEnabledReaction, 63 this._setFeatureEnabledReaction,
64 this._firstLaunchReaction,
64 ]); 65 ]);
65 66
66 this._registerReactions(this._allReactions); 67 this._registerReactions(this._allReactions);
@@ -146,4 +147,19 @@ export default class TodoStore extends FeatureStore {
146 147
147 this.isFeatureEnabled = isTodosEnabled; 148 this.isFeatureEnabled = isTodosEnabled;
148 }; 149 };
150
151 _firstLaunchReaction = () => {
152 const { stats } = this.stores.settings.all;
153
154 // Hide todos layer on first app start but show on second
155 if (stats.appStarts <= 1) {
156 this._updateSettings({
157 isTodosPanelVisible: false,
158 });
159 } else if (stats.appStarts <= 2) {
160 this._updateSettings({
161 isTodosPanelVisible: true,
162 });
163 }
164 };
149} 165}