diff options
author | 2019-09-05 16:39:53 +0200 | |
---|---|---|
committer | 2019-09-05 16:39:53 +0200 | |
commit | ad2a3f3f87252711a9f3cc13916acf0fdff2949e (patch) | |
tree | 21f43223a2166033f2e309784f5c8fd9a7b1de33 /src/features | |
parent | Remove news item on CTA clicks (diff) | |
download | ferdium-app-ad2a3f3f87252711a9f3cc13916acf0fdff2949e.tar.gz ferdium-app-ad2a3f3f87252711a9f3cc13916acf0fdff2949e.tar.zst ferdium-app-ad2a3f3f87252711a9f3cc13916acf0fdff2949e.zip |
Fix delay app ux in combination with announcements
Diffstat (limited to 'src/features')
-rw-r--r-- | src/features/announcements/store.js | 5 | ||||
-rw-r--r-- | src/features/delayApp/index.js | 10 | ||||
-rw-r--r-- | src/features/todos/containers/TodosScreen.js | 2 | ||||
-rw-r--r-- | src/features/todos/store.js | 7 |
4 files changed, 18 insertions, 6 deletions
diff --git a/src/features/announcements/store.js b/src/features/announcements/store.js index de7ed2596..d58afbc8e 100644 --- a/src/features/announcements/store.js +++ b/src/features/announcements/store.js | |||
@@ -63,6 +63,11 @@ export class AnnouncementsStore extends FeatureStore { | |||
63 | return this.stores.settings.stats.appStarts <= 1; | 63 | return this.stores.settings.stats.appStarts <= 1; |
64 | } | 64 | } |
65 | 65 | ||
66 | @computed get isAnnouncementShown() { | ||
67 | const { router } = this.stores; | ||
68 | return router.location.pathname.includes('/announcements'); | ||
69 | } | ||
70 | |||
66 | async start(stores, actions) { | 71 | async start(stores, actions) { |
67 | debug('AnnouncementsStore::start'); | 72 | debug('AnnouncementsStore::start'); |
68 | this.stores = stores; | 73 | this.stores = stores; |
diff --git a/src/features/delayApp/index.js b/src/features/delayApp/index.js index 627537de7..c0029873a 100644 --- a/src/features/delayApp/index.js +++ b/src/features/delayApp/index.js | |||
@@ -44,14 +44,16 @@ export default function init(stores) { | |||
44 | config.delayDuration = globalConfig.wait !== undefined ? globalConfig.wait : DEFAULT_FEATURES_CONFIG.needToWaitToProceedConfig.wait; | 44 | config.delayDuration = globalConfig.wait !== undefined ? globalConfig.wait : DEFAULT_FEATURES_CONFIG.needToWaitToProceedConfig.wait; |
45 | 45 | ||
46 | autorun(() => { | 46 | autorun(() => { |
47 | if (stores.services.allDisplayed.length === 0) { | 47 | const { isAnnouncementShown } = stores.announcements; |
48 | debug('seas', stores.services.all.length); | 48 | if (stores.services.allDisplayed.length === 0 || isAnnouncementShown) { |
49 | shownAfterLaunch = true; | 49 | shownAfterLaunch = true; |
50 | setVisibility(false); | ||
50 | return; | 51 | return; |
51 | } | 52 | } |
52 | 53 | ||
53 | const diff = moment().diff(timeLastDelay); | 54 | const diff = moment().diff(timeLastDelay); |
54 | if ((stores.app.isFocused && diff >= config.delayOffset) || !shownAfterLaunch) { | 55 | const itsTimeToWait = diff >= config.delayOffset; |
56 | if (!isAnnouncementShown && ((stores.app.isFocused && itsTimeToWait) || !shownAfterLaunch)) { | ||
55 | debug(`App will be delayed for ${config.delayDuration / 1000}s`); | 57 | debug(`App will be delayed for ${config.delayDuration / 1000}s`); |
56 | 58 | ||
57 | setVisibility(true); | 59 | setVisibility(true); |
@@ -66,6 +68,8 @@ export default function init(stores) { | |||
66 | 68 | ||
67 | setVisibility(false); | 69 | setVisibility(false); |
68 | }, config.delayDuration + 1000); // timer needs to be able to hit 0 | 70 | }, config.delayDuration + 1000); // timer needs to be able to hit 0 |
71 | } else { | ||
72 | setVisibility(false); | ||
69 | } | 73 | } |
70 | }); | 74 | }); |
71 | } else { | 75 | } else { |
diff --git a/src/features/todos/containers/TodosScreen.js b/src/features/todos/containers/TodosScreen.js index 65afc985b..a5da0b014 100644 --- a/src/features/todos/containers/TodosScreen.js +++ b/src/features/todos/containers/TodosScreen.js | |||
@@ -11,7 +11,7 @@ import { todoActions } from '../actions'; | |||
11 | @inject('stores', 'actions') @observer | 11 | @inject('stores', 'actions') @observer |
12 | class TodosScreen extends Component { | 12 | class TodosScreen extends Component { |
13 | render() { | 13 | render() { |
14 | if (!todosStore || !todosStore.isFeatureActive) { | 14 | if (!todosStore || !todosStore.isFeatureActive || todosStore.isTodosPanelForceHidden) { |
15 | return null; | 15 | return null; |
16 | } | 16 | } |
17 | 17 | ||
diff --git a/src/features/todos/store.js b/src/features/todos/store.js index aebe0dcbe..ea05077ab 100644 --- a/src/features/todos/store.js +++ b/src/features/todos/store.js | |||
@@ -29,10 +29,13 @@ export default class TodoStore extends FeatureStore { | |||
29 | return width < TODOS_MIN_WIDTH ? TODOS_MIN_WIDTH : width; | 29 | return width < TODOS_MIN_WIDTH ? TODOS_MIN_WIDTH : width; |
30 | } | 30 | } |
31 | 31 | ||
32 | @computed get isTodosPanelForceHidden() { | ||
33 | const { isAnnouncementShown } = this.stores.announcements; | ||
34 | return delayAppState.isDelayAppScreenVisible || isAnnouncementShown; | ||
35 | } | ||
36 | |||
32 | @computed get isTodosPanelVisible() { | 37 | @computed get isTodosPanelVisible() { |
33 | if (delayAppState.isDelayAppScreenVisible) return false; | ||
34 | if (this.settings.isTodosPanelVisible === undefined) return DEFAULT_TODOS_VISIBLE; | 38 | if (this.settings.isTodosPanelVisible === undefined) return DEFAULT_TODOS_VISIBLE; |
35 | |||
36 | return this.settings.isTodosPanelVisible; | 39 | return this.settings.isTodosPanelVisible; |
37 | } | 40 | } |
38 | 41 | ||