Fix small issues with the messenger
This commit is contained in:
parent
8b05b1acaf
commit
c38eb6588e
@ -147,6 +147,7 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
position: relative;
|
position: relative;
|
||||||
order: -2;
|
order: -2;
|
||||||
|
resize: horizontal;
|
||||||
#cp-app-contacts-container {
|
#cp-app-contacts-container {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
@ -991,7 +992,8 @@
|
|||||||
height: @toolbar_line-height;
|
height: @toolbar_line-height;
|
||||||
}
|
}
|
||||||
|
|
||||||
#cp-toolbar-userlist-drawer-open { order: 1; }
|
#cp-toolbar-userlist-drawer-open { order: 0; }
|
||||||
|
#cp-toolbar-chat-drawer-open { order: 1; }
|
||||||
.cp-toolbar-share-button { order: 2; }
|
.cp-toolbar-share-button { order: 2; }
|
||||||
.cp-toolbar-spinner { order: 3; }
|
.cp-toolbar-spinner { order: 3; }
|
||||||
|
|
||||||
|
|||||||
@ -136,6 +136,8 @@ define(function () {
|
|||||||
|
|
||||||
out.userListButton = "User list";
|
out.userListButton = "User list";
|
||||||
|
|
||||||
|
out.chatButton = "Chat";
|
||||||
|
|
||||||
out.userAccountButton = "Your account";
|
out.userAccountButton = "Your account";
|
||||||
|
|
||||||
out.newButton = 'New';
|
out.newButton = 'New';
|
||||||
@ -376,6 +378,10 @@ define(function () {
|
|||||||
out.contacts_removeHistoryServerError = 'There was an error while removing your chat history. Try again later';
|
out.contacts_removeHistoryServerError = 'There was an error while removing your chat history. Try again later';
|
||||||
out.contacts_fetchHistory = "Retrieve older history";
|
out.contacts_fetchHistory = "Retrieve older history";
|
||||||
|
|
||||||
|
out.contacts_friends = "Friends";
|
||||||
|
out.contacts_rooms = "Rooms";
|
||||||
|
out.contacts_leaveRoom = "Leave this room";
|
||||||
|
|
||||||
// File manager
|
// File manager
|
||||||
|
|
||||||
out.fm_rootName = "Documents";
|
out.fm_rootName = "Documents";
|
||||||
|
|||||||
@ -19,17 +19,16 @@
|
|||||||
flex-flow: column;
|
flex-flow: column;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
width: 50%;
|
|
||||||
min-width: 20%;
|
min-width: 20%;
|
||||||
max-width: 80%;
|
max-width: 80%;
|
||||||
resize: horizontal;
|
resize: horizontal;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
width: 50%;
|
||||||
&.cp-app-code-fullpage {
|
&.cp-app-code-fullpage {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
resize: none;
|
resize: none;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
.CodeMirror {
|
.CodeMirror {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@ -51,9 +50,13 @@
|
|||||||
#cp-app-code-container { display: none; }
|
#cp-app-code-container { display: none; }
|
||||||
#cp-app-code-preview { border: 0; }
|
#cp-app-code-preview { border: 0; }
|
||||||
}
|
}
|
||||||
|
&.cp-chat-visible {
|
||||||
|
#cp-app-code-container {
|
||||||
|
width: 35%;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#cp-app-code-preview {
|
#cp-app-code-preview {
|
||||||
flex: 1;
|
|
||||||
padding: 5px 20px;
|
padding: 5px 20px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@ -63,6 +66,7 @@
|
|||||||
font-family: Calibri,Ubuntu,sans-serif;
|
font-family: Calibri,Ubuntu,sans-serif;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
flex: 1;
|
||||||
media-tag {
|
media-tag {
|
||||||
* {
|
* {
|
||||||
max-width:100%;
|
max-width:100%;
|
||||||
|
|||||||
@ -54,7 +54,7 @@ define([
|
|||||||
|
|
||||||
var msgAlreadyKnown = function (channel, sig) {
|
var msgAlreadyKnown = function (channel, sig) {
|
||||||
return channel.messages.some(function (message) {
|
return channel.messages.some(function (message) {
|
||||||
return message[0] === sig;
|
return message.sig === sig;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -291,9 +291,9 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
var pushMsg = function (channel, cryptMsg) {
|
var pushMsg = function (channel, cryptMsg) {
|
||||||
var msg = channel.encryptor.decrypt(cryptMsg);
|
|
||||||
var sig = cryptMsg.slice(0, 64);
|
var sig = cryptMsg.slice(0, 64);
|
||||||
if (msgAlreadyKnown(channel, sig)) { return; }
|
if (msgAlreadyKnown(channel, sig)) { return; }
|
||||||
|
var msg = channel.encryptor.decrypt(cryptMsg);
|
||||||
|
|
||||||
var parsedMsg = JSON.parse(msg);
|
var parsedMsg = JSON.parse(msg);
|
||||||
var curvePublic;
|
var curvePublic;
|
||||||
@ -435,7 +435,8 @@ define([
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}).filter(function (decrypted) {
|
}).filter(function (decrypted) {
|
||||||
if (decrypted.d && decrypted.d[0] !== Types.message) { return; }
|
if (!decrypted.d || decrypted.d[0] !== Types.message) { return; }
|
||||||
|
if (msgAlreadyKnown(channel, decrypted.sig)) { return; }
|
||||||
return decrypted;
|
return decrypted;
|
||||||
}).map(function (O) {
|
}).map(function (O) {
|
||||||
return {
|
return {
|
||||||
@ -803,8 +804,6 @@ define([
|
|||||||
});
|
});
|
||||||
// TODO load rooms
|
// TODO load rooms
|
||||||
}).nThen(function () {
|
}).nThen(function () {
|
||||||
// TODO send event chat ready
|
|
||||||
// Remove spinner in chatbox
|
|
||||||
ready = true;
|
ready = true;
|
||||||
eachHandler('event', function (f) {
|
eachHandler('event', function (f) {
|
||||||
f('READY');
|
f('READY');
|
||||||
@ -850,6 +849,8 @@ define([
|
|||||||
name = friend.displayName;
|
name = friend.displayName;
|
||||||
lastKnownHash = friend.lastKnownHash;
|
lastKnownHash = friend.lastKnownHash;
|
||||||
curvePublic = friend.curvePublic;
|
curvePublic = friend.curvePublic;
|
||||||
|
} else if (r.isPadChat) {
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
// TODO room get metadata (name) && lastKnownHash
|
// TODO room get metadata (name) && lastKnownHash
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,7 @@ define([
|
|||||||
'/common/common-hash.js',
|
'/common/common-hash.js',
|
||||||
'/common/common-feedback.js',
|
'/common/common-feedback.js',
|
||||||
'/common/sframe-messenger-inner.js',
|
'/common/sframe-messenger-inner.js',
|
||||||
'/contacts/messenger-ui.js',
|
'/contacts/messenger-ui.js?'+ +new Date(),
|
||||||
'/customize/messages.js',
|
'/customize/messages.js',
|
||||||
], function ($, Config, ApiConfig, UIElements, UI, Hash, Feedback,
|
], function ($, Config, ApiConfig, UIElements, UI, Hash, Feedback,
|
||||||
Messenger, MessengerUI, Messages) {
|
Messenger, MessengerUI, Messages) {
|
||||||
@ -437,9 +437,9 @@ Messenger, MessengerUI, Messages) {
|
|||||||
|
|
||||||
toolbar.chatContent = $content;
|
toolbar.chatContent = $content;
|
||||||
|
|
||||||
var $container = $('<span>', {id: 'cp-toolbar-chat-drawer-open', title: Messages.chatButton || 'CHAT'}); //XXX
|
var $container = $('<span>', {id: 'cp-toolbar-chat-drawer-open', title: Messages.chatButton});
|
||||||
|
|
||||||
var $button = $('<button>').text('Chat').appendTo($container); //XXX
|
var $button = $('<button>', {'class': 'fa fa-comments'}).appendTo($container);
|
||||||
$('<span>',{'class': 'cp-dropdown-button-title'}).appendTo($button);
|
$('<span>',{'class': 'cp-dropdown-button-title'}).appendTo($button);
|
||||||
|
|
||||||
toolbar.$leftside.prepend($container);
|
toolbar.$leftside.prepend($container);
|
||||||
@ -451,11 +451,13 @@ Messenger, MessengerUI, Messages) {
|
|||||||
var hide = function () {
|
var hide = function () {
|
||||||
$content.hide();
|
$content.hide();
|
||||||
$button.removeClass('cp-toolbar-button-active');
|
$button.removeClass('cp-toolbar-button-active');
|
||||||
|
config.$contentContainer.removeClass('cp-chat-visible');
|
||||||
};
|
};
|
||||||
var show = function () {
|
var show = function () {
|
||||||
if (Bar.isEmbed) { $content.hide(); return; }
|
if (Bar.isEmbed) { $content.hide(); return; }
|
||||||
$content.show();
|
$content.show();
|
||||||
$button.addClass('cp-toolbar-button-active');
|
$button.addClass('cp-toolbar-button-active');
|
||||||
|
config.$contentContainer.addClass('cp-chat-visible');
|
||||||
};
|
};
|
||||||
$closeIcon.click(function () {
|
$closeIcon.click(function () {
|
||||||
Common.setAttribute(['toolbar', 'chat-drawer'], false);
|
Common.setAttribute(['toolbar', 'chat-drawer'], false);
|
||||||
@ -467,7 +469,6 @@ Messenger, MessengerUI, Messages) {
|
|||||||
else { show(); }
|
else { show(); }
|
||||||
visible = !visible;
|
visible = !visible;
|
||||||
Common.setAttribute(['toolbar', 'chat-drawer'], visible);
|
Common.setAttribute(['toolbar', 'chat-drawer'], visible);
|
||||||
//Feedback.send(visible?'USERLIST_SHOW': 'USERLIST_HIDE'); // XXX
|
|
||||||
});
|
});
|
||||||
show();
|
show();
|
||||||
Common.getAttribute(['toolbar', 'chat-drawer'], function (err, val) {
|
Common.getAttribute(['toolbar', 'chat-drawer'], function (err, val) {
|
||||||
|
|||||||
@ -65,11 +65,11 @@ define([
|
|||||||
]),
|
]),
|
||||||
h('div.cp-app-contacts-friends.cp-app-contacts-category', [
|
h('div.cp-app-contacts-friends.cp-app-contacts-category', [
|
||||||
h('div.cp-app-contacts-category-content'),
|
h('div.cp-app-contacts-category-content'),
|
||||||
h('h2.cp-app-contacts-category-title', 'Friends'), // XXX
|
h('h2.cp-app-contacts-category-title', Messages.contacts_friends),
|
||||||
]),
|
]),
|
||||||
h('div.cp-app-contacts-rooms.cp-app-contacts-category', [
|
h('div.cp-app-contacts-rooms.cp-app-contacts-category', [
|
||||||
h('div.cp-app-contacts-category-content'),
|
h('div.cp-app-contacts-category-content'),
|
||||||
h('h2.cp-app-contacts-category-title', 'Rooms'), // XXX
|
h('h2.cp-app-contacts-category-title', Messages.contacts_rooms),
|
||||||
]),
|
]),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -443,7 +443,7 @@ define([
|
|||||||
title: Messages.contacts_remove
|
title: Messages.contacts_remove
|
||||||
});
|
});
|
||||||
var leaveRoom = h('span.cp-app-contacts-remove.fa.fa-sign-out', {
|
var leaveRoom = h('span.cp-app-contacts-remove.fa.fa-sign-out', {
|
||||||
title: 'Leave this room' // XXX
|
title: Messages.contacts_leaveRoom
|
||||||
});
|
});
|
||||||
|
|
||||||
var status = h('span.cp-app-contacts-status');
|
var status = h('span.cp-app-contacts-status');
|
||||||
@ -581,8 +581,6 @@ define([
|
|||||||
'.cp-app-contacts-name, div.cp-app-contacts-message'+
|
'.cp-app-contacts-name, div.cp-app-contacts-message'+
|
||||||
userQuery(curvePublic) + ' div.cp-app-contacts-sender').text(name);
|
userQuery(curvePublic) + ' div.cp-app-contacts-sender').text(name);
|
||||||
|
|
||||||
// XXX update name in state.channels[id] ??
|
|
||||||
|
|
||||||
// TODO room
|
// TODO room
|
||||||
// Update name in room userlist
|
// Update name in room userlist
|
||||||
}
|
}
|
||||||
@ -628,7 +626,7 @@ define([
|
|||||||
if (!room.isPadChat && (!Array.isArray(list) || !list.length)) {
|
if (!room.isPadChat && (!Array.isArray(list) || !list.length)) {
|
||||||
return void console.error("Empty room!");
|
return void console.error("Empty room!");
|
||||||
}
|
}
|
||||||
debug('userlist: ' + JSON.stringify(list));
|
debug('userlist: ' + JSON.stringify(list), id);
|
||||||
|
|
||||||
var friend = {};
|
var friend = {};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user