Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 444425b

Browse files
authored
Merge pull request #5365 from matrix-org/t3chguy/countly
Initial Countly work
2 parents 428a2de + 50a937c commit 444425b

34 files changed

+1412
-72
lines changed

res/css/_components.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
@import "./structures/_CustomRoomTagPanel.scss";
1010
@import "./structures/_FilePanel.scss";
1111
@import "./structures/_GenericErrorPage.scss";
12+
@import "./structures/_GroupFilterPanel.scss";
1213
@import "./structures/_GroupView.scss";
1314
@import "./structures/_HeaderButtons.scss";
1415
@import "./structures/_HomePage.scss";
@@ -27,7 +28,6 @@
2728
@import "./structures/_ScrollPanel.scss";
2829
@import "./structures/_SearchBox.scss";
2930
@import "./structures/_TabbedView.scss";
30-
@import "./structures/_GroupFilterPanel.scss";
3131
@import "./structures/_ToastContainer.scss";
3232
@import "./structures/_UploadBar.scss";
3333
@import "./structures/_UserMenu.scss";
@@ -70,6 +70,7 @@
7070
@import "./views/dialogs/_DeactivateAccountDialog.scss";
7171
@import "./views/dialogs/_DevtoolsDialog.scss";
7272
@import "./views/dialogs/_EditCommunityPrototypeDialog.scss";
73+
@import "./views/dialogs/_FeedbackDialog.scss";
7374
@import "./views/dialogs/_GroupAddressPicker.scss";
7475
@import "./views/dialogs/_IncomingSasDialog.scss";
7576
@import "./views/dialogs/_InviteDialog.scss";
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/*
2+
Copyright 2020 The Matrix.org Foundation C.I.C.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
.mx_FeedbackDialog {
18+
hr {
19+
margin: 24px 0;
20+
border-color: $input-border-color;
21+
}
22+
23+
.mx_Dialog_content {
24+
margin-bottom: 24px;
25+
26+
> h2 {
27+
margin-bottom: 32px;
28+
}
29+
}
30+
31+
.mx_FeedbackDialog_section {
32+
position: relative;
33+
padding-left: 52px;
34+
35+
> p {
36+
color: $tertiary-fg-color;
37+
}
38+
39+
.mx_AccessibleButton_kind_link {
40+
padding: 0;
41+
font-size: inherit;
42+
}
43+
44+
a, .mx_AccessibleButton_kind_link {
45+
color: $accent-color;
46+
text-decoration: underline;
47+
}
48+
49+
&::before, &::after {
50+
content: "";
51+
position: absolute;
52+
width: 40px;
53+
height: 40px;
54+
left: 0;
55+
top: 0;
56+
}
57+
58+
&::before {
59+
background-color: $icon-button-color;
60+
border-radius: 20px;
61+
}
62+
63+
&::after {
64+
background: $avatar-initial-color; // TODO
65+
mask-position: center;
66+
mask-size: 24px;
67+
mask-repeat: no-repeat;
68+
}
69+
}
70+
71+
.mx_FeedbackDialog_reportBug {
72+
&::after {
73+
mask-image: url('$(res)/img/feather-customised/bug.svg');
74+
}
75+
}
76+
77+
.mx_FeedbackDialog_rateApp {
78+
.mx_RadioButton {
79+
display: inline-flex;
80+
font-size: 20px;
81+
transition: font-size 1s, border .5s;
82+
border-radius: 50%;
83+
border: 2px solid transparent;
84+
margin-top: 12px;
85+
margin-bottom: 24px;
86+
vertical-align: top;
87+
cursor: pointer;
88+
89+
input[type="radio"] + div {
90+
display: none;
91+
}
92+
93+
.mx_RadioButton_content {
94+
background: $icon-button-color;
95+
width: 40px;
96+
height: 40px;
97+
text-align: center;
98+
line-height: 40px;
99+
border-radius: 20px;
100+
margin: 5px;
101+
}
102+
103+
.mx_RadioButton_spacer {
104+
display: none;
105+
}
106+
107+
& + .mx_RadioButton {
108+
margin-left: 16px;
109+
}
110+
}
111+
112+
.mx_RadioButton_checked {
113+
font-size: 24px;
114+
border-color: $accent-color;
115+
}
116+
117+
&::after {
118+
mask-image: url('$(res)/img/element-icons/feedback.svg');
119+
}
120+
}
121+
}

res/img/element-icons/feedback.svg

Lines changed: 3 additions & 0 deletions
Loading

res/img/feather-customised/bug.svg

Lines changed: 3 additions & 0 deletions
Loading

src/@types/global.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import RightPanelStore from "../stores/RightPanelStore";
3333
import WidgetStore from "../stores/WidgetStore";
3434
import CallHandler from "../CallHandler";
3535
import {Analytics} from "../Analytics";
36+
import CountlyAnalytics from "../CountlyAnalytics";
3637
import UserActivity from "../UserActivity";
3738
import {ModalWidgetStore} from "../stores/ModalWidgetStore";
3839

@@ -60,6 +61,7 @@ declare global {
6061
mxWidgetStore: WidgetStore;
6162
mxCallHandler: CallHandler;
6263
mxAnalytics: Analytics;
64+
mxCountlyAnalytics: typeof CountlyAnalytics;
6365
mxUserActivity: UserActivity;
6466
mxModalWidgetStore: ModalWidgetStore;
6567
}
@@ -96,4 +98,13 @@ declare global {
9698
interface HTMLAudioElement {
9799
type?: string;
98100
}
101+
102+
interface Error {
103+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/fileName
104+
fileName?: string;
105+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/lineNumber
106+
lineNumber?: number;
107+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/columnNumber
108+
columnNumber?: number;
109+
}
99110
}

src/CallHandler.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ import ErrorDialog from "./components/views/dialogs/ErrorDialog";
7777
import WidgetStore from "./stores/WidgetStore";
7878
import { WidgetMessagingStore } from "./stores/widgets/WidgetMessagingStore";
7979
import { ElementWidgetActions } from "./stores/widgets/ElementWidgetActions";
80-
import { MatrixCall, CallErrorCode, CallState, CallEvent, CallParty } from "matrix-js-sdk/lib/webrtc/call";
80+
import { MatrixCall, CallErrorCode, CallState, CallEvent, CallParty, CallType } from "matrix-js-sdk/lib/webrtc/call";
8181
import Analytics from './Analytics';
82+
import CountlyAnalytics from "./CountlyAnalytics";
8283

8384
enum AudioID {
8485
Ring = 'ringAudio',
@@ -341,6 +342,7 @@ export default class CallHandler {
341342
localElement: HTMLVideoElement, remoteElement: HTMLVideoElement,
342343
) {
343344
Analytics.trackEvent('voip', 'placeCall', 'type', type);
345+
CountlyAnalytics.instance.trackStartCall(roomId, type === PlaceCallType.Video, false);
344346
const call = Matrix.createNewMatrixCall(MatrixClientPeg.get(), roomId);
345347
this.calls.set(roomId, call);
346348
this.setCallListeners(call);
@@ -419,6 +421,7 @@ export default class CallHandler {
419421
case 'place_conference_call':
420422
console.info("Place conference call in %s", payload.room_id);
421423
Analytics.trackEvent('voip', 'placeConferenceCall');
424+
CountlyAnalytics.instance.trackStartCall(payload.room_id, payload.type === PlaceCallType.Video, true);
422425
this.startCallApp(payload.room_id, payload.type);
423426
break;
424427
case 'end_conference':
@@ -462,16 +465,19 @@ export default class CallHandler {
462465
}
463466
this.removeCallForRoom(payload.room_id);
464467
break;
465-
case 'answer':
468+
case 'answer': {
466469
if (!this.calls.has(payload.room_id)) {
467470
return; // no call to answer
468471
}
469-
this.calls.get(payload.room_id).answer();
472+
const call = this.calls.get(payload.room_id);
473+
call.answer();
474+
CountlyAnalytics.instance.trackJoinCall(payload.room_id, call.type === CallType.Video, false);
470475
dis.dispatch({
471476
action: "view_room",
472477
room_id: payload.room_id,
473478
});
474479
break;
480+
}
475481
}
476482
}
477483

src/ContentMessages.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import Spinner from "./components/views/elements/Spinner";
3131
// Polyfill for Canvas.toBlob API using Canvas.toDataURL
3232
import "blueimp-canvas-to-blob";
3333
import { Action } from "./dispatcher/actions";
34+
import CountlyAnalytics from "./CountlyAnalytics";
3435

3536
const MAX_WIDTH = 800;
3637
const MAX_HEIGHT = 600;
@@ -368,10 +369,13 @@ export default class ContentMessages {
368369
private mediaConfig: IMediaConfig = null;
369370

370371
sendStickerContentToRoom(url: string, roomId: string, info: string, text: string, matrixClient: MatrixClient) {
371-
return MatrixClientPeg.get().sendStickerMessage(roomId, url, info, text).catch((e) => {
372+
const startTime = CountlyAnalytics.getTimestamp();
373+
const prom = MatrixClientPeg.get().sendStickerMessage(roomId, url, info, text).catch((e) => {
372374
console.warn(`Failed to send content with URL ${url} to room ${roomId}`, e);
373375
throw e;
374376
});
377+
CountlyAnalytics.instance.trackSendMessage(startTime, prom, roomId, false, false, {msgtype: "m.sticker"});
378+
return prom;
375379
}
376380

377381
getUploadLimit() {
@@ -479,6 +483,7 @@ export default class ContentMessages {
479483
}
480484

481485
private sendContentToRoom(file: File, roomId: string, matrixClient: MatrixClient, promBefore: Promise<any>) {
486+
const startTime = CountlyAnalytics.getTimestamp();
482487
const content: IContent = {
483488
body: file.name || 'Attachment',
484489
info: {
@@ -563,7 +568,9 @@ export default class ContentMessages {
563568
return promBefore;
564569
}).then(function() {
565570
if (upload.canceled) throw new UploadCanceledError();
566-
return matrixClient.sendMessage(roomId, content);
571+
const prom = matrixClient.sendMessage(roomId, content);
572+
CountlyAnalytics.instance.trackSendMessage(startTime, prom, roomId, false, false, content);
573+
return prom;
567574
}, function(err) {
568575
error = err;
569576
if (!upload.canceled) {

0 commit comments

Comments
 (0)