Merge pull request #4056 from vector-im/t3chguy/piwik

Piwik Analytics
This commit is contained in:
Matthew Hodgson 2017-05-30 15:59:08 +01:00 committed by GitHub
commit 60a56d0617
8 changed files with 34 additions and 13 deletions

View File

@ -10,5 +10,9 @@
"servers": [ "servers": [
"matrix.org" "matrix.org"
] ]
},
"piwik": {
"url": "https://piwik.riot.im/",
"siteId": 1
} }
} }

View File

@ -12,5 +12,9 @@
"servers": [ "servers": [
"matrix.org" "matrix.org"
] ]
},
"piwik": {
"url": "https://piwik.riot.im/",
"siteId": 1
} }
} }

View File

@ -22,6 +22,7 @@ import sdk from 'matrix-react-sdk';
import Matrix from "matrix-js-sdk"; import Matrix from "matrix-js-sdk";
import dis from 'matrix-react-sdk/lib/dispatcher'; import dis from 'matrix-react-sdk/lib/dispatcher';
import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg'; 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 rate_limited_func from 'matrix-react-sdk/lib/ratelimitedfunc';
import Modal from 'matrix-react-sdk/lib/Modal'; import Modal from 'matrix-react-sdk/lib/Modal';
import AccessibleButton from 'matrix-react-sdk/lib/components/views/elements/AccessibleButton'; import AccessibleButton from 'matrix-react-sdk/lib/components/views/elements/AccessibleButton';
@ -61,24 +62,26 @@ module.exports = React.createClass({
return { return {
phase: this.Phase.MemberInfo, phase: this.Phase.MemberInfo,
member: member, member: member,
} };
} } else {
else {
return { return {
phase: this.Phase.MemberList phase: this.Phase.MemberList
} };
} }
}, },
onMemberListButtonClick: function() { onMemberListButtonClick: function() {
Analytics.trackEvent('Right Panel', 'Member List Button', 'click');
this.setState({ phase: this.Phase.MemberList }); this.setState({ phase: this.Phase.MemberList });
}, },
onFileListButtonClick: function() { onFileListButtonClick: function() {
Analytics.trackEvent('Right Panel', 'File List Button', 'click');
this.setState({ phase: this.Phase.FilePanel }); this.setState({ phase: this.Phase.FilePanel });
}, },
onNotificationListButtonClick: function() { onNotificationListButtonClick: function() {
Analytics.trackEvent('Right Panel', 'Notification List Button', 'click');
this.setState({ phase: this.Phase.NotificationPanel }); this.setState({ phase: this.Phase.NotificationPanel });
}, },

View File

@ -16,11 +16,10 @@ limitations under the License.
'use strict'; 'use strict';
var React = require('react'); import React from 'react';
import { _t } from 'matrix-react-sdk/lib/languageHandler'; import { _t } from 'matrix-react-sdk/lib/languageHandler';
var Notifier = require("matrix-react-sdk/lib/Notifier"); import Notifier from 'matrix-react-sdk/lib/Notifier';
var sdk = require('matrix-react-sdk') import AccessibleButton from 'matrix-react-sdk/lib/components/views/elements/AccessibleButton';
var AccessibleButton = require('matrix-react-sdk/lib/components/views/elements/AccessibleButton');
module.exports = React.createClass({ module.exports = React.createClass({
displayName: 'MatrixToolbar', displayName: 'MatrixToolbar',
@ -43,5 +42,5 @@ module.exports = React.createClass({
<AccessibleButton className="mx_MatrixToolbar_close" onClick={ this.hideToolbar } ><img src="img/cancel.svg" width="18" height="18" /></AccessibleButton> <AccessibleButton className="mx_MatrixToolbar_close" onClick={ this.hideToolbar } ><img src="img/cancel.svg" width="18" height="18" /></AccessibleButton>
</div> </div>
); );
} },
}); });

View File

@ -56,7 +56,7 @@ if (process.env.NODE_ENV !== 'production') {
var RunModernizrTests = require("./modernizr"); // this side-effects a global var RunModernizrTests = require("./modernizr"); // this side-effects a global
var ReactDOM = require("react-dom"); var ReactDOM = require("react-dom");
var sdk = require("matrix-react-sdk"); var sdk = require("matrix-react-sdk");
var PlatformPeg = require("matrix-react-sdk/lib/PlatformPeg"); const PlatformPeg = require("matrix-react-sdk/lib/PlatformPeg");
sdk.loadSkin(require('../component-index')); sdk.loadSkin(require('../component-index'));
var VectorConferenceHandler = require('../VectorConferenceHandler'); var VectorConferenceHandler = require('../VectorConferenceHandler');
var UpdateChecker = require("./updater"); var UpdateChecker = require("./updater");
@ -143,7 +143,7 @@ var onNewScreen = function(screen) {
var hash = '#/' + screen; var hash = '#/' + screen;
lastLocationHashSet = hash; lastLocationHashSet = hash;
window.location.hash = hash; window.location.hash = hash;
} };
// We use this to work out what URL the SDK should // We use this to work out what URL the SDK should
// pass through when registering to allow the user to // pass through when registering to allow the user to
@ -295,8 +295,7 @@ async function loadApp() {
/>, />,
document.getElementById('matrixchat') document.getElementById('matrixchat')
); );
} } else {
else {
console.error("Browser is missing required features."); console.error("Browser is missing required features.");
// take to a different landing page to AWOOOOOGA at the user // take to a different landing page to AWOOOOOGA at the user
var CompatibilityPage = sdk.getComponent("structures.CompatibilityPage"); var CompatibilityPage = sdk.getComponent("structures.CompatibilityPage");

View File

@ -67,6 +67,10 @@ export default class ElectronPlatform extends VectorBasePlatform {
dis.register(_onAction); dis.register(_onAction);
} }
getHumanReadableName(): string {
return 'Electron Platform';
}
setNotificationCount(count: number) { setNotificationCount(count: number) {
if (this.notificationCount === count) return; if (this.notificationCount === count) return;
super.setNotificationCount(count); super.setNotificationCount(count);

View File

@ -35,6 +35,10 @@ export default class VectorBasePlatform extends BasePlatform {
this._updateFavicon(); this._updateFavicon();
} }
getHumanReadableName(): string {
return 'Vector Base Platform';
}
_updateFavicon() { _updateFavicon() {
try { try {
// This needs to be in in a try block as it will throw // This needs to be in in a try block as it will throw

View File

@ -31,6 +31,10 @@ export default class WebPlatform extends VectorBasePlatform {
this.runningVersion = null; this.runningVersion = null;
} }
getHumanReadableName(): string {
return 'Web Platform';
}
/** /**
* Returns true if the platform supports displaying * Returns true if the platform supports displaying
* notifications, otherwise false. * notifications, otherwise false.