2016-06-08 12:13:41 +00:00
|
|
|
/*
|
|
|
|
Copyright 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.
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
2016-09-04 13:01:19 +00:00
|
|
|
import React from 'react';
|
2016-09-15 00:55:51 +00:00
|
|
|
import sdk from '../../../index';
|
2017-06-02 09:18:31 +00:00
|
|
|
import { _t } from '../../../languageHandler';
|
2016-06-08 12:13:41 +00:00
|
|
|
|
2016-09-04 13:01:19 +00:00
|
|
|
export default class MemberDeviceInfo extends React.Component {
|
|
|
|
render() {
|
2016-09-22 18:23:34 +00:00
|
|
|
var indicator = null;
|
|
|
|
var DeviceVerifyButtons = sdk.getComponent('elements.DeviceVerifyButtons');
|
2016-09-15 01:44:55 +00:00
|
|
|
|
2016-09-04 20:49:32 +00:00
|
|
|
if (this.props.device.isBlocked()) {
|
2016-09-22 18:23:34 +00:00
|
|
|
indicator = (
|
2016-11-29 18:25:26 +00:00
|
|
|
<div className="mx_MemberDeviceInfo_blacklisted">
|
2017-06-08 13:08:51 +00:00
|
|
|
<img src="img/e2e-blocked.svg" width="12" height="12" style={{ marginLeft: "-1px" }} alt={_t("Blacklisted")}/>
|
2016-09-15 01:44:55 +00:00
|
|
|
</div>
|
2016-09-22 18:23:34 +00:00
|
|
|
);
|
|
|
|
} else if (this.props.device.isVerified()) {
|
|
|
|
indicator = (
|
2016-09-15 01:44:55 +00:00
|
|
|
<div className="mx_MemberDeviceInfo_verified">
|
2017-06-08 13:08:51 +00:00
|
|
|
<img src="img/e2e-verified.svg" width="10" height="12" alt={_t("Verified")}/>
|
2016-09-15 01:44:55 +00:00
|
|
|
</div>
|
2016-09-22 18:23:34 +00:00
|
|
|
);
|
|
|
|
} else {
|
|
|
|
indicator = (
|
2016-09-15 01:44:55 +00:00
|
|
|
<div className="mx_MemberDeviceInfo_unverified">
|
2017-06-08 13:08:51 +00:00
|
|
|
<img src="img/e2e-warning.svg" width="15" height="12" style={{ marginLeft: "-2px" }} alt={_t("Unverified")}/>
|
2016-09-15 01:44:55 +00:00
|
|
|
</div>
|
2016-09-12 22:42:24 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2016-09-22 18:23:34 +00:00
|
|
|
var deviceName = this.props.device.ambiguous ?
|
|
|
|
(this.props.device.getDisplayName() ? this.props.device.getDisplayName() : "") + " (" + this.props.device.deviceId + ")" :
|
|
|
|
this.props.device.getDisplayName();
|
|
|
|
|
2016-09-22 18:28:50 +00:00
|
|
|
// add the deviceId as a titletext to help with debugging
|
2016-06-08 12:13:41 +00:00
|
|
|
return (
|
2016-09-22 18:28:50 +00:00
|
|
|
<div className="mx_MemberDeviceInfo"
|
2017-06-02 09:18:31 +00:00
|
|
|
title={_t("device id: ") + this.props.device.deviceId} >
|
2016-09-22 18:23:34 +00:00
|
|
|
<div className="mx_MemberDeviceInfo_deviceInfo">
|
|
|
|
<div className="mx_MemberDeviceInfo_deviceId">
|
|
|
|
{deviceName}
|
|
|
|
{indicator}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<DeviceVerifyButtons userId={this.props.userId} device={this.props.device} />
|
2016-06-08 12:13:41 +00:00
|
|
|
</div>
|
|
|
|
);
|
2016-09-04 13:01:19 +00:00
|
|
|
}
|
2017-01-20 14:22:27 +00:00
|
|
|
}
|
2016-09-04 13:01:19 +00:00
|
|
|
|
|
|
|
MemberDeviceInfo.displayName = 'MemberDeviceInfo';
|
|
|
|
MemberDeviceInfo.propTypes = {
|
|
|
|
userId: React.PropTypes.string.isRequired,
|
|
|
|
device: React.PropTypes.object.isRequired,
|
|
|
|
};
|