aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Menu.js35
-rw-r--r--src/lib/Tray.js6
-rw-r--r--src/lib/analytics.js55
3 files changed, 18 insertions, 78 deletions
diff --git a/src/lib/Menu.js b/src/lib/Menu.js
index 4aa2edaba..7af1b36cb 100644
--- a/src/lib/Menu.js
+++ b/src/lib/Menu.js
@@ -3,12 +3,11 @@ 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 { GA_CATEGORY_TODOS, todosStore } from '../features/todos'; 10import { todosStore } from '../features/todos';
12import { todoActions } from '../features/todos/actions'; 11import { todoActions } from '../features/todos/actions';
13 12
14const { app, Menu, dialog } = remote; 13const { app, Menu, dialog } = remote;
@@ -112,7 +111,7 @@ const menuItems = defineMessages({
112 }, 111 },
113 reloadFranz: { 112 reloadFranz: {
114 id: 'menu.view.reloadFranz', 113 id: 'menu.view.reloadFranz',
115 defaultMessage: '!!!Reload Franz', 114 defaultMessage: '!!!Reload Ferdi',
116 }, 115 },
117 minimize: { 116 minimize: {
118 id: 'menu.window.minimize', 117 id: 'menu.window.minimize',
@@ -140,7 +139,7 @@ const menuItems = defineMessages({
140 }, 139 },
141 debugInfoCopiedHeadline: { 140 debugInfoCopiedHeadline: {
142 id: 'menu.help.debugInfoCopiedHeadline', 141 id: 'menu.help.debugInfoCopiedHeadline',
143 defaultMessage: '!!!Franz Debug Information', 142 defaultMessage: '!!!Ferdi Debug Information',
144 }, 143 },
145 debugInfoCopiedBody: { 144 debugInfoCopiedBody: {
146 id: 'menu.help.debugInfoCopiedBody', 145 id: 'menu.help.debugInfoCopiedBody',
@@ -176,7 +175,7 @@ const menuItems = defineMessages({
176 }, 175 },
177 about: { 176 about: {
178 id: 'menu.app.about', 177 id: 'menu.app.about',
179 defaultMessage: '!!!About Franz', 178 defaultMessage: '!!!About Ferdi',
180 }, 179 },
181 announcement: { 180 announcement: {
182 id: 'menu.app.announcement', 181 id: 'menu.app.announcement',
@@ -265,7 +264,7 @@ const menuItems = defineMessages({
265}); 264});
266 265
267function getActiveWebview() { 266function getActiveWebview() {
268 return window.franz.stores.services.active.webview; 267 return window.ferdi.stores.services.active.webview;
269} 268}
270 269
271const _templateFactory = intl => [ 270const _templateFactory = intl => [
@@ -401,7 +400,7 @@ const _templateFactory = intl => [
401 click: () => { 400 click: () => {
402 announcementActions.show(); 401 announcementActions.show();
403 }, 402 },
404 visible: window.franz.stores.user.isLoggedIn && announcementsStore.areNewsAvailable, 403 visible: window.ferdi.stores.user.isLoggedIn && announcementsStore.areNewsAvailable,
405 }, 404 },
406 { 405 {
407 type: 'separator', 406 type: 'separator',
@@ -623,11 +622,11 @@ export default class FranzMenu {
623 // need to clone object so we don't modify computed (cached) object 622 // need to clone object so we don't modify computed (cached) object
624 const serviceTpl = Object.assign([], this.serviceTpl()); 623 const serviceTpl = Object.assign([], this.serviceTpl());
625 624
626 if (window.franz === undefined) { 625 if (window.ferdi === undefined) {
627 return; 626 return;
628 } 627 }
629 628
630 const { intl } = window.franz; 629 const { intl } = window.ferdi;
631 const tpl = isMac ? _templateFactory(intl) : _titleBarTemplateFactory(intl); 630 const tpl = isMac ? _templateFactory(intl) : _titleBarTemplateFactory(intl);
632 631
633 tpl[1].submenu.push({ 632 tpl[1].submenu.push({
@@ -743,8 +742,8 @@ export default class FranzMenu {
743 click: () => { 742 click: () => {
744 dialog.showMessageBox({ 743 dialog.showMessageBox({
745 type: 'info', 744 type: 'info',
746 title: 'Franz', 745 title: 'Franz Ferdinand',
747 message: 'Franz', 746 message: 'Ferdi',
748 detail: `Version: ${remote.app.getVersion()}\nRelease: ${process.versions.electron} / ${process.platform} / ${process.arch}`, 747 detail: `Version: ${remote.app.getVersion()}\nRelease: ${process.versions.electron} / ${process.platform} / ${process.arch}`,
749 }); 748 });
750 }, 749 },
@@ -824,7 +823,7 @@ export default class FranzMenu {
824 } 823 }
825 824
826 serviceTpl() { 825 serviceTpl() {
827 const { intl } = window.franz; 826 const { intl } = window.ferdi;
828 const { user, services, settings } = this.stores; 827 const { user, services, settings } = this.stores;
829 if (!user.isLoggedIn) return []; 828 if (!user.isLoggedIn) return [];
830 const menu = []; 829 const menu = [];
@@ -870,7 +869,7 @@ export default class FranzMenu {
870 869
871 workspacesMenu() { 870 workspacesMenu() {
872 const { workspaces, activeWorkspace, isWorkspaceDrawerOpen } = workspaceStore; 871 const { workspaces, activeWorkspace, isWorkspaceDrawerOpen } = workspaceStore;
873 const { intl } = window.franz; 872 const { intl } = window.ferdi;
874 const menu = []; 873 const menu = [];
875 874
876 // Add new workspace item: 875 // Add new workspace item:
@@ -892,7 +891,6 @@ export default class FranzMenu {
892 accelerator: `${cmdKey}+D`, 891 accelerator: `${cmdKey}+D`,
893 click: () => { 892 click: () => {
894 workspaceActions.toggleWorkspaceDrawer(); 893 workspaceActions.toggleWorkspaceDrawer();
895 gaEvent(GA_CATEGORY_WORKSPACES, 'toggleDrawer', 'menu');
896 }, 894 },
897 enabled: this.stores.user.isLoggedIn, 895 enabled: this.stores.user.isLoggedIn,
898 }, { 896 }, {
@@ -907,7 +905,6 @@ export default class FranzMenu {
907 checked: !activeWorkspace, 905 checked: !activeWorkspace,
908 click: () => { 906 click: () => {
909 workspaceActions.deactivate(); 907 workspaceActions.deactivate();
910 gaEvent(GA_CATEGORY_WORKSPACES, 'switch', 'menu');
911 }, 908 },
912 }); 909 });
913 910
@@ -920,7 +917,6 @@ export default class FranzMenu {
920 checked: activeWorkspace ? workspace.id === activeWorkspace.id : false, 917 checked: activeWorkspace ? workspace.id === activeWorkspace.id : false,
921 click: () => { 918 click: () => {
922 workspaceActions.activate({ workspace }); 919 workspaceActions.activate({ workspace });
923 gaEvent(GA_CATEGORY_WORKSPACES, 'switch', 'menu');
924 }, 920 },
925 })); 921 }));
926 } 922 }
@@ -940,7 +936,6 @@ export default class FranzMenu {
940 accelerator: `${cmdKey}+T`, 936 accelerator: `${cmdKey}+T`,
941 click: () => { 937 click: () => {
942 todoActions.toggleTodosPanel(); 938 todoActions.toggleTodosPanel();
943 gaEvent(GA_CATEGORY_TODOS, 'toggleDrawer', 'menu');
944 }, 939 },
945 enabled: this.stores.user.isLoggedIn && isFeatureEnabledByUser, 940 enabled: this.stores.user.isLoggedIn && isFeatureEnabledByUser,
946 }, { 941 }, {
@@ -962,7 +957,7 @@ export default class FranzMenu {
962 957
963 958
964 debugMenu() { 959 debugMenu() {
965 const { intl } = window.franz; 960 const { intl } = window.ferdi;
966 961
967 return { 962 return {
968 label: intl.formatMessage(menuItems.debugInfo), 963 label: intl.formatMessage(menuItems.debugInfo),
@@ -988,7 +983,7 @@ export default class FranzMenu {
988 return service.name; 983 return service.name;
989 } 984 }
990 985
991 let name = service.recipe.name; 986 let { name } = service.recipe;
992 987
993 if (service.team) { 988 if (service.team) {
994 name = `${name} (${service.team})`; 989 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}