|
| 1 | +/* |
| 2 | +Copyright 2015 OpenMarket Ltd |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +'use strict'; |
| 18 | + |
| 19 | +var dis = require("../../../dispatcher"); |
| 20 | + |
| 21 | +module.exports = { |
| 22 | + |
| 23 | + componentDidMount: function() { |
| 24 | + this.dispatcherRef = dis.register(this.onAction); |
| 25 | + }, |
| 26 | + |
| 27 | + componentWillUnmount: function() { |
| 28 | + dis.unregister(this.dispatcherRef); |
| 29 | + }, |
| 30 | + |
| 31 | + onAction: function(payload) { |
| 32 | + // if we were given a room_id to track, don't handle anything else. |
| 33 | + if (payload.room_id && this.props.room && |
| 34 | + this.props.room.roomId !== payload.room_id) { |
| 35 | + return; |
| 36 | + } |
| 37 | + |
| 38 | + switch (payload.action) { |
| 39 | + case 'place_call': |
| 40 | + console.log("Place %s call in %s", payload.type, payload.room_id); |
| 41 | + break; |
| 42 | + case 'incoming_call': |
| 43 | + console.log("Incoming call: %s", payload.call); |
| 44 | + break; |
| 45 | + } |
| 46 | + } |
| 47 | +}; |
| 48 | + |
0 commit comments