From 61a67c52c555faddccef50f9a38ba451aac43541 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Sat, 27 May 2017 20:39:52 +0100
Subject: [PATCH 01/12] initial piwik stuff
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/components/structures/RightPanel.js | 11 ++++++----
src/vector/index.js | 28 +++++++++++++++++++++----
2 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/src/components/structures/RightPanel.js b/src/components/structures/RightPanel.js
index c7f5394b..8d5fc36e 100644
--- a/src/components/structures/RightPanel.js
+++ b/src/components/structures/RightPanel.js
@@ -22,6 +22,7 @@ import sdk from 'matrix-react-sdk';
import Matrix from "matrix-js-sdk";
import dis from 'matrix-react-sdk/lib/dispatcher';
import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
+import Analytics from 'matrix-react-sdk/lib/Analytics';
import rate_limited_func from 'matrix-react-sdk/lib/ratelimitedfunc';
import Modal from 'matrix-react-sdk/lib/Modal';
import AccessibleButton from 'matrix-react-sdk/lib/components/views/elements/AccessibleButton';
@@ -61,24 +62,26 @@ module.exports = React.createClass({
return {
phase: this.Phase.MemberInfo,
member: member,
- }
- }
- else {
+ };
+ } else {
return {
phase: this.Phase.MemberList
- }
+ };
}
},
onMemberListButtonClick: function() {
+ Analytics.trackEvent('RightPanel', 'memberListButtonClick');
this.setState({ phase: this.Phase.MemberList });
},
onFileListButtonClick: function() {
+ Analytics.trackEvent('RightPanel', 'fileListButtonClick');
this.setState({ phase: this.Phase.FilePanel });
},
onNotificationListButtonClick: function() {
+ Analytics.trackEvent('RightPanel', 'notificationListButtonClick');
this.setState({ phase: this.Phase.NotificationPanel });
},
diff --git a/src/vector/index.js b/src/vector/index.js
index 14f8bb4b..d1752356 100644
--- a/src/vector/index.js
+++ b/src/vector/index.js
@@ -56,7 +56,8 @@ if (process.env.NODE_ENV !== 'production') {
var RunModernizrTests = require("./modernizr"); // this side-effects a global
var ReactDOM = require("react-dom");
var sdk = require("matrix-react-sdk");
-var PlatformPeg = require("matrix-react-sdk/lib/PlatformPeg");
+const PlatformPeg = require("matrix-react-sdk/lib/PlatformPeg");
+const Analytics = require("matrix-react-sdk/lib/Analytics");
sdk.loadSkin(require('../component-index'));
var VectorConferenceHandler = require('../VectorConferenceHandler');
var UpdateChecker = require("./updater");
@@ -143,7 +144,7 @@ var onNewScreen = function(screen) {
var hash = '#/' + screen;
lastLocationHashSet = hash;
window.location.hash = hash;
-}
+};
// We use this to work out what URL the SDK should
// pass through when registering to allow the user to
@@ -279,6 +280,26 @@ async function loadApp() {
} else if (validBrowser) {
UpdateChecker.start();
+ let doNotTrack = navigator.doNotTrack;
+ if (typeof navigator.doNotTrack === 'string') {
+ doNotTrack = navigator.doNotTrack === 'yes';
+ }
+ if (!doNotTrack && configJson.piwik && configJson.piwik.url && configJson.piwik.siteId) {
+ (function() {
+ const g = document.createElement('script');
+ const s = document.getElementsByTagName('script')[0];
+ g.type='text/javascript'; g.async=true; g.defer=true; g.src=configJson.piwik.url+'piwik.js';
+
+ g.onload = function() {
+ const tracker = window.Piwik.getTracker(configJson.piwik.url+'piwik.php', configJson.piwik.siteId);
+ console.log('Initialised anonymous analytics');
+ Analytics.set(tracker);
+ };
+
+ s.parentNode.insertBefore(g, s);
+ })();
+ }
+
const MatrixChat = sdk.getComponent('structures.MatrixChat');
window.matrixChat = ReactDOM.render(
,
document.getElementById('matrixchat')
);
- }
- else {
+ } else {
console.error("Browser is missing required features.");
// take to a different landing page to AWOOOOOGA at the user
var CompatibilityPage = sdk.getComponent("structures.CompatibilityPage");
From 195fcba69608ce2cb3a6e424de5c194d4e2b54b7 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Sat, 27 May 2017 20:56:25 +0100
Subject: [PATCH 02/12] correct DNT check
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/vector/index.js | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/vector/index.js b/src/vector/index.js
index d1752356..7674dd47 100644
--- a/src/vector/index.js
+++ b/src/vector/index.js
@@ -280,10 +280,7 @@ async function loadApp() {
} else if (validBrowser) {
UpdateChecker.start();
- let doNotTrack = navigator.doNotTrack;
- if (typeof navigator.doNotTrack === 'string') {
- doNotTrack = navigator.doNotTrack === 'yes';
- }
+ const doNotTrack = navigator.doNotTrack === 'yes' || navigator.doNotTrack === '1' || navigator.doNotTrack === 1;
if (!doNotTrack && configJson.piwik && configJson.piwik.url && configJson.piwik.siteId) {
(function() {
const g = document.createElement('script');
From 2e75640cdde4f790acee7c1ff87778abbacd3dec Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Sun, 28 May 2017 11:27:33 +0100
Subject: [PATCH 03/12] sample piwik config
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
config.sample.json | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/config.sample.json b/config.sample.json
index 3c513f7a..bf5da247 100644
--- a/config.sample.json
+++ b/config.sample.json
@@ -10,5 +10,9 @@
"servers": [
"matrix.org"
]
+ },
+ "piwik": {
+ "url": "//piwik.riot.im/",
+ "siteId": 1
}
}
From c2c417b207a8ec8356fcff6201439432341e54f8 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Sun, 28 May 2017 13:07:56 +0100
Subject: [PATCH 04/12] add piwik config to riot.im electron build config
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
electron_app/riot.im/config.json | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/electron_app/riot.im/config.json b/electron_app/riot.im/config.json
index 80526f4a..a31f77e4 100644
--- a/electron_app/riot.im/config.json
+++ b/electron_app/riot.im/config.json
@@ -12,5 +12,9 @@
"servers": [
"matrix.org"
]
+ },
+ "piwik": {
+ "url": "//piwik.riot.ovh/",
+ "siteId": 2
}
}
From 6969baa5a6b7717e1319f24c76d11e109dc3b47a Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Sun, 28 May 2017 13:08:09 +0100
Subject: [PATCH 05/12] change event wording
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/components/structures/RightPanel.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/components/structures/RightPanel.js b/src/components/structures/RightPanel.js
index 8d5fc36e..23057200 100644
--- a/src/components/structures/RightPanel.js
+++ b/src/components/structures/RightPanel.js
@@ -71,17 +71,17 @@ module.exports = React.createClass({
},
onMemberListButtonClick: function() {
- Analytics.trackEvent('RightPanel', 'memberListButtonClick');
+ Analytics.trackEvent('Right Panel', 'Member List Button', 'click');
this.setState({ phase: this.Phase.MemberList });
},
onFileListButtonClick: function() {
- Analytics.trackEvent('RightPanel', 'fileListButtonClick');
+ Analytics.trackEvent('Right Panel', 'File List Button', 'click');
this.setState({ phase: this.Phase.FilePanel });
},
onNotificationListButtonClick: function() {
- Analytics.trackEvent('RightPanel', 'notificationListButtonClick');
+ Analytics.trackEvent('Right Panel', 'Notification List Button', 'click');
this.setState({ phase: this.Phase.NotificationPanel });
},
From 28d929f9015c44acec2b47da5b7a7d83bf06a3bb Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Sun, 28 May 2017 13:10:13 +0100
Subject: [PATCH 06/12] correct electron config to not point at personal piwik
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
electron_app/riot.im/config.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/electron_app/riot.im/config.json b/electron_app/riot.im/config.json
index a31f77e4..023e6a02 100644
--- a/electron_app/riot.im/config.json
+++ b/electron_app/riot.im/config.json
@@ -14,7 +14,7 @@
]
},
"piwik": {
- "url": "//piwik.riot.ovh/",
- "siteId": 2
+ "url": "//piwik.riot.im/",
+ "siteId": 1
}
}
From 3e7ef112f02f1abec561d3e8a3dc29b68cc90ab4 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Mon, 29 May 2017 13:17:12 +0100
Subject: [PATCH 07/12] opt out based on analyticsOptOut localSetting
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/vector/index.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/vector/index.js b/src/vector/index.js
index 7674dd47..571fecfa 100644
--- a/src/vector/index.js
+++ b/src/vector/index.js
@@ -280,8 +280,8 @@ async function loadApp() {
} else if (validBrowser) {
UpdateChecker.start();
- const doNotTrack = navigator.doNotTrack === 'yes' || navigator.doNotTrack === '1' || navigator.doNotTrack === 1;
- if (!doNotTrack && configJson.piwik && configJson.piwik.url && configJson.piwik.siteId) {
+ const analyticsEnabled = !UserSettingsStore.getLocalSetting('analyticsOptOut', false);
+ if (analyticsEnabled && configJson.piwik && configJson.piwik.url && configJson.piwik.siteId) {
(function() {
const g = document.createElement('script');
const s = document.getElementsByTagName('script')[0];
From 3e7b738b11a4250dc83b91d4c53bc023bd0c3083 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Mon, 29 May 2017 14:22:35 +0100
Subject: [PATCH 08/12] move all piwik init stuff to MatrixChat/Analytics as it
now relies on SDKConfig
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/vector/index.js | 18 ------------------
1 file changed, 18 deletions(-)
diff --git a/src/vector/index.js b/src/vector/index.js
index 571fecfa..432710fb 100644
--- a/src/vector/index.js
+++ b/src/vector/index.js
@@ -57,7 +57,6 @@ var RunModernizrTests = require("./modernizr"); // this side-effects a global
var ReactDOM = require("react-dom");
var sdk = require("matrix-react-sdk");
const PlatformPeg = require("matrix-react-sdk/lib/PlatformPeg");
-const Analytics = require("matrix-react-sdk/lib/Analytics");
sdk.loadSkin(require('../component-index'));
var VectorConferenceHandler = require('../VectorConferenceHandler');
var UpdateChecker = require("./updater");
@@ -280,23 +279,6 @@ async function loadApp() {
} else if (validBrowser) {
UpdateChecker.start();
- const analyticsEnabled = !UserSettingsStore.getLocalSetting('analyticsOptOut', false);
- if (analyticsEnabled && configJson.piwik && configJson.piwik.url && configJson.piwik.siteId) {
- (function() {
- const g = document.createElement('script');
- const s = document.getElementsByTagName('script')[0];
- g.type='text/javascript'; g.async=true; g.defer=true; g.src=configJson.piwik.url+'piwik.js';
-
- g.onload = function() {
- const tracker = window.Piwik.getTracker(configJson.piwik.url+'piwik.php', configJson.piwik.siteId);
- console.log('Initialised anonymous analytics');
- Analytics.set(tracker);
- };
-
- s.parentNode.insertBefore(g, s);
- })();
- }
-
const MatrixChat = sdk.getComponent('structures.MatrixChat');
window.matrixChat = ReactDOM.render(
Date: Mon, 29 May 2017 19:12:04 +0100
Subject: [PATCH 09/12] make eslint happy about MatrixToolbar
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/components/views/globals/MatrixToolbar.js | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/components/views/globals/MatrixToolbar.js b/src/components/views/globals/MatrixToolbar.js
index 6d47ad1b..488b5def 100644
--- a/src/components/views/globals/MatrixToolbar.js
+++ b/src/components/views/globals/MatrixToolbar.js
@@ -16,11 +16,10 @@ limitations under the License.
'use strict';
-var React = require('react');
+import React from 'react';
import { _t } from 'matrix-react-sdk/lib/languageHandler';
-var Notifier = require("matrix-react-sdk/lib/Notifier");
-var sdk = require('matrix-react-sdk')
-var AccessibleButton = require('matrix-react-sdk/lib/components/views/elements/AccessibleButton');
+import Notifier from 'matrix-react-sdk/lib/Notifier';
+import AccessibleButton from 'matrix-react-sdk/lib/components/views/elements/AccessibleButton';
module.exports = React.createClass({
displayName: 'MatrixToolbar',
@@ -43,5 +42,5 @@ module.exports = React.createClass({
);
- }
+ },
});
From 8a59acb5c3308a1df4e76af5e01915d1d3d2d852 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Mon, 29 May 2017 19:32:44 +0100
Subject: [PATCH 10/12] explicit protocol in configs, otherwise breaks in
Electron when it tries file://
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
config.sample.json | 2 +-
electron_app/riot.im/config.json | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/config.sample.json b/config.sample.json
index bf5da247..c9b3d65b 100644
--- a/config.sample.json
+++ b/config.sample.json
@@ -12,7 +12,7 @@
]
},
"piwik": {
- "url": "//piwik.riot.im/",
+ "url": "https://piwik.riot.im/",
"siteId": 1
}
}
diff --git a/electron_app/riot.im/config.json b/electron_app/riot.im/config.json
index 023e6a02..1303985e 100644
--- a/electron_app/riot.im/config.json
+++ b/electron_app/riot.im/config.json
@@ -14,7 +14,7 @@
]
},
"piwik": {
- "url": "//piwik.riot.im/",
+ "url": "https://piwik.riot.im/",
"siteId": 1
}
}
From e991461e8dcb379613606afc167322bbc01527cb Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Mon, 29 May 2017 19:51:28 +0100
Subject: [PATCH 11/12] add new BasePlatform method, Analytics fun on the
Webpack train
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/vector/platform/ElectronPlatform.js | 4 ++++
src/vector/platform/VectorBasePlatform.js | 4 ++++
src/vector/platform/WebPlatform.js | 4 ++++
3 files changed, 12 insertions(+)
diff --git a/src/vector/platform/ElectronPlatform.js b/src/vector/platform/ElectronPlatform.js
index bf930a67..a12de530 100644
--- a/src/vector/platform/ElectronPlatform.js
+++ b/src/vector/platform/ElectronPlatform.js
@@ -67,6 +67,10 @@ export default class ElectronPlatform extends VectorBasePlatform {
dis.register(_onAction);
}
+ getHumanReadableName() {
+ return 'Electron Platform';
+ }
+
setNotificationCount(count: number) {
if (this.notificationCount === count) return;
super.setNotificationCount(count);
diff --git a/src/vector/platform/VectorBasePlatform.js b/src/vector/platform/VectorBasePlatform.js
index 00c9c47c..4ff3c222 100644
--- a/src/vector/platform/VectorBasePlatform.js
+++ b/src/vector/platform/VectorBasePlatform.js
@@ -35,6 +35,10 @@ export default class VectorBasePlatform extends BasePlatform {
this._updateFavicon();
}
+ getHumanReadableName() {
+ return 'Vector Base Platform';
+ }
+
_updateFavicon() {
try {
// This needs to be in in a try block as it will throw
diff --git a/src/vector/platform/WebPlatform.js b/src/vector/platform/WebPlatform.js
index cdff7344..1db024ed 100644
--- a/src/vector/platform/WebPlatform.js
+++ b/src/vector/platform/WebPlatform.js
@@ -31,6 +31,10 @@ export default class WebPlatform extends VectorBasePlatform {
this.runningVersion = null;
}
+ getHumanReadableName() {
+ return 'Web Platform';
+ }
+
/**
* Returns true if the platform supports displaying
* notifications, otherwise false.
From b9ec25b32f53659f4b35e0ed348838e62badcb0b Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Mon, 29 May 2017 20:03:21 +0100
Subject: [PATCH 12/12] add flow annotation
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/vector/platform/ElectronPlatform.js | 2 +-
src/vector/platform/VectorBasePlatform.js | 2 +-
src/vector/platform/WebPlatform.js | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/vector/platform/ElectronPlatform.js b/src/vector/platform/ElectronPlatform.js
index a12de530..13604cda 100644
--- a/src/vector/platform/ElectronPlatform.js
+++ b/src/vector/platform/ElectronPlatform.js
@@ -67,7 +67,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
dis.register(_onAction);
}
- getHumanReadableName() {
+ getHumanReadableName(): string {
return 'Electron Platform';
}
diff --git a/src/vector/platform/VectorBasePlatform.js b/src/vector/platform/VectorBasePlatform.js
index 4ff3c222..04caecdc 100644
--- a/src/vector/platform/VectorBasePlatform.js
+++ b/src/vector/platform/VectorBasePlatform.js
@@ -35,7 +35,7 @@ export default class VectorBasePlatform extends BasePlatform {
this._updateFavicon();
}
- getHumanReadableName() {
+ getHumanReadableName(): string {
return 'Vector Base Platform';
}
diff --git a/src/vector/platform/WebPlatform.js b/src/vector/platform/WebPlatform.js
index 1db024ed..1a3c46fb 100644
--- a/src/vector/platform/WebPlatform.js
+++ b/src/vector/platform/WebPlatform.js
@@ -31,7 +31,7 @@ export default class WebPlatform extends VectorBasePlatform {
this.runningVersion = null;
}
- getHumanReadableName() {
+ getHumanReadableName(): string {
return 'Web Platform';
}