From c3a774e414324746c484ad21d19c4be4e2167cd0 Mon Sep 17 00:00:00 2001 From: Emmanuel ROHEE Date: Fri, 29 Aug 2014 17:11:03 +0200 Subject: Show desktop notification state. Provide help if the user has previously denied permission to display them. --- webclient/settings/settings.html | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'webclient/settings/settings.html') diff --git a/webclient/settings/settings.html b/webclient/settings/settings.html index 453a4fc35f..d06a0083fa 100644 --- a/webclient/settings/settings.html +++ b/webclient/settings/settings.html @@ -52,7 +52,25 @@
- + +

Desktop notifications

+
+
+ Notifications are enabled. +
+
+ You have denied permission for notifications.
+ To enable it, reset the notification setting for this web site into your browser settings. +
+
+ +
+
+ Sorry, your browser does not support notifications. +
+
+
+

Configuration

Home server: {{ config.homeserver }}
@@ -60,11 +78,6 @@
Access token: {{ config.access_token }}

- -
-
-
-
{{ feedback }} -- cgit 1.4.1 From 67f42b2f26a6ea76ec480167c58e1fa115809e23 Mon Sep 17 00:00:00 2001 From: Emmanuel ROHEE Date: Fri, 29 Aug 2014 18:22:05 +0200 Subject: Get user display name and avatar from the server rather than storing them in the local storage --- webclient/home/home-controller.js | 27 +++++++++++++++++ webclient/home/home.html | 6 ++-- webclient/settings/settings-controller.js | 50 +++++++++++++++++++++---------- webclient/settings/settings.html | 6 ++-- 4 files changed, 68 insertions(+), 21 deletions(-) (limited to 'webclient/settings/settings.html') diff --git a/webclient/home/home-controller.js b/webclient/home/home-controller.js index 547a5c5603..7ae13f12e8 100644 --- a/webclient/home/home-controller.js +++ b/webclient/home/home-controller.js @@ -37,6 +37,11 @@ angular.module('HomeController', ['matrixService', 'eventHandlerService', 'Recen $scope.joinAlias = { room_alias: "" }; + + $scope.profile = { + displayName: "", + avatarUrl: "" + }; var refresh = function() { @@ -108,6 +113,28 @@ angular.module('HomeController', ['matrixService', 'eventHandlerService', 'Recen }; $scope.onInit = function() { + // Load profile data + // Display name + matrixService.getDisplayName($scope.config.user_id).then( + function(response) { + $scope.profile.displayName = response.data.displayname; + $scope.profileOnServer.displayName = response.data.displayname; + }, + function(error) { + $scope.feedback = "Can't load display name"; + } + ); + // Avatar + matrixService.getProfilePictureUrl($scope.config.user_id).then( + function(response) { + $scope.profile.avatarUrl = response.data.avatar_url; + $scope.profileOnServer.avatarUrl = response.data.avatar_url; + }, + function(error) { + $scope.feedback = "Can't load avatar URL"; + } + ); + refresh(); }; }]); diff --git a/webclient/home/home.html b/webclient/home/home.html index d38b843d83..1b1c21d9d2 100644 --- a/webclient/home/home.html +++ b/webclient/home/home.html @@ -9,13 +9,13 @@
- +
-
{{ config.displayName }}
-
{{ config.user_id }}
+
{{ profile.displayName }}
+
{{ config.user_id }}
diff --git a/webclient/settings/settings-controller.js b/webclient/settings/settings-controller.js index 3a9060ebae..dc680ef075 100644 --- a/webclient/settings/settings-controller.js +++ b/webclient/settings/settings-controller.js @@ -22,10 +22,40 @@ angular.module('SettingsController', ['matrixService', 'mFileUpload', 'mFileInpu $scope.config = matrixService.config(); $scope.profile = { - displayName: $scope.config.displayName, - avatarUrl: $scope.config.avatarUrl + displayName: "", + avatarUrl: "" }; - + + // The profile as stored on the server + $scope.profileOnServer = { + displayName: "", + avatarUrl: "" + }; + + $scope.onInit = function() { + // Load profile data + // Display name + matrixService.getDisplayName($scope.config.user_id).then( + function(response) { + $scope.profile.displayName = response.data.displayname; + $scope.profileOnServer.displayName = response.data.displayname; + }, + function(error) { + $scope.feedback = "Can't load display name"; + } + ); + // Avatar + matrixService.getProfilePictureUrl($scope.config.user_id).then( + function(response) { + $scope.profile.avatarUrl = response.data.avatar_url; + $scope.profileOnServer.avatarUrl = response.data.avatar_url; + }, + function(error) { + $scope.feedback = "Can't load avatar URL"; + } + ); + }; + $scope.$watch("profile.avatarFile", function(newValue, oldValue) { if ($scope.profile.avatarFile) { console.log("Uploading new avatar file..."); @@ -41,10 +71,10 @@ angular.module('SettingsController', ['matrixService', 'mFileUpload', 'mFileInpu }); $scope.saveProfile = function() { - if ($scope.profile.displayName !== $scope.config.displayName) { + if ($scope.profile.displayName !== $scope.profileOnServer.displayName) { setDisplayName($scope.profile.displayName); } - if ($scope.profile.avatarUrl !== $scope.config.avatarUrl) { + if ($scope.profile.avatarUrl !== $scope.profileOnServer.avatarUrl) { setAvatar($scope.profile.avatarUrl); } }; @@ -53,11 +83,6 @@ angular.module('SettingsController', ['matrixService', 'mFileUpload', 'mFileInpu matrixService.setDisplayName(displayName).then( function(response) { $scope.feedback = "Updated display name."; - - var config = matrixService.config(); - config.displayName = displayName; - matrixService.setConfig(config); - matrixService.saveConfig(); }, function(error) { $scope.feedback = "Can't update display name: " + error.data; @@ -71,11 +96,6 @@ angular.module('SettingsController', ['matrixService', 'mFileUpload', 'mFileInpu function(response) { console.log("Updated avatar"); $scope.feedback = "Updated avatar."; - - var config = matrixService.config(); - config.avatarUrl = avatarURL; - matrixService.setConfig(config); - matrixService.saveConfig(); }, function(error) { $scope.feedback = "Can't update avatar: " + error.data; diff --git a/webclient/settings/settings.html b/webclient/settings/settings.html index d06a0083fa..51884e7209 100644 --- a/webclient/settings/settings.html +++ b/webclient/settings/settings.html @@ -1,4 +1,4 @@ -
+
@@ -10,7 +10,7 @@
- +
@@ -19,7 +19,7 @@
- -- cgit 1.4.1 From 2a0e79bbfabebc05ea3b1b2fd62af9bd198d8087 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 30 Aug 2014 00:50:51 +0100 Subject: tweaks to settings page --- webclient/app.css | 9 +++------ webclient/settings/settings.html | 35 +++++++++++++---------------------- 2 files changed, 16 insertions(+), 28 deletions(-) (limited to 'webclient/settings/settings.html') diff --git a/webclient/app.css b/webclient/app.css index 9ba0aa997c..a5d0199bab 100644 --- a/webclient/app.css +++ b/webclient/app.css @@ -428,15 +428,12 @@ h1 { } .profile-avatar img { - max-width: 100%; - max-height: 100%; + width: 100%; + height: 100%; + object-fit: cover; } /*** User profile page ***/ -#user-ids { - padding-left: 1em; -} - #user-displayname { font-size: 24px; } diff --git a/webclient/settings/settings.html b/webclient/settings/settings.html index 51884e7209..75d8e0887c 100644 --- a/webclient/settings/settings.html +++ b/webclient/settings/settings.html @@ -4,32 +4,22 @@

Me

-
+
- - - - - - -
-
- -
-
-
- -
-
- -
+
+ +
+
+ + +

Linked emails

-
+
+
@@ -54,5 +49,4 @@ {{ feedback }}
-
diff --git a/webclient/index.html b/webclient/index.html index fdc50a5212..3c31a8a051 100644 --- a/webclient/index.html +++ b/webclient/index.html @@ -4,6 +4,8 @@ [matrix] + + @@ -19,6 +21,7 @@ + @@ -38,16 +41,23 @@ - +
-
+
+ diff --git a/webclient/login/login-controller.js b/webclient/login/login-controller.js index 51f9a3bdf4..2b91926954 100644 --- a/webclient/login/login-controller.js +++ b/webclient/login/login-controller.js @@ -10,63 +10,26 @@ angular.module('LoginController', ['matrixService']) if ($location.port()) { hs_url += ":" + $location.port(); } + var example_domain = $location.host(); $scope.account = { homeserver: hs_url, + example_domain: example_domain, desired_user_name: "", user_id: "", password: "", - identityServer: "", + identityServer: "http://matrix.org:8090", pwd1: "", - pwd2: "" + pwd2: "", }; - - $scope.register = function() { - - // Set the urls - matrixService.setConfig({ - homeserver: $scope.account.homeserver, - identityServer: $scope.account.identityServer - }); - - if ($scope.account.pwd1 !== $scope.account.pwd2) { - $scope.feedback = "Passwords don't match."; - return; - } - else if ($scope.account.pwd1.length < 6) { - $scope.feedback = "Password must be at least 6 characters."; - return; - } - - matrixService.register($scope.account.desired_user_name, $scope.account.pwd1).then( - function(response) { - $scope.feedback = "Success"; - // Update the current config - var config = matrixService.config(); - angular.extend(config, { - access_token: response.data.access_token, - user_id: response.data.user_id - }); - matrixService.setConfig(config); - - // And permanently save it - matrixService.saveConfig(); - eventStreamService.resume(); - // Go to the user's rooms list page - $location.url("home"); - }, - function(error) { - if (error.data) { - if (error.data.errcode === "M_USER_IN_USE") { - $scope.feedback = "Username already taken."; - } - } - else if (error.status === 0) { - $scope.feedback = "Unable to talk to the server."; - } - }); + + $scope.login_types = [ "email", "mxid" ]; + $scope.login_type_label = { + "email": "Email address", + "mxid": "Matrix ID (e.g. @bob:matrix.org or bob)", }; - + $scope.login_type = 'mxid'; // TODO: remember the user's preferred login_type + $scope.login = function() { matrixService.setConfig({ homeserver: $scope.account.homeserver, diff --git a/webclient/login/login.html b/webclient/login/login.html index 4b2ea60928..8d5a53ebbc 100644 --- a/webclient/login/login.html +++ b/webclient/login/login.html @@ -1,55 +1,49 @@