aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Menu.js24
-rw-r--r--src/lib/Tray.js6
-rw-r--r--src/lib/analytics.js55
3 files changed, 13 insertions, 72 deletions
diff --git a/src/lib/Menu.js b/src/lib/Menu.js
index 81efaf18f..13b31bcad 100644
--- a/src/lib/Menu.js
+++ b/src/lib/Menu.js
@@ -3,9 +3,8 @@ import { observable, autorun } from 'mobx';
3import { defineMessages } from 'react-intl'; 3import { defineMessages } from 'react-intl';
4 4
5import { isMac, ctrlKey, cmdKey } from '../environment'; 5import { isMac, ctrlKey, cmdKey } from '../environment';
6import { GA_CATEGORY_WORKSPACES, workspaceStore } from '../features/workspaces/index'; 6import { workspaceStore } from '../features/workspaces/index';
7import { workspaceActions } from '../features/workspaces/actions'; 7import { workspaceActions } from '../features/workspaces/actions';
8import { gaEvent } from './analytics';
9import { announcementActions } from '../features/announcements/actions'; 8import { announcementActions } from '../features/announcements/actions';
10import { announcementsStore } from '../features/announcements'; 9import { announcementsStore } from '../features/announcements';
11import TodoStore from '../features/todos/store'; 10import TodoStore from '../features/todos/store';
@@ -141,7 +140,7 @@ const menuItems = defineMessages({
141 }, 140 },
142 debugInfoCopiedHeadline: { 141 debugInfoCopiedHeadline: {
143 id: 'menu.help.debugInfoCopiedHeadline', 142 id: 'menu.help.debugInfoCopiedHeadline',
144 defaultMessage: '!!!Franz Debug Information', 143 defaultMessage: '!!!Ferdi Debug Information',
145 }, 144 },
146 debugInfoCopiedBody: { 145 debugInfoCopiedBody: {
147 id: 'menu.help.debugInfoCopiedBody', 146 id: 'menu.help.debugInfoCopiedBody',
@@ -262,7 +261,7 @@ const menuItems = defineMessages({
262}); 261});
263 262
264function getActiveWebview() { 263function getActiveWebview() {
265 return window.franz.stores.services.active.webview; 264 return window.ferdi.stores.services.active.webview;
266} 265}
267 266
268const _templateFactory = intl => [ 267const _templateFactory = intl => [
@@ -398,7 +397,7 @@ const _templateFactory = intl => [
398 click: () => { 397 click: () => {
399 announcementActions.show(); 398 announcementActions.show();
400 }, 399 },
401 visible: window.franz.stores.user.isLoggedIn && announcementsStore.areNewsAvailable, 400 visible: window.ferdi.stores.user.isLoggedIn && announcementsStore.areNewsAvailable,
402 }, 401 },
403 { 402 {
404 type: 'separator', 403 type: 'separator',
@@ -620,11 +619,11 @@ export default class FranzMenu {
620 // need to clone object so we don't modify computed (cached) object 619 // need to clone object so we don't modify computed (cached) object
621 const serviceTpl = Object.assign([], this.serviceTpl()); 620 const serviceTpl = Object.assign([], this.serviceTpl());
622 621
623 if (window.franz === undefined) { 622 if (window.ferdi === undefined) {
624 return; 623 return;
625 } 624 }
626 625
627 const { intl } = window.franz; 626 const { intl } = window.ferdi;
628 const tpl = isMac ? _templateFactory(intl) : _titleBarTemplateFactory(intl); 627 const tpl = isMac ? _templateFactory(intl) : _titleBarTemplateFactory(intl);
629 628
630 tpl[1].submenu.push({ 629 tpl[1].submenu.push({
@@ -821,7 +820,7 @@ export default class FranzMenu {
821 } 820 }
822 821
823 serviceTpl() { 822 serviceTpl() {
824 const { intl } = window.franz; 823 const { intl } = window.ferdi;
825 const { user, services, settings } = this.stores; 824 const { user, services, settings } = this.stores;
826 if (!user.isLoggedIn) return []; 825 if (!user.isLoggedIn) return [];
827 const menu = []; 826 const menu = [];
@@ -867,7 +866,7 @@ export default class FranzMenu {
867 866
868 workspacesMenu() { 867 workspacesMenu() {
869 const { workspaces, activeWorkspace, isWorkspaceDrawerOpen } = workspaceStore; 868 const { workspaces, activeWorkspace, isWorkspaceDrawerOpen } = workspaceStore;
870 const { intl } = window.franz; 869 const { intl } = window.ferdi;
871 const menu = []; 870 const menu = [];
872 871
873 // Add new workspace item: 872 // Add new workspace item:
@@ -889,7 +888,6 @@ export default class FranzMenu {
889 accelerator: `${cmdKey}+D`, 888 accelerator: `${cmdKey}+D`,
890 click: () => { 889 click: () => {
891 workspaceActions.toggleWorkspaceDrawer(); 890 workspaceActions.toggleWorkspaceDrawer();
892 gaEvent(GA_CATEGORY_WORKSPACES, 'toggleDrawer', 'menu');
893 }, 891 },
894 enabled: this.stores.user.isLoggedIn, 892 enabled: this.stores.user.isLoggedIn,
895 }, { 893 }, {
@@ -904,7 +902,6 @@ export default class FranzMenu {
904 checked: !activeWorkspace, 902 checked: !activeWorkspace,
905 click: () => { 903 click: () => {
906 workspaceActions.deactivate(); 904 workspaceActions.deactivate();
907 gaEvent(GA_CATEGORY_WORKSPACES, 'switch', 'menu');
908 }, 905 },
909 }); 906 });
910 907
@@ -917,7 +914,6 @@ export default class FranzMenu {
917 checked: activeWorkspace ? workspace.id === activeWorkspace.id : false, 914 checked: activeWorkspace ? workspace.id === activeWorkspace.id : false,
918 click: () => { 915 click: () => {
919 workspaceActions.activate({ workspace }); 916 workspaceActions.activate({ workspace });
920 gaEvent(GA_CATEGORY_WORKSPACES, 'switch', 'menu');
921 }, 917 },
922 })); 918 }));
923 } 919 }
@@ -951,7 +947,7 @@ export default class FranzMenu {
951 947
952 948
953 debugMenu() { 949 debugMenu() {
954 const { intl } = window.franz; 950 const { intl } = window.ferdi;
955 951
956 return { 952 return {
957 label: intl.formatMessage(menuItems.debugInfo), 953 label: intl.formatMessage(menuItems.debugInfo),
@@ -977,7 +973,7 @@ export default class FranzMenu {
977 return service.name; 973 return service.name;
978 } 974 }
979 975
980 let name = service.recipe.name; 976 let { name } = service.recipe;
981 977
982 if (service.team) { 978 if (service.team) {
983 name = `${name} (${service.team})`; 979 name = `${name} (${service.team})`;
diff --git a/src/lib/Tray.js b/src/lib/Tray.js
index 192e24796..90974de3f 100644
--- a/src/lib/Tray.js
+++ b/src/lib/Tray.js
@@ -20,7 +20,7 @@ export default class TrayIcon {
20 this.trayIcon = new Tray(this._getAsset('tray', INDICATOR_TRAY_PLAIN)); 20 this.trayIcon = new Tray(this._getAsset('tray', INDICATOR_TRAY_PLAIN));
21 const trayMenuTemplate = [ 21 const trayMenuTemplate = [
22 { 22 {
23 label: 'Show Franz', 23 label: 'Show Ferdi',
24 click() { 24 click() {
25 if (app.mainWindow.isMinimized()) { 25 if (app.mainWindow.isMinimized()) {
26 app.mainWindow.restore(); 26 app.mainWindow.restore();
@@ -29,7 +29,7 @@ export default class TrayIcon {
29 app.mainWindow.focus(); 29 app.mainWindow.focus();
30 }, 30 },
31 }, { 31 }, {
32 label: 'Quit Franz', 32 label: 'Quit Ferdi',
33 click() { 33 click() {
34 app.quit(); 34 app.quit();
35 }, 35 },
@@ -84,7 +84,7 @@ export default class TrayIcon {
84 } 84 }
85 85
86 _getAsset(type, asset) { 86 _getAsset(type, asset) {
87 let platform = process.platform; 87 let { platform } = process;
88 88
89 if (platform === 'darwin' && systemPreferences.isDarkMode()) { 89 if (platform === 'darwin' && systemPreferences.isDarkMode()) {
90 platform = `${platform}-dark`; 90 platform = `${platform}-dark`;
diff --git a/src/lib/analytics.js b/src/lib/analytics.js
deleted file mode 100644
index c305fdb00..000000000
--- a/src/lib/analytics.js
+++ /dev/null
@@ -1,55 +0,0 @@
1import { remote } from 'electron';
2import querystring from 'querystring';
3
4import { GA_ID, STATS_API } from '../config';
5import { isDevMode } from '../environment';
6
7const debug = require('debug')('Franz:Analytics');
8
9const { app } = remote;
10
11/* eslint-disable */
12(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
13(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
14m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
15})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
16/* eslint-enable */
17
18const GA_LOCAL_STORAGE_KEY = 'gaUid';
19
20ga('create', GA_ID, {
21 storage: 'none',
22 clientId: localStorage.getItem(GA_LOCAL_STORAGE_KEY),
23});
24
25ga((tracker) => {
26 localStorage.setItem(GA_LOCAL_STORAGE_KEY, tracker.get('clientId'));
27});
28ga('set', 'checkProtocolTask', null);
29ga('set', 'version', app.getVersion());
30ga('send', 'App');
31
32export function gaPage(page) {
33 ga('send', 'pageview', page);
34 debug('GA track page', page);
35}
36
37export function gaEvent(category, action, label) {
38 ga('send', 'event', category, action, label);
39 debug('GA track event', category, action, label);
40}
41
42export 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}