diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Menu.js | 13 | ||||
-rw-r--r-- | src/lib/analytics.js | 20 |
2 files changed, 30 insertions, 3 deletions
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index a4e41c17c..da2540274 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -6,6 +6,8 @@ import { isMac, ctrlKey, cmdKey } from '../environment'; | |||
6 | import { GA_CATEGORY_WORKSPACES, workspaceStore } from '../features/workspaces/index'; | 6 | import { GA_CATEGORY_WORKSPACES, workspaceStore } from '../features/workspaces/index'; |
7 | import { workspaceActions } from '../features/workspaces/actions'; | 7 | import { workspaceActions } from '../features/workspaces/actions'; |
8 | import { gaEvent } from './analytics'; | 8 | import { gaEvent } from './analytics'; |
9 | import { announcementActions } from '../features/announcements/actions'; | ||
10 | import { announcementsStore } from '../features/announcements'; | ||
9 | 11 | ||
10 | const { app, Menu, dialog } = remote; | 12 | const { app, Menu, dialog } = remote; |
11 | 13 | ||
@@ -158,6 +160,10 @@ const menuItems = defineMessages({ | |||
158 | id: 'menu.app.about', | 160 | id: 'menu.app.about', |
159 | defaultMessage: '!!!About Franz', | 161 | defaultMessage: '!!!About Franz', |
160 | }, | 162 | }, |
163 | announcement: { | ||
164 | id: 'menu.app.announcement', | ||
165 | defaultMessage: '!!!What\'s new?', | ||
166 | }, | ||
161 | settings: { | 167 | settings: { |
162 | id: 'menu.app.settings', | 168 | id: 'menu.app.settings', |
163 | defaultMessage: '!!!Settings', | 169 | defaultMessage: '!!!Settings', |
@@ -348,8 +354,11 @@ const _templateFactory = intl => [ | |||
348 | click() { shell.openExternal('https://meetfranz.com'); }, | 354 | click() { shell.openExternal('https://meetfranz.com'); }, |
349 | }, | 355 | }, |
350 | { | 356 | { |
351 | label: intl.formatMessage(menuItems.changelog), | 357 | label: intl.formatMessage(menuItems.announcement), |
352 | click() { shell.openExternal('https://github.com/meetfranz/franz/blob/master/CHANGELOG.md'); }, | 358 | click: () => { |
359 | announcementActions.show(); | ||
360 | }, | ||
361 | visible: window.franz.stores.user.isLoggedIn && announcementsStore.areNewsAvailable, | ||
353 | }, | 362 | }, |
354 | { | 363 | { |
355 | type: 'separator', | 364 | type: 'separator', |
diff --git a/src/lib/analytics.js b/src/lib/analytics.js index e7daa9d06..c305fdb00 100644 --- a/src/lib/analytics.js +++ b/src/lib/analytics.js | |||
@@ -1,5 +1,8 @@ | |||
1 | import { remote } from 'electron'; | 1 | import { remote } from 'electron'; |
2 | import { GA_ID } from '../config'; | 2 | import querystring from 'querystring'; |
3 | |||
4 | import { GA_ID, STATS_API } from '../config'; | ||
5 | import { isDevMode } from '../environment'; | ||
3 | 6 | ||
4 | const debug = require('debug')('Franz:Analytics'); | 7 | const debug = require('debug')('Franz:Analytics'); |
5 | 8 | ||
@@ -35,3 +38,18 @@ export function gaEvent(category, action, label) { | |||
35 | ga('send', 'event', category, action, label); | 38 | ga('send', 'event', category, action, label); |
36 | debug('GA track event', category, action, label); | 39 | debug('GA track event', category, action, label); |
37 | } | 40 | } |
41 | |||
42 | export function statsEvent(key, value) { | ||
43 | const params = { | ||
44 | key, | ||
45 | value: value || key, | ||
46 | platform: process.platform, | ||
47 | version: remote.app.getVersion(), | ||
48 | }; | ||
49 | |||
50 | debug('Send Franz stats event', params); | ||
51 | |||
52 | if (!isDevMode) { | ||
53 | window.fetch(`${STATS_API}/event/?${querystring.stringify(params)}`); | ||
54 | } | ||
55 | } | ||