From 67ffc00d489bf9571a734c24fcac79d18af2bcb6 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 1 Sep 2014 14:15:03 +0100 Subject: Don't show the hang up button once tha call has ended --- webclient/room/room.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'webclient') diff --git a/webclient/room/room.html b/webclient/room/room.html index e5e454864b..d5b0f0ab96 100644 --- a/webclient/room/room.html +++ b/webclient/room/room.html @@ -106,7 +106,7 @@ - + Calling... Call Connecting... Call Connected -- cgit 1.5.1 From c9ee9b45c74d690f49f454b62170feb0f5483d38 Mon Sep 17 00:00:00 2001 From: Emmanuel ROHEE Date: Mon, 1 Sep 2014 16:21:13 +0200 Subject: Fixed presence state update. Specifically, the current user was sometimes indicated as offline --- webclient/room/room-controller.js | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'webclient') diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js index c6028f874e..048350110b 100644 --- a/webclient/room/room-controller.js +++ b/webclient/room/room-controller.js @@ -201,9 +201,15 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput']) } } else { - // selectively update membership else it will nuke the picture and displayname too :/ + // selectively update membership and presence else it will nuke the picture and displayname too :/ var member = $scope.members[target_user_id]; - member.content.membership = chunk.content.membership; + member.membership = chunk.content.membership; + if ("state" in chunk.content) { + member.presenceState = chunk.content.state; + } + if ("mtime_age" in chunk.content) { + member.mtime_age = chunk.content.mtime_age; + } } }; @@ -377,10 +383,22 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput']) // Make recents highlight the current room $scope.recentsSelectedRoomID = $scope.room_id; - + + // Get the up-to-date the current member list + matrixService.getMemberList($scope.room_id).then( + function(response) { + for (var i = 0; i < response.data.chunk.length; i++) { + var chunk = response.data.chunk[i]; + updateMemberList(chunk); + updateMemberListPresenceAge(); + } + }, + function(error) { + $scope.feedback = "Failed get member list: " + error.data.error; + } + ); + paginate(MESSAGES_PER_PAGINATION); - - updateMemberListPresenceAge(); }; $scope.inviteUser = function(user_id) { -- cgit 1.5.1 From 26a95988da7974c18cf9528a035407d61cc6057c Mon Sep 17 00:00:00 2001 From: Emmanuel ROHEE Date: Mon, 1 Sep 2014 16:27:11 +0200 Subject: Fixed presence change that occurs -Xs ago --- webclient/room/room-controller.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'webclient') diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js index 048350110b..046d1ca204 100644 --- a/webclient/room/room-controller.js +++ b/webclient/room/room-controller.js @@ -337,6 +337,11 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput']) // Make sure the initialSync has been before going further eventHandlerService.waitForInitialSyncCompletion().then( function() { + + // Some data has been retrieved from the iniialSync request + // So, the relative time starts here + $scope.now = new Date().getTime(); + var needsToJoin = true; // The room members is available in the data fetched by initialSync -- cgit 1.5.1 From 4e14e38bd5cad77dfcab1fdfa3d3a19250810413 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 1 Sep 2014 14:27:03 +0100 Subject: Just show 'Call' for call events. Don't just splat out the content of the event for other events: it's rarely going to be sesnible. --- webclient/recents/recents.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'webclient') diff --git a/webclient/recents/recents.html b/webclient/recents/recents.html index 3f025a98d8..56fb38b02a 100644 --- a/webclient/recents/recents.html +++ b/webclient/recents/recents.html @@ -51,7 +51,9 @@
- {{ room.lastMsg }} +
+ Call +
-- cgit 1.5.1 From fa6b3490e299ebdb8c24e5858036bbfb67e76c6b Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 1 Sep 2014 15:53:07 +0100 Subject: Handle call events in the recents view as well to get consistency with what it displays when refreshed. --- webclient/recents/recents-controller.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'webclient') diff --git a/webclient/recents/recents-controller.js b/webclient/recents/recents-controller.js index d33d41a922..c9fd022d7f 100644 --- a/webclient/recents/recents-controller.js +++ b/webclient/recents/recents-controller.js @@ -43,6 +43,11 @@ angular.module('RecentsController', ['matrixService', 'eventHandlerService']) $scope.rooms[event.room_id].lastMsg = event; } }); + $scope.$on(eventHandlerService.CALL_EVENT, function(ngEvent, event, isLive) { + if (isLive) { + $scope.rooms[event.room_id].lastMsg = event; + } + }); }; -- cgit 1.5.1 From b9172b982f6359debd867557028e9df12bf3fe71 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 1 Sep 2014 16:22:57 +0100 Subject: missing semicolon --- webclient/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'webclient') diff --git a/webclient/index.html b/webclient/index.html index 3c31a8a051..bf24e392ac 100644 --- a/webclient/index.html +++ b/webclient/index.html @@ -56,7 +56,7 @@ -- cgit 1.5.1 From 9b61076d42aa241c2f0766ab2b60c055c9e4abee Mon Sep 17 00:00:00 2001 From: Emmanuel ROHEE Date: Mon, 1 Sep 2014 17:43:14 +0200 Subject: BF: Check config exists (=defined in the localstorage) before using it --- webclient/app-controller.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'webclient') diff --git a/webclient/app-controller.js b/webclient/app-controller.js index 172770f82f..97f799d623 100644 --- a/webclient/app-controller.js +++ b/webclient/app-controller.js @@ -36,8 +36,12 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even eventStreamService.resume(); mPresence.start(); } - - $scope.user_id = matrixService.config().user_id; + + $scope.user_id; + var config = matrixService.config(); + if (config) { + $scope.user_id = matrixService.config().user_id; + } /** * Open a given page. -- cgit 1.5.1 From 57f047a05a310883d534a6b01ac99916586fa584 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 1 Sep 2014 17:15:26 +0100 Subject: Fairly simple move of the call status widget to the header bar (and therefore into the index page rather than the rooms page). --- webclient/app-controller.js | 28 ++++++++++++++++++++++++---- webclient/app.css | 4 ++++ webclient/index.html | 13 +++++++++++++ webclient/room/room-controller.js | 28 +++------------------------- webclient/room/room.html | 11 ----------- 5 files changed, 44 insertions(+), 40 deletions(-) (limited to 'webclient') diff --git a/webclient/app-controller.js b/webclient/app-controller.js index 97f799d623..42c45f7c31 100644 --- a/webclient/app-controller.js +++ b/webclient/app-controller.js @@ -21,8 +21,8 @@ limitations under the License. 'use strict'; angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'eventStreamService']) -.controller('MatrixWebClientController', ['$scope', '$location', '$rootScope', 'matrixService', 'mPresence', 'eventStreamService', - function($scope, $location, $rootScope, matrixService, mPresence, eventStreamService) { +.controller('MatrixWebClientController', ['$scope', '$location', '$rootScope', 'matrixService', 'mPresence', 'eventStreamService', 'matrixPhoneService', + function($scope, $location, $rootScope, matrixService, mPresence, eventStreamService, matrixPhoneService) { // Check current URL to avoid to display the logout button on the login page $scope.location = $location.path(); @@ -88,7 +88,27 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even $scope.updateHeader = function() { $scope.user_id = matrixService.config().user_id; }; + + $rootScope.$on(matrixPhoneService.INCOMING_CALL_EVENT, function(ngEvent, call) { + console.trace("incoming call"); + call.onError = $scope.onCallError; + call.onHangup = $scope.onCallHangup; + $rootScope.currentCall = call; + }); + + $scope.answerCall = function() { + $scope.currentCall.answer(); + }; + + $scope.hangupCall = function() { + $scope.currentCall.hangup(); + $scope.currentCall = undefined; + }; -}]); + $rootScope.onCallError = function(errStr) { + $scope.feedback = errStr; + } - + $rootScope.onCallHangup = function() { + } +}]); diff --git a/webclient/app.css b/webclient/app.css index cd1820e155..8685032d72 100755 --- a/webclient/app.css +++ b/webclient/app.css @@ -43,6 +43,10 @@ a:active { color: #000; } height: 32px; } +#callBar { + float: left; +} + #headerContent { color: #ccc; max-width: 1280px; diff --git a/webclient/index.html b/webclient/index.html index bf24e392ac..f016dbb877 100644 --- a/webclient/index.html +++ b/webclient/index.html @@ -44,6 +44,19 @@ {{ feedback }} -- cgit 1.5.1 From 7d99cee3ef9e84ea24755ef9097342cf631cda59 Mon Sep 17 00:00:00 2001 From: Emmanuel ROHEE Date: Mon, 1 Sep 2014 18:50:39 +0200 Subject: Added roomName, a directive to compute a room name based on its alias (not aliases for now) and its users displaynames or ids --- webclient/app-filter.js | 39 +++++++++++++++++++++++++++++++++ webclient/recents/recents-controller.js | 7 +++--- webclient/recents/recents.html | 2 +- webclient/room/room.html | 2 +- 4 files changed, 45 insertions(+), 5 deletions(-) (limited to 'webclient') diff --git a/webclient/app-filter.js b/webclient/app-filter.js index b8f4ed25bc..124f4ebb48 100644 --- a/webclient/app-filter.js +++ b/webclient/app-filter.js @@ -79,4 +79,43 @@ angular.module('matrixWebClient') return function(text) { return $sce.trustAsHtml(text); }; +}]) + +// Compute the room name according to information we have +.filter('roomName', ['$rootScope', 'matrixService', function($rootScope, matrixService) { + return function(room_id) { + var roomName; + + // If there is an alias, use it + // TODO: only one alias is managed for now + var alias = matrixService.getRoomIdToAliasMapping(room_id); + if (alias) { + roomName = alias; + } + + if (undefined === roomName) { + // Else, build the name from its users + var room = $rootScope.events.rooms[room_id]; + if (room) { + if (room.members) { + // Limit the room renaming to 1:1 room + if (2 === Object.keys(room.members).length) { + for (var i in room.members) { + var member = room.members[i]; + if (member.user_id !== matrixService.config().user_id) { + roomName = member.content.displayname ? member.content.displayname : member.user_id; + } + } + } + } + } + } + + if (undefined === roomName) { + // By default, use the room ID + roomName = room_id; + } + + return roomName; + }; }]); diff --git a/webclient/recents/recents-controller.js b/webclient/recents/recents-controller.js index c9fd022d7f..947bd29de3 100644 --- a/webclient/recents/recents-controller.js +++ b/webclient/recents/recents-controller.js @@ -33,8 +33,7 @@ angular.module('RecentsController', ['matrixService', 'eventHandlerService']) console.log("Invited to room " + event.room_id); // FIXME push membership to top level key to match /im/sync event.membership = event.content.membership; - // FIXME bodge a nicer name than the room ID for this invite. - event.room_display_name = event.user_id + "'s room"; + $scope.rooms[event.room_id] = event; } }); @@ -88,7 +87,9 @@ angular.module('RecentsController', ['matrixService', 'eventHandlerService']) }; $scope.onInit = function() { - refresh(); + eventHandlerService.waitForInitialSyncCompletion().then(function() { + refresh(); + }); }; }]); diff --git a/webclient/recents/recents.html b/webclient/recents/recents.html index 56fb38b02a..db3b0fb32f 100644 --- a/webclient/recents/recents.html +++ b/webclient/recents/recents.html @@ -6,7 +6,7 @@ ng-class="{'recentsRoomSelected': (room.room_id === recentsSelectedRoomID)}"> - {{ room.room_display_name }} + {{ room.room_id | roomName }} {{ (room.lastMsg.ts) | date:'MMM d HH:mm' }} diff --git a/webclient/room/room.html b/webclient/room/room.html index c4d6ccd6cc..f118461e6b 100644 --- a/webclient/room/room.html +++ b/webclient/room/room.html @@ -3,7 +3,7 @@
[matrix]
- {{ room_alias || room_id }} + {{ room_id | roomName }}
-- cgit 1.5.1 From 0271e8e692ba2cedb2bea5a1deca81c1dc5f67eb Mon Sep 17 00:00:00 2001 From: Emmanuel ROHEE Date: Mon, 1 Sep 2014 19:09:17 +0200 Subject: Follow API renaming. state -> presence. mtime_ago -> last_active_ago --- webclient/app-filter.js | 2 +- webclient/room/room-controller.js | 25 ++++++++++++------------- webclient/room/room.html | 4 ++-- 3 files changed, 15 insertions(+), 16 deletions(-) (limited to 'webclient') diff --git a/webclient/app-filter.js b/webclient/app-filter.js index 124f4ebb48..b8d3d2a0d8 100644 --- a/webclient/app-filter.js +++ b/webclient/app-filter.js @@ -70,7 +70,7 @@ angular.module('matrixWebClient') }); filtered.sort(function (a, b) { - return ((a["mtime_age"] || 10e10) > (b["mtime_age"] || 10e10) ? 1 : -1); + return ((a["last_active_ago"] || 10e10) > (b["last_active_ago"] || 10e10) ? 1 : -1); }); return filtered; }; diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js index b20a72f25b..9861b25617 100644 --- a/webclient/room/room-controller.js +++ b/webclient/room/room-controller.js @@ -165,11 +165,11 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput']) var isNewMember = !(target_user_id in $scope.members); if (isNewMember) { // FIXME: why are we copying these fields around inside chunk? - if ("state" in chunk.content) { - chunk.presenceState = chunk.content.state; // why is this renamed? + if ("presence" in chunk.content) { + chunk.presence = chunk.content.presence; } - if ("mtime_age" in chunk.content) { - chunk.mtime_age = chunk.content.mtime_age; + if ("last_active_ago" in chunk.content) { + chunk.last_active_ago = chunk.content.last_active_ago; } if ("displayname" in chunk.content) { chunk.displayname = chunk.content.displayname; @@ -188,11 +188,11 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput']) // selectively update membership and presence else it will nuke the picture and displayname too :/ var member = $scope.members[target_user_id]; member.membership = chunk.content.membership; - if ("state" in chunk.content) { - member.presenceState = chunk.content.state; + if ("presence" in chunk.content) { + member.presence = chunk.content.presence; } - if ("mtime_age" in chunk.content) { - member.mtime_age = chunk.content.mtime_age; + if ("last_active_ago" in chunk.content) { + member.last_active_ago = chunk.content.last_active_ago; } } }; @@ -211,13 +211,12 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput']) var member = $scope.members[chunk.content.user_id]; // XXX: why not just pass the chunk straight through? - if ("state" in chunk.content) { - member.presenceState = chunk.content.state; + if ("presence" in chunk.content) { + member.presence = chunk.content.presence; } - if ("mtime_age" in chunk.content) { - // FIXME: should probably keep updating mtime_age in realtime like FB does - member.mtime_age = chunk.content.mtime_age; + if ("last_active_ago" in chunk.content) { + member.last_active_ago = chunk.content.last_active_ago; } // this may also contain a new display name or avatar url, so check. diff --git a/webclient/room/room.html b/webclient/room/room.html index f118461e6b..e25c837aa0 100644 --- a/webclient/room/room.html +++ b/webclient/room/room.html @@ -26,8 +26,8 @@
{{ member.displayname || member.id.substr(0, member.id.indexOf(':')) }}
{{ member.displayname ? "" : member.id.substr(member.id.indexOf(':')) }}
- - {{ member.mtime_age + (now - member.last_updated) | duration }}
ago
+ + {{ member.last_active_ago + (now - member.last_updated) | duration }}
ago
-- cgit 1.5.1