diff options
Diffstat (limited to 'src/features/announcements')
-rw-r--r-- | src/features/announcements/store.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/features/announcements/store.js b/src/features/announcements/store.js index 3c46828bb..b99309ca7 100644 --- a/src/features/announcements/store.js +++ b/src/features/announcements/store.js | |||
@@ -10,6 +10,8 @@ import localStorage from 'mobx-localstorage'; | |||
10 | import { FeatureStore } from '../utils/FeatureStore'; | 10 | import { FeatureStore } from '../utils/FeatureStore'; |
11 | import { getAnnouncementRequest, getChangelogRequest, getCurrentVersionRequest } from './api'; | 11 | import { getAnnouncementRequest, getChangelogRequest, getCurrentVersionRequest } from './api'; |
12 | import { announcementActions } from './actions'; | 12 | import { announcementActions } from './actions'; |
13 | import { createActionBindings } from '../utils/ActionBinding'; | ||
14 | import { createReactions } from '../../stores/lib/Reaction'; | ||
13 | 15 | ||
14 | const LOCAL_STORAGE_KEY = 'announcements'; | 16 | const LOCAL_STORAGE_KEY = 'announcements'; |
15 | 17 | ||
@@ -52,14 +54,15 @@ export class AnnouncementsStore extends FeatureStore { | |||
52 | this.actions = actions; | 54 | this.actions = actions; |
53 | getCurrentVersionRequest.execute(); | 55 | getCurrentVersionRequest.execute(); |
54 | 56 | ||
55 | this._registerActions([ | 57 | this._registerActions(createActionBindings([ |
56 | [announcementActions.show, this._showAnnouncement], | 58 | [announcementActions.show, this._showAnnouncement], |
57 | ]); | 59 | ])); |
58 | 60 | ||
59 | this._registerReactions([ | 61 | this._reactions = createReactions([ |
60 | this._fetchAnnouncements, | 62 | this._fetchAnnouncements, |
61 | this._showAnnouncementToUsersWhoUpdatedApp, | 63 | this._showAnnouncementToUsersWhoUpdatedApp, |
62 | ]); | 64 | ]); |
65 | this._registerReactions(this._reactions); | ||
63 | this.isFeatureActive = true; | 66 | this.isFeatureActive = true; |
64 | } | 67 | } |
65 | 68 | ||
@@ -105,7 +108,6 @@ export class AnnouncementsStore extends FeatureStore { | |||
105 | 108 | ||
106 | _showAnnouncementToUsersWhoUpdatedApp = () => { | 109 | _showAnnouncementToUsersWhoUpdatedApp = () => { |
107 | const { announcement, isNewUser } = this; | 110 | const { announcement, isNewUser } = this; |
108 | console.log(announcement, isNewUser); | ||
109 | // Check if there is an announcement and on't show announcements to new users | 111 | // Check if there is an announcement and on't show announcements to new users |
110 | if (!announcement || isNewUser) return; | 112 | if (!announcement || isNewUser) return; |
111 | 113 | ||
@@ -125,7 +127,7 @@ export class AnnouncementsStore extends FeatureStore { | |||
125 | _fetchAnnouncements = () => { | 127 | _fetchAnnouncements = () => { |
126 | const targetVersion = this.targetVersion || this.currentVersion; | 128 | const targetVersion = this.targetVersion || this.currentVersion; |
127 | if (!targetVersion) return; | 129 | if (!targetVersion) return; |
128 | getChangelogRequest.execute('5.0.1'); | 130 | getChangelogRequest.execute(targetVersion); |
129 | getAnnouncementRequest.execute('5.1.0'); | 131 | getAnnouncementRequest.execute(targetVersion); |
130 | } | 132 | } |
131 | } | 133 | } |