diff --git a/header b/header index fd88ee27f7..060709b82e 100644 --- a/header +++ b/header @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/Avatar.js b/src/Avatar.js index c919630f96..e97ed6b673 100644 --- a/src/Avatar.js +++ b/src/Avatar.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/CallHandler.js b/src/CallHandler.js index 189e99b307..e5bc80246e 100644 --- a/src/CallHandler.js +++ b/src/CallHandler.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/ContentMessages.js b/src/ContentMessages.js index 094eff18d9..82c295756b 100644 --- a/src/ContentMessages.js +++ b/src/ContentMessages.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/ContextualMenu.js b/src/ContextualMenu.js index a7b1849e18..e720b69eda 100644 --- a/src/ContextualMenu.js +++ b/src/ContextualMenu.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/DateUtils.js b/src/DateUtils.js index 3b11b82ccf..208134ee83 100644 --- a/src/DateUtils.js +++ b/src/DateUtils.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/HtmlUtils.js b/src/HtmlUtils.js index 95c6a46458..603f595951 100644 --- a/src/HtmlUtils.js +++ b/src/HtmlUtils.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/MatrixClientPeg.js b/src/MatrixClientPeg.js index f250333461..dbb3dbf83e 100644 --- a/src/MatrixClientPeg.js +++ b/src/MatrixClientPeg.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/MatrixTools.js b/src/MatrixTools.js index 6c7a9ee9ba..7fded4adea 100644 --- a/src/MatrixTools.js +++ b/src/MatrixTools.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/Modal.js b/src/Modal.js index 41b1a9c0ab..d3a5404e1e 100644 --- a/src/Modal.js +++ b/src/Modal.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/Notifier.js b/src/Notifier.js index a35c3bb1ee..e52fd252fe 100644 --- a/src/Notifier.js +++ b/src/Notifier.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/Presence.js b/src/Presence.js index c3d6857e95..4152d7a487 100644 --- a/src/Presence.js +++ b/src/Presence.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/Resend.js b/src/Resend.js index e07e571455..ae5aaa9ea9 100644 --- a/src/Resend.js +++ b/src/Resend.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/RoomListSorter.js b/src/RoomListSorter.js index 730a0de18b..09f178dd3f 100644 --- a/src/RoomListSorter.js +++ b/src/RoomListSorter.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/Skinner.js b/src/Skinner.js index 3e71d10e2d..4482f2239c 100644 --- a/src/Skinner.js +++ b/src/Skinner.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/SlashCommands.js b/src/SlashCommands.js index f5eaff9066..363560f0c6 100644 --- a/src/SlashCommands.js +++ b/src/SlashCommands.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ var MatrixClientPeg = require("./MatrixClientPeg"); var MatrixTools = require("./MatrixTools"); var dis = require("./dispatcher"); var encryption = require("./encryption"); +var Tinter = require("./Tinter"); var reject = function(msg) { return { @@ -42,6 +43,12 @@ var commands = { return reject("Usage: /nick "); }, + // Takes an #rrggbb colourcode and retints the UI (just for debugging) + tint: function(room_id, args) { + Tinter.tint(args); + return success(); + }, + encrypt: function(room_id, args) { if (args == "on") { var client = MatrixClientPeg.get(); diff --git a/src/TabComplete.js b/src/TabComplete.js index 94be0193c6..6690802d5d 100644 --- a/src/TabComplete.js +++ b/src/TabComplete.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/TabCompleteEntries.js b/src/TabCompleteEntries.js index 6d1a51c9b2..d3efc0d2f1 100644 --- a/src/TabCompleteEntries.js +++ b/src/TabCompleteEntries.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/Tinter.js b/src/Tinter.js new file mode 100644 index 0000000000..a9b754ffde --- /dev/null +++ b/src/Tinter.js @@ -0,0 +1,197 @@ +/* +Copyright 2015 OpenMarket Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +var dis = require("./dispatcher"); + +// FIXME: these vars should be bundled up and attached to +// module.exports otherwise this will break when included by both +// react-sdk and apps layered on top. + +// The colour keys to be replaced as referred to in SVGs +var keyRgb = [ + "rgb(118, 207, 166)", // Vector Green + "rgb(234, 245, 240)", // Vector Light Green + "rgba(118, 207, 166, 0.2)", // BottomLeftMenu overlay (20% Vector Green) +]; + +// Some algebra workings for calculating the tint % of Vector Green & Light Green +// x * 118 + (1 - x) * 255 = 234 +// x * 118 + 255 - 255 * x = 234 +// x * 118 - x * 255 = 234 - 255 +// (255 - 118) x = 255 - 234 +// x = (255 - 234) / (255 - 118) = 0.16 + +// The colour keys to be replaced as referred to in SVGs +var keyHex = [ + "#76CFA6", // Vector Green + "#EAF5F0", // Vector Light Green + "#D3EFE1", // BottomLeftMenu overlay (20% Vector Green overlaid on Vector Light Green) +]; + +// cache of our replacement colours +// defaults to our keys. +var colors = [ + keyHex[0], + keyHex[1], + keyHex[2], +]; + +var cssFixups = [ + // { + // style: a style object that should be fixed up taken from a stylesheet + // attr: name of the attribute to be clobbered, e.g. 'color' + // index: ordinal of primary, secondary or tertiary + // } +]; + +// CSS attributes to be fixed up +var cssAttrs = [ + "color", + "backgroundColor", + "borderColor", +]; + +var svgAttrs = [ + "fill", + "stroke", +]; + +var cached = false; + +function calcCssFixups() { + for (var i = 0; i < document.styleSheets.length; i++) { + var ss = document.styleSheets[i]; + for (var j = 0; j < ss.cssRules.length; j++) { + var rule = ss.cssRules[j]; + if (!rule.style) continue; + for (var k = 0; k < cssAttrs.length; k++) { + var attr = cssAttrs[k]; + for (var l = 0; l < keyRgb.length; l++) { + if (rule.style[attr] === keyRgb[l]) { + cssFixups.push({ + style: rule.style, + attr: attr, + index: l, + }); + } + } + } + } + } +} + +function applyCssFixups() { + for (var i = 0; i < cssFixups.length; i++) { + var cssFixup = cssFixups[i]; + cssFixup.style[cssFixup.attr] = colors[cssFixup.index]; + } +} + +function hexToRgb(color) { + if (color[0] === '#') color = color.slice(1); + if (color.length === 3) { + color = color[0] + color[0] + + color[1] + color[1] + + color[2] + color[2]; + } + var val = parseInt(color, 16); + var r = (val >> 16) & 255; + var g = (val >> 8) & 255; + var b = val & 255; + return [r, g, b]; +} + +function rgbToHex(rgb) { + var val = (rgb[0] << 16) | (rgb[1] << 8) | rgb[2]; + return '#' + (0x1000000 + val).toString(16).slice(1) +} + +module.exports = { + tint: function(primaryColor, secondaryColor, tertiaryColor) { + if (!cached) { + calcCssFixups(); + cached = true; + } + + if (!secondaryColor) { + var x = 0.16; // average weighting factor calculated from vector green & light green + var rgb = hexToRgb(primaryColor); + rgb[0] = x * rgb[0] + (1 - x) * 255; + rgb[1] = x * rgb[1] + (1 - x) * 255; + rgb[2] = x * rgb[2] + (1 - x) * 255; + secondaryColor = rgbToHex(rgb); + } + + if (!tertiaryColor) { + var x = 0.19; + var rgb1 = hexToRgb(primaryColor); + var rgb2 = hexToRgb(secondaryColor); + rgb1[0] = x * rgb1[0] + (1 - x) * rgb2[0]; + rgb1[1] = x * rgb1[1] + (1 - x) * rgb2[1]; + rgb1[2] = x * rgb1[2] + (1 - x) * rgb2[2]; + tertiaryColor = rgbToHex(rgb1); + } + + colors = [primaryColor, secondaryColor, tertiaryColor]; + + // go through manually fixing up the stylesheets. + applyCssFixups(); + + // tell all the SVGs to go fix themselves up + dis.dispatch({ action: 'tint_update' }); + }, + + // XXX: we could just move this all into TintableSvg, but as it's so similar + // to the CSS fixup stuff in Tinter (just that the fixups are stored in TintableSvg) + // keeping it here for now. + calcSvgFixups: function(svgs) { + // go through manually fixing up SVG colours. + // we could do this by stylesheets, but keeping the stylesheets + // updated would be a PITA, so just brute-force search for the + // key colour; cache the element and apply. + + var fixups = []; + for (var i = 0; i < svgs.length; i++) { + var svgDoc = svgs[i].contentDocument; + if (!svgDoc) continue; + var tags = svgDoc.getElementsByTagName("*"); + for (var j = 0; j < tags.length; j++) { + var tag = tags[j]; + for (var k = 0; k < svgAttrs.length; k++) { + var attr = svgAttrs[k]; + for (var l = 0; l < keyHex.length; l++) { + if (tag.getAttribute(attr) && tag.getAttribute(attr).toUpperCase() === keyHex[l]) { + fixups.push({ + node: tag, + attr: attr, + index: l, + }); + } + } + } + } + } + + return fixups; + }, + + applySvgFixups: function(fixups) { + for (var i = 0; i < fixups.length; i++) { + var svgFixup = fixups[i]; + svgFixup.node.setAttribute(svgFixup.attr, colors[svgFixup.index]); + } + }, +}; diff --git a/src/UnreadStatus.js b/src/UnreadStatus.js index c8693c1e50..1227614257 100644 --- a/src/UnreadStatus.js +++ b/src/UnreadStatus.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/UserActivity.js b/src/UserActivity.js index b283b9a58e..3048ad4454 100644 --- a/src/UserActivity.js +++ b/src/UserActivity.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/UserSettingsStore.js b/src/UserSettingsStore.js index 55a0518d85..45aca1f0dc 100644 --- a/src/UserSettingsStore.js +++ b/src/UserSettingsStore.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/component-index.js b/src/component-index.js index f10549ce4d..0c08d70b73 100644 --- a/src/component-index.js +++ b/src/component-index.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,14 +23,14 @@ limitations under the License. module.exports.components = {}; module.exports.components['structures.CreateRoom'] = require('./components/structures/CreateRoom'); -module.exports.components['structures.login.Login'] = require('./components/structures/login/Login'); -module.exports.components['structures.login.PostRegistration'] = require('./components/structures/login/PostRegistration'); -module.exports.components['structures.login.Registration'] = require('./components/structures/login/Registration'); module.exports.components['structures.MatrixChat'] = require('./components/structures/MatrixChat'); module.exports.components['structures.RoomView'] = require('./components/structures/RoomView'); module.exports.components['structures.ScrollPanel'] = require('./components/structures/ScrollPanel'); module.exports.components['structures.UploadBar'] = require('./components/structures/UploadBar'); module.exports.components['structures.UserSettings'] = require('./components/structures/UserSettings'); +module.exports.components['structures.login.Login'] = require('./components/structures/login/Login'); +module.exports.components['structures.login.PostRegistration'] = require('./components/structures/login/PostRegistration'); +module.exports.components['structures.login.Registration'] = require('./components/structures/login/Registration'); module.exports.components['views.avatars.MemberAvatar'] = require('./components/views/avatars/MemberAvatar'); module.exports.components['views.avatars.RoomAvatar'] = require('./components/views/avatars/RoomAvatar'); module.exports.components['views.create_room.CreateRoomButton'] = require('./components/views/create_room/CreateRoomButton'); @@ -41,6 +41,7 @@ module.exports.components['views.dialogs.LogoutPrompt'] = require('./components/ module.exports.components['views.dialogs.QuestionDialog'] = require('./components/views/dialogs/QuestionDialog'); module.exports.components['views.elements.EditableText'] = require('./components/views/elements/EditableText'); module.exports.components['views.elements.ProgressBar'] = require('./components/views/elements/ProgressBar'); +module.exports.components['views.elements.TintableSvg'] = require('./components/views/elements/TintableSvg'); module.exports.components['views.elements.UserSelector'] = require('./components/views/elements/UserSelector'); module.exports.components['views.login.CaptchaForm'] = require('./components/views/login/CaptchaForm'); module.exports.components['views.login.CasLogin'] = require('./components/views/login/CasLogin'); @@ -50,10 +51,10 @@ module.exports.components['views.login.LoginHeader'] = require('./components/vie module.exports.components['views.login.PasswordLogin'] = require('./components/views/login/PasswordLogin'); module.exports.components['views.login.RegistrationForm'] = require('./components/views/login/RegistrationForm'); module.exports.components['views.login.ServerConfig'] = require('./components/views/login/ServerConfig'); -module.exports.components['views.messages.MessageEvent'] = require('./components/views/messages/MessageEvent'); module.exports.components['views.messages.MFileBody'] = require('./components/views/messages/MFileBody'); module.exports.components['views.messages.MImageBody'] = require('./components/views/messages/MImageBody'); module.exports.components['views.messages.MVideoBody'] = require('./components/views/messages/MVideoBody'); +module.exports.components['views.messages.MessageEvent'] = require('./components/views/messages/MessageEvent'); module.exports.components['views.messages.TextualBody'] = require('./components/views/messages/TextualBody'); module.exports.components['views.messages.TextualEvent'] = require('./components/views/messages/TextualEvent'); module.exports.components['views.messages.UnknownBody'] = require('./components/views/messages/UnknownBody'); @@ -66,6 +67,7 @@ module.exports.components['views.rooms.RoomHeader'] = require('./components/view module.exports.components['views.rooms.RoomList'] = require('./components/views/rooms/RoomList'); module.exports.components['views.rooms.RoomSettings'] = require('./components/views/rooms/RoomSettings'); module.exports.components['views.rooms.RoomTile'] = require('./components/views/rooms/RoomTile'); +module.exports.components['views.rooms.SearchResultTile'] = require('./components/views/rooms/SearchResultTile'); module.exports.components['views.rooms.TabCompleteBar'] = require('./components/views/rooms/TabCompleteBar'); module.exports.components['views.settings.ChangeAvatar'] = require('./components/views/settings/ChangeAvatar'); module.exports.components['views.settings.ChangeDisplayName'] = require('./components/views/settings/ChangeDisplayName'); diff --git a/src/components/structures/CreateRoom.js b/src/components/structures/CreateRoom.js index f520318a0a..c21bc80c6b 100644 --- a/src/components/structures/CreateRoom.js +++ b/src/components/structures/CreateRoom.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index ead0eb6492..5760453670 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index fe9643a7fc..99d4c1aa49 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -574,8 +574,8 @@ module.exports = React.createClass({ getSearchResultTiles: function() { - var DateSeparator = sdk.getComponent('messages.DateSeparator'); var EventTile = sdk.getComponent('rooms.EventTile'); + var SearchResultTile = sdk.getComponent('rooms.SearchResultTile'); var cli = MatrixClientPeg.get(); // XXX: todo: merge overlapping results somehow? @@ -615,33 +615,27 @@ module.exports = React.createClass({ continue; } - var eventId = mxEv.getId(); - if (this.state.searchScope === 'All') { var roomId = mxEv.getRoomId(); if(roomId != lastRoomId) { - ret.push(
  • Room: { cli.getRoom(roomId).name }

  • ); + var room = cli.getRoom(roomId); + + // XXX: if we've left the room, we might not know about + // it. We should tell the js sdk to go and find out about + // it. But that's not an issue currently, as synapse only + // returns results for rooms we're joined to. + var roomName = room ? room.name : "Unknown room "+roomId; + + ret.push(
  • +

    Room: { roomName }

    +
  • ); lastRoomId = roomId; } } - var ts1 = mxEv.getTs(); - ret.push(
  • ); // Rank: {resultList[i].rank} - - var timeline = result.context.getTimeline(); - for (var j = 0; j < timeline.length; j++) { - var ev = timeline[j]; - var highlights; - var contextual = (j != result.context.getOurEventIndex()); - if (!contextual) { - highlights = this.state.searchHighlights; - } - if (EventTile.haveTileForEvent(ev)) { - ret.push(
  • - -
  • ); - } - } + ret.push(); } return ret; }, @@ -656,6 +650,7 @@ module.exports = React.createClass({ var prevEvent = null; // the last event we showed + var readReceiptEventId = this.state.room.getEventReadUpTo(MatrixClientPeg.get().credentials.userId); var startIdx = Math.max(0, this.state.room.timeline.length - this.state.messageCap); for (var i = startIdx; i < this.state.room.timeline.length; i++) { var mxEv = this.state.room.timeline[i]; @@ -706,6 +701,10 @@ module.exports = React.createClass({ ); + if (eventId == readReceiptEventId) { + ret.push(
    ); + } + prevEvent = mxEv; } @@ -1083,6 +1082,7 @@ module.exports = React.createClass({ var RoomSettings = sdk.getComponent("rooms.RoomSettings"); var SearchBar = sdk.getComponent("rooms.SearchBar"); var ScrollPanel = sdk.getComponent("structures.ScrollPanel"); + var TintableSvg = sdk.getComponent("elements.TintableSvg"); if (!this.state.room) { if (this.props.roomId) { @@ -1157,7 +1157,7 @@ module.exports = React.createClass({ if (this.state.syncState === "ERROR") { statusBar = (
    - /!\ + /!\
    Connectivity to the server has been lost. @@ -1176,8 +1176,8 @@ module.exports = React.createClass({
    ...
    -
    - ->| +
    + Auto-complete
    @@ -1187,7 +1187,7 @@ module.exports = React.createClass({ else if (this.state.hasUnsentMessages) { statusBar = (
    - /!\ + /!\
    Some of your messages have not been sent. @@ -1250,8 +1250,8 @@ module.exports = React.createClass({ var fileDropTarget = null; if (this.state.draggingFile) { fileDropTarget =
    -
    - Drop File Here
    +
    +
    Drop File Here
    ; @@ -1288,25 +1288,29 @@ module.exports = React.createClass({ if (call.type === "video") { zoomButton = ( -
    - Fill screen +
    +
    ); videoMuteButton =
    - + {call.isLocalVideoMuted()
    } voiceMuteButton =
    - + {call.isMicrophoneMuted()
    if (!statusBar) { statusBar =
    - + Active call
    ; } @@ -1317,7 +1321,7 @@ module.exports = React.createClass({ { videoMuteButton } { zoomButton } { statusBar } - +
    } diff --git a/src/components/structures/ScrollPanel.js b/src/components/structures/ScrollPanel.js index 052424529a..042458717d 100644 --- a/src/components/structures/ScrollPanel.js +++ b/src/components/structures/ScrollPanel.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/structures/UploadBar.js b/src/components/structures/UploadBar.js index 717c7f57b2..12e502026f 100644 --- a/src/components/structures/UploadBar.js +++ b/src/components/structures/UploadBar.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index c8916bfd44..c1550f9b6b 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/structures/login/Login.js b/src/components/structures/login/Login.js index 54cd9e3efb..b7d2d762a4 100644 --- a/src/components/structures/login/Login.js +++ b/src/components/structures/login/Login.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/structures/login/PostRegistration.js b/src/components/structures/login/PostRegistration.js index 51625a5971..c95f94cf4f 100644 --- a/src/components/structures/login/PostRegistration.js +++ b/src/components/structures/login/PostRegistration.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/structures/login/Registration.js b/src/components/structures/login/Registration.js index 19e55c4d76..7f6e408fef 100644 --- a/src/components/structures/login/Registration.js +++ b/src/components/structures/login/Registration.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/avatars/MemberAvatar.js b/src/components/views/avatars/MemberAvatar.js index 42c2f6ca2d..21c717aac5 100644 --- a/src/components/views/avatars/MemberAvatar.js +++ b/src/components/views/avatars/MemberAvatar.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/avatars/RoomAvatar.js b/src/components/views/avatars/RoomAvatar.js index 2c1de65bcf..a83bc799a2 100644 --- a/src/components/views/avatars/RoomAvatar.js +++ b/src/components/views/avatars/RoomAvatar.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/create_room/CreateRoomButton.js b/src/components/views/create_room/CreateRoomButton.js index 95ba4ac366..bb9406efe1 100644 --- a/src/components/views/create_room/CreateRoomButton.js +++ b/src/components/views/create_room/CreateRoomButton.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/create_room/Presets.js b/src/components/views/create_room/Presets.js index ee0d19c357..0cce4a6644 100644 --- a/src/components/views/create_room/Presets.js +++ b/src/components/views/create_room/Presets.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/create_room/RoomAlias.js b/src/components/views/create_room/RoomAlias.js index cc7382aadb..6d311db593 100644 --- a/src/components/views/create_room/RoomAlias.js +++ b/src/components/views/create_room/RoomAlias.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/dialogs/ErrorDialog.js b/src/components/views/dialogs/ErrorDialog.js index af827340d0..ed9364df60 100644 --- a/src/components/views/dialogs/ErrorDialog.js +++ b/src/components/views/dialogs/ErrorDialog.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/dialogs/LogoutPrompt.js b/src/components/views/dialogs/LogoutPrompt.js index ed58542a66..824924e999 100644 --- a/src/components/views/dialogs/LogoutPrompt.js +++ b/src/components/views/dialogs/LogoutPrompt.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/dialogs/QuestionDialog.js b/src/components/views/dialogs/QuestionDialog.js index 34f1483cee..f415201e45 100644 --- a/src/components/views/dialogs/QuestionDialog.js +++ b/src/components/views/dialogs/QuestionDialog.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/elements/EditableText.js b/src/components/views/elements/EditableText.js index ee88f1a853..beedfc35c8 100644 --- a/src/components/views/elements/EditableText.js +++ b/src/components/views/elements/EditableText.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/elements/ProgressBar.js b/src/components/views/elements/ProgressBar.js index bab6a701dd..12b34480f1 100644 --- a/src/components/views/elements/ProgressBar.js +++ b/src/components/views/elements/ProgressBar.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/elements/TintableSvg.js b/src/components/views/elements/TintableSvg.js new file mode 100644 index 0000000000..81fbed1921 --- /dev/null +++ b/src/components/views/elements/TintableSvg.js @@ -0,0 +1,69 @@ +/* +Copyright 2015 OpenMarket Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +'use strict'; + +var React = require('react'); +var ReactDOM = require("react-dom"); +var dis = require("../../../dispatcher"); +var Tinter = require("../../../Tinter"); + +module.exports = React.createClass({ + displayName: 'TintableSvg', + + propTypes: { + src: React.PropTypes.string.isRequired, + width: React.PropTypes.string.isRequired, + height: React.PropTypes.string.isRequired, + className: React.PropTypes.string, + }, + + componentWillMount: function() { + this.fixups = []; + this.dispatcherRef = dis.register(this.onAction); + }, + + componentDidMount: function() { + // we can't use onLoad on object due to https://github.com/facebook/react/pull/5781 + // so handle it with pure DOM instead + ReactDOM.findDOMNode(this).addEventListener('load', this.onLoad); + }, + + componentWillUnmount: function() { + ReactDOM.findDOMNode(this).removeEventListener('load', this.onLoad); + dis.unregister(this.dispatcherRef); + }, + + onAction: function(payload) { + if (payload.action !== 'tint_update') return; + Tinter.applySvgFixups(this.fixups); + }, + + onLoad: function(event) { + this.fixups = Tinter.calcSvgFixups([event.target]); + Tinter.applySvgFixups(this.fixups); + }, + + render: function() { + return ( + + ); + } +}); diff --git a/src/components/views/elements/UserSelector.js b/src/components/views/elements/UserSelector.js index ea04de59a9..5f176a3e54 100644 --- a/src/components/views/elements/UserSelector.js +++ b/src/components/views/elements/UserSelector.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/login/CaptchaForm.js b/src/components/views/login/CaptchaForm.js index 9b722f463b..fdbe6f1db1 100644 --- a/src/components/views/login/CaptchaForm.js +++ b/src/components/views/login/CaptchaForm.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/login/CasLogin.js b/src/components/views/login/CasLogin.js index 9380db9788..5c89fd3706 100644 --- a/src/components/views/login/CasLogin.js +++ b/src/components/views/login/CasLogin.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/login/CustomServerDialog.js b/src/components/views/login/CustomServerDialog.js index 3f86bc199c..8a67dfd7e6 100644 --- a/src/components/views/login/CustomServerDialog.js +++ b/src/components/views/login/CustomServerDialog.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/login/LoginFooter.js b/src/components/views/login/LoginFooter.js index d486b3597e..5ec57194e0 100644 --- a/src/components/views/login/LoginFooter.js +++ b/src/components/views/login/LoginFooter.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/login/LoginHeader.js b/src/components/views/login/LoginHeader.js index c64016413b..3ee3cbea2e 100644 --- a/src/components/views/login/LoginHeader.js +++ b/src/components/views/login/LoginHeader.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/login/PasswordLogin.js b/src/components/views/login/PasswordLogin.js index baaf3236d6..3367ac3257 100644 --- a/src/components/views/login/PasswordLogin.js +++ b/src/components/views/login/PasswordLogin.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/login/RegistrationForm.js b/src/components/views/login/RegistrationForm.js index 5c4887955b..bc461dd1bb 100644 --- a/src/components/views/login/RegistrationForm.js +++ b/src/components/views/login/RegistrationForm.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/login/ServerConfig.js b/src/components/views/login/ServerConfig.js index 54430c7520..741f0ebc69 100644 --- a/src/components/views/login/ServerConfig.js +++ b/src/components/views/login/ServerConfig.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/messages/MFileBody.js b/src/components/views/messages/MFileBody.js index 193cafe255..2f416daf95 100644 --- a/src/components/views/messages/MFileBody.js +++ b/src/components/views/messages/MFileBody.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,6 +19,8 @@ limitations under the License. var React = require('react'); var filesize = require('filesize'); var MatrixClientPeg = require('../../../MatrixClientPeg'); +var sdk = require('../../../index'); +var dis = require("../../../dispatcher"); module.exports = React.createClass({ displayName: 'MFileBody', @@ -52,12 +54,14 @@ module.exports = React.createClass({ var httpUrl = cli.mxcUrlToHttp(content.url); var text = this.presentableTextForFile(content); + var TintableSvg = sdk.getComponent("elements.TintableSvg"); + if (httpUrl) { return ( diff --git a/src/components/views/messages/MImageBody.js b/src/components/views/messages/MImageBody.js index 6afdddc307..691380d678 100644 --- a/src/components/views/messages/MImageBody.js +++ b/src/components/views/messages/MImageBody.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ var filesize = require('filesize'); var MatrixClientPeg = require('../../../MatrixClientPeg'); var Modal = require('../../../Modal'); var sdk = require('../../../index'); +var dis = require("../../../dispatcher"); module.exports = React.createClass({ displayName: 'MImageBody', @@ -97,6 +98,7 @@ module.exports = React.createClass({ }, render: function() { + var TintableSvg = sdk.getComponent("elements.TintableSvg"); var content = this.props.mxEvent.getContent(); var cli = MatrixClientPeg.get(); @@ -118,7 +120,7 @@ module.exports = React.createClass({ diff --git a/src/components/views/messages/MVideoBody.js b/src/components/views/messages/MVideoBody.js index ddd3dceca7..cacdf11316 100644 --- a/src/components/views/messages/MVideoBody.js +++ b/src/components/views/messages/MVideoBody.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/messages/MessageEvent.js b/src/components/views/messages/MessageEvent.js index 63e77e9652..2490d9be8b 100644 --- a/src/components/views/messages/MessageEvent.js +++ b/src/components/views/messages/MessageEvent.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/messages/TextualBody.js b/src/components/views/messages/TextualBody.js index 0c9710f06e..fe763d06bf 100644 --- a/src/components/views/messages/TextualBody.js +++ b/src/components/views/messages/TextualBody.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/messages/TextualEvent.js b/src/components/views/messages/TextualEvent.js index a2db21cfae..f82fafa242 100644 --- a/src/components/views/messages/TextualEvent.js +++ b/src/components/views/messages/TextualEvent.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/messages/UnknownBody.js b/src/components/views/messages/UnknownBody.js index f831e08a2c..00784b18b0 100644 --- a/src/components/views/messages/UnknownBody.js +++ b/src/components/views/messages/UnknownBody.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js index 67daebccbc..cfac6cc9b2 100644 --- a/src/components/views/rooms/EventTile.js +++ b/src/components/views/rooms/EventTile.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/rooms/MemberInfo.js b/src/components/views/rooms/MemberInfo.js index bf17195664..b5f0b88b40 100644 --- a/src/components/views/rooms/MemberInfo.js +++ b/src/components/views/rooms/MemberInfo.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/rooms/MemberList.js b/src/components/views/rooms/MemberList.js index 719e4af9b3..b0e2baa3d3 100644 --- a/src/components/views/rooms/MemberList.js +++ b/src/components/views/rooms/MemberList.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/rooms/MemberTile.js b/src/components/views/rooms/MemberTile.js index 38d9285c0c..32cc619f13 100644 --- a/src/components/views/rooms/MemberTile.js +++ b/src/components/views/rooms/MemberTile.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/rooms/MessageComposer.js b/src/components/views/rooms/MessageComposer.js index 5ac4a24908..083cee46a2 100644 --- a/src/components/views/rooms/MessageComposer.js +++ b/src/components/views/rooms/MessageComposer.js @@ -1,5 +1,5 @@ /* -Copyright 2015 OpenMarket Ltd +Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -461,6 +461,7 @@ module.exports = React.createClass({ var me = this.props.room.getMember(MatrixClientPeg.get().credentials.userId); var uploadInputStyle = {display: 'none'}; var MemberAvatar = sdk.getComponent('avatars.MemberAvatar'); + var TintableSvg = sdk.getComponent("elements.TintableSvg"); var callButton, videoCallButton, hangupButton; var call = CallHandler.getCallForRoom(this.props.room.roomId); @@ -473,12 +474,12 @@ module.exports = React.createClass({ } else { callButton = -
    - Voice call +
    +
    videoCallButton = -
    - Video call +
    +
    } @@ -492,8 +493,8 @@ module.exports = React.createClass({