Skip to content
This repository was archived by the owner on Nov 3, 2021. It is now read-only.

Commit fbad02c

Browse files
author
Carmen Jimenez Cabezas
committed
Bug 1130082 - Add reporting for room creation and sharing at creation time
1 parent 8c74584 commit fbad02c

File tree

7 files changed

+33
-10
lines changed

7 files changed

+33
-10
lines changed

app/js/controller.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,10 @@
388388
});
389389
},
390390

391-
onRoomCreated: function(room, navigateToDetail) {
391+
onRoomCreated: function(room, navigateToDetail, roomBeingCreated) {
392392
CallLog.addRoom(room).then(room => {
393-
navigateToDetail && Controller.showRoomDetails(room);
393+
navigateToDetail && Controller.showRoomDetails(room,
394+
roomBeingCreated);
394395
});
395396
},
396397

@@ -418,12 +419,12 @@
418419
return CallLog.removeRooms(token);
419420
},
420421

421-
showRoomDetails: function (room) {
422+
showRoomDetails: function (room, roomBeingCreated) {
422423
if (!room) {
423424
return;
424425
}
425426
Loader.getRoomDetail().then((RoomDetail) => {
426-
RoomDetail.show(room);
427+
RoomDetail.show(room, roomBeingCreated);
427428
});
428429
},
429430

app/js/helpers/rooms_db.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@
115115
'usedDefaultName',
116116
'smsNotification',
117117
'smsNotificationWithSubject',
118+
'smsNotificationOnCreation',
119+
'smsNotificationOnCreationWithSubject',
120+
'emailNotificationOnCreation',
121+
'emailNotificationOnCreationWithSubject',
118122
'emailNotification',
119123
'emailNotificationWithSubject',
120124
'timesRoomRenamed',

app/js/helpers/share.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@
5656

5757
var token = _getToken(params.url);
5858
RoomsDB.get(token).then(function(room) {
59+
field = field + (params.isCreation ? 'OnCreation' : '');
5960
var _field = room.usedDefaultName && field ||
6061
(field + Telemetry.suffixSubject);
6162
room[_field] = room[_field] && room[_field] + 1 || 1;
6263
RoomsDB.update([room]).then(function() {
6364
DEBUG && console.log('Registered notification telemetry field:' +
64-
field);
65+
_field);
6566
}, function() {
66-
console.error('Error updating telemetry notification field: ' + field);
67+
console.error('Error updating telemetry notification field: ' + _field);
6768
});
6869
}, function() {
6970
console.error('[Telemetry notification] Could not find room with token ' +

app/js/helpers/telemetry.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,16 @@
8585
roomCamera: [],
8686
receivedRooms: 0,
8787
fteLaunch: 0,
88+
created: 0,
89+
createdWithSubject: 0,
8890
smsNotification: {},
8991
smsNotificationWithSubject: {},
92+
smsNotificationOnCreation: {},
93+
smsNotificationOnCreationWithSubject: {},
9094
emailNotification: {},
9195
emailNotificationWithSubject: {},
96+
emailNotificationOnCreation: {},
97+
emailNotificationOnCreationWithSubject: {},
9298
timesRoomRenamed: {},
9399
backgroundMode: {},
94100
numberTimesIJoined: {},

app/js/screens/create_room.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,12 @@
142142
} else {
143143
room.usedDefaultName = roomName === roomNameByDefault;
144144
}
145-
Controller.onRoomCreated(room, userInteraction);
145+
146+
// Update the telemetry values...
147+
Telemetry.updateReport(room.usedDefaultName ?
148+
'created' : 'createdWithSubject');
149+
150+
Controller.onRoomCreated(room, userInteraction, true);
146151
room.usedDefaultName && asyncStorage.setItem(ROOM_NAME_COUNTER_KEY,
147152
++roomNumber);
148153
userInteraction && hide();

app/js/screens/room_detail.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
_showHistoryButton, _deleteButton, _backButton, _expirationUI, _urlUI;
66
var _room = null, _token = null;
77
var _isOwner = false;
8+
var _roomBeingCreated = false;
89
var _ = navigator.mozL10n.get;
910

1011
function _onBack(event) {
@@ -141,7 +142,8 @@
141142
{
142143
type: 'room',
143144
name: _room.roomName,
144-
url: _room.roomUrl
145+
url: _room.roomUrl,
146+
isCreation: _roomBeingCreated
145147
},
146148
function onShared(contact, identity) {
147149
Controller.onRoomShared(_room, contact, identity);
@@ -198,9 +200,12 @@
198200
}
199201

200202
var RoomDetail = {
201-
show: function(room) {
203+
show: function(room, roomBeingCreated) {
202204
// Check if we are the owners
203205
_isOwner = room.roomOwner === Controller.identity;
206+
// If this show doesn't come from a room creation,
207+
// roomBeingCreated will be falsey
208+
_roomBeingCreated = !!roomBeingCreated;
204209

205210
// Cache room object for future methods
206211
_room = room;

app/js/screens/share.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@
5656
name: room.roomName,
5757
url: room.roomUrl,
5858
identity: identity,
59-
contact: contact
59+
contact: contact,
60+
isCreation: true
6061
};
6162
Share[method](params, function onShared(contact, identity) {
6263
Controller.onRoomShared(room, contact, identity);

0 commit comments

Comments
 (0)