@@ -574,6 +576,10 @@ export class SettingsView extends React.Component
{
private getLinkedDeviceSettings(): Array {
const { linkedPubKeys } = this.state;
+ const { isSecondaryDevice } = this.props;
+ const noPairedDeviceText = isSecondaryDevice
+ ? window.i18n('deviceIsSecondaryNoPairing')
+ : window.i18n('noPairedDevices');
if (linkedPubKeys && linkedPubKeys.length > 0) {
return linkedPubKeys.map((pubkey: any) => {
@@ -621,7 +627,7 @@ export class SettingsView extends React.Component {
return [
{
id: 'no-linked-device',
- title: window.i18n('noPairedDevices'),
+ title: noPairedDeviceText,
type: undefined,
description: '',
category: SessionSettingCategory.Devices,
diff --git a/ts/components/session/settings/SessionSettingsHeader.tsx b/ts/components/session/settings/SessionSettingsHeader.tsx
index b5dc93df0..2c14e0dbf 100644
--- a/ts/components/session/settings/SessionSettingsHeader.tsx
+++ b/ts/components/session/settings/SessionSettingsHeader.tsx
@@ -5,20 +5,23 @@ import { SessionSettingCategory, SettingsViewProps } from './SessionSettings';
import { SessionButton } from '../SessionButton';
interface Props extends SettingsViewProps {
+ // showLinkDeviceButton is used to completely hide the button while the settings password lock is displayed
showLinkDeviceButton: boolean | null;
- disableLinkDeviceButton: boolean | null;
+ // isSecondaryDevice is used to just disable the linkDeviceButton when we are already a secondary device
+ isSecondaryDevice: boolean;
}
export class SettingsHeader extends React.Component {
public static defaultProps = {
showLinkDeviceButton: false,
- disableLinkDeviceButton: true,
};
public constructor(props: any) {
super(props);
+ // mark the linkDeviceButton as disabled by default.
+ // it will be enabled if needed during componentDidMount().
this.state = {
- disableLinkDeviceButton: this.props.disableLinkDeviceButton,
+ disableLinkDeviceButton: true,
};
this.showAddLinkedDeviceModal = this.showAddLinkedDeviceModal.bind(this);
}
@@ -32,10 +35,12 @@ export class SettingsHeader extends React.Component {
}
public componentDidMount() {
- window.Whisper.events.on('refreshLinkedDeviceList', async () => {
+ if (!this.props.isSecondaryDevice) {
+ window.Whisper.events.on('refreshLinkedDeviceList', async () => {
+ this.refreshLinkedDevice();
+ });
this.refreshLinkedDevice();
- });
- this.refreshLinkedDevice();
+ }
}
public refreshLinkedDevice() {
@@ -51,7 +56,9 @@ export class SettingsHeader extends React.Component {
}
public componentWillUnmount() {
- window.Whisper.events.off('refreshLinkedDeviceList');
+ if (!this.props.isSecondaryDevice) {
+ window.Whisper.events.off('refreshLinkedDeviceList');
+ }
}
public render() {