diff options
author | 2019-04-16 11:46:37 +0200 | |
---|---|---|
committer | 2019-04-16 11:46:37 +0200 | |
commit | 936407669fed7677b5aa94aa4d29be0fe1ada163 (patch) | |
tree | 2ddd00b731e011424e59fbcdbb0484dd6fcdf369 /src/features | |
parent | increase app opens to show share franz overlay (diff) | |
parent | Add analytics events (diff) | |
download | ferdium-app-936407669fed7677b5aa94aa4d29be0fe1ada163.tar.gz ferdium-app-936407669fed7677b5aa94aa4d29be0fe1ada163.tar.zst ferdium-app-936407669fed7677b5aa94aa4d29be0fe1ada163.zip |
Merge branch 'feature/announcements' into develop
Diffstat (limited to 'src/features')
-rw-r--r-- | src/features/announcements/index.js | 2 | ||||
-rw-r--r-- | src/features/announcements/store.js | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/features/announcements/index.js b/src/features/announcements/index.js index c087689a7..4658b976f 100644 --- a/src/features/announcements/index.js +++ b/src/features/announcements/index.js | |||
@@ -3,6 +3,8 @@ import { AnnouncementsStore } from './store'; | |||
3 | 3 | ||
4 | const debug = require('debug')('Franz:feature:announcements'); | 4 | const debug = require('debug')('Franz:feature:announcements'); |
5 | 5 | ||
6 | export const GA_CATEGORY_ANNOUNCEMENTS = 'Announcements'; | ||
7 | |||
6 | export const announcementsStore = new AnnouncementsStore(); | 8 | export const announcementsStore = new AnnouncementsStore(); |
7 | 9 | ||
8 | export default function initAnnouncements(stores, actions) { | 10 | export default function initAnnouncements(stores, actions) { |
diff --git a/src/features/announcements/store.js b/src/features/announcements/store.js index 87cf08544..aa98d3bd1 100644 --- a/src/features/announcements/store.js +++ b/src/features/announcements/store.js | |||
@@ -8,10 +8,12 @@ import semver from 'semver'; | |||
8 | import localStorage from 'mobx-localstorage'; | 8 | import localStorage from 'mobx-localstorage'; |
9 | 9 | ||
10 | import { FeatureStore } from '../utils/FeatureStore'; | 10 | import { FeatureStore } from '../utils/FeatureStore'; |
11 | import { GA_CATEGORY_ANNOUNCEMENTS } from '.'; | ||
11 | import { getAnnouncementRequest, getChangelogRequest, getCurrentVersionRequest } from './api'; | 12 | import { getAnnouncementRequest, getChangelogRequest, getCurrentVersionRequest } from './api'; |
12 | import { announcementActions } from './actions'; | 13 | import { announcementActions } from './actions'; |
13 | import { createActionBindings } from '../utils/ActionBinding'; | 14 | import { createActionBindings } from '../utils/ActionBinding'; |
14 | import { createReactions } from '../../stores/lib/Reaction'; | 15 | import { createReactions } from '../../stores/lib/Reaction'; |
16 | import { gaEvent } from '../../lib/analytics'; | ||
15 | 17 | ||
16 | const LOCAL_STORAGE_KEY = 'announcements'; | 18 | const LOCAL_STORAGE_KEY = 'announcements'; |
17 | 19 | ||
@@ -98,6 +100,8 @@ export class AnnouncementsStore extends FeatureStore { | |||
98 | dispose(); | 100 | dispose(); |
99 | }, | 101 | }, |
100 | ); | 102 | ); |
103 | |||
104 | gaEvent(GA_CATEGORY_ANNOUNCEMENTS, 'show'); | ||
101 | }; | 105 | }; |
102 | 106 | ||
103 | @action _hideAnnouncement() { | 107 | @action _hideAnnouncement() { |
@@ -113,7 +117,7 @@ export class AnnouncementsStore extends FeatureStore { | |||
113 | 117 | ||
114 | // Check if the user has already used current version (= has seen the announcement) | 118 | // Check if the user has already used current version (= has seen the announcement) |
115 | const { currentVersion, lastSeenAnnouncementVersion } = this; | 119 | const { currentVersion, lastSeenAnnouncementVersion } = this; |
116 | if (semver.gt(currentVersion, lastSeenAnnouncementVersion)) { | 120 | if (semver.gt(currentVersion, lastSeenAnnouncementVersion || '0.0.0')) { |
117 | debug(`${currentVersion} < ${lastSeenAnnouncementVersion}: announcement is shown`); | 121 | debug(`${currentVersion} < ${lastSeenAnnouncementVersion}: announcement is shown`); |
118 | this._showAnnouncement(); | 122 | this._showAnnouncement(); |
119 | } | 123 | } |