Merge pull request #1288 from Bilb/disable-link-warning-multi

pull/1296/head
Audric Ackermann 5 years ago committed by GitHub
commit 2c45ff73b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1302,6 +1302,22 @@
"message": "Typing Indicators", "message": "Typing Indicators",
"description": "Title of the typing indicators setting" "description": "Title of the typing indicators setting"
}, },
"multiDeviceDisabledTemporary": {
"message": "MultiDevice disabled temporarily",
"description": "Description of why multi device is disabled"
},
"multiDeviceDisabledTemporaryTitle": {
"message": "Changes to Multi-device",
"description": "Description of why multi device is disabled on app start"
},
"multiDeviceDisabledTemporaryDescriptionPrimary": {
"message": "Youre seeing this because you have a secondary device linked to your Session ID. To improve reliability and stability, weve decided to temporarily disable Sessions multi-device functionality. Device linking has been disabled, and existing secondary clients will be erased on <span style=\"color:#00f782\">August 6th</span>.</br></br>To read more about this change, visit the Session FAQ at <a href=\"https://getsession.org/faq\">getsession.org/faq</a>.",
"description": "Description of why multi device is disabled on app start for a primary device"
},
"multiDeviceDisabledTemporaryDescriptionSecondary": {
"message": "Youre seeing this because this is a secondary device in a multi-device setup. To improve reliability and stability, weve decided to temporarily disable Sessions multi-device functionality. Device linking has been disabled, and existing secondary clients will be erased on <span style=\"color:#00f782\">August 6th</span>.</br></br>To read more about this change, visit the Session FAQ at <a href=\"https://getsession.org/faq\">getsession.org/faq</a>.",
"description": "Description of why multi device is disabled on app start for a secondary device"
},
"messageTTL": { "messageTTL": {
"message": "Message TTL", "message": "Message TTL",
"description": "Title of the Message TTL setting" "description": "Title of the Message TTL setting"

@ -90,12 +90,21 @@
type: 'success', type: 'success',
}); });
}, },
showConfirmationDialog({ title, message, onOk, onCancel }) { showConfirmationDialog({
title,
message,
messageSub,
onOk,
onCancel,
hideCancel,
}) {
window.confirmationDialog({ window.confirmationDialog({
title, title,
message, message,
resolve: onOk, resolve: onOk,
reject: onCancel, reject: onCancel,
hideCancel,
messageSub,
}); });
}, },
}); });

@ -242,7 +242,7 @@ body.dark-theme {
} }
a { a {
color: $blue; color: $session-color-green;
} }
.file-input { .file-input {
@ -410,7 +410,7 @@ body.dark-theme {
} }
} }
a.link { a.link {
color: #2090ea; color: $session-color-green;
} }
.progress { .progress {

@ -2,6 +2,9 @@ import React from 'react';
import { SessionIconButton, SessionIconSize, SessionIconType } from './icon'; import { SessionIconButton, SessionIconSize, SessionIconType } from './icon';
import { Avatar } from '../Avatar'; import { Avatar } from '../Avatar';
import { PropsData as ConversationListItemPropsType } from '../ConversationListItem'; import { PropsData as ConversationListItemPropsType } from '../ConversationListItem';
import { MultiDeviceProtocol } from '../../session/protocols';
import { UserUtil } from '../../util';
import { createOrUpdateItem, getItemById } from '../../../js/modules/data';
export enum SectionType { export enum SectionType {
Profile, Profile,
@ -56,6 +59,48 @@ export class ActionsPanel extends React.Component<Props, State> {
}, },
'refreshAvatarCallback' 'refreshAvatarCallback'
); );
setTimeout(async () => {
const disabledMultiDeviceCountDb = await getItemById(
'disabledMultiDeviceCount'
);
const disabledMultiDeviceCount =
Number(disabledMultiDeviceCountDb?.value) || 0;
const data = {
id: 'disabledMultiDeviceCount',
value: String(disabledMultiDeviceCount + 1),
};
await createOrUpdateItem(data);
if (disabledMultiDeviceCount % 5 !== 0) {
return;
}
const currentDevice = await UserUtil.getCurrentDevicePubKey();
if (!currentDevice) {
return;
}
const secondaryDevices = await MultiDeviceProtocol.getSecondaryDevices(
currentDevice
);
const isSecondary =
secondaryDevices.find(s => s.key === currentDevice) ||
!!window.textsecure.storage.get('isSecondaryDevice');
const hasMultipleDevices =
(await MultiDeviceProtocol.getOurDevices()).length > 1;
const primaryWithSecondary = !isSecondary && hasMultipleDevices;
if (!primaryWithSecondary && !isSecondary) {
return;
}
const opts = {
hideCancel: true,
title: window.i18n('multiDeviceDisabledTemporaryTitle'),
message: primaryWithSecondary
? window.i18n('multiDeviceDisabledTemporaryDescriptionPrimary')
: window.i18n('multiDeviceDisabledTemporaryDescriptionSecondary'),
};
window.Whisper.events.trigger('showConfirmationDialog', opts);
}, 1000);
} }
); );
} }

@ -557,8 +557,9 @@ export class RegistrationTabs extends React.Component<{}, State> {
SessionButtonType.BrandOutline, SessionButtonType.BrandOutline,
SessionButtonColor.Green SessionButtonColor.Green
)} )}
<h4>{or}</h4> {/*<h4>{or}</h4>*/}
{this.renderLinkDeviceToExistingAccountButton()} {/* FIXME enable back to allow linking of device
this.renderLinkDeviceToExistingAccountButton() */}
</div> </div>
); );
} }
@ -583,8 +584,9 @@ export class RegistrationTabs extends React.Component<{}, State> {
return ( return (
<div> <div>
{this.renderContinueYourSessionButton()} {this.renderContinueYourSessionButton()}
<h4>{or}</h4> {/*<h4>{or}</h4>*/}
{this.renderLinkDeviceToExistingAccountButton()} {/* FIXME enable back to allow linking of device
this.renderLinkDeviceToExistingAccountButton()*/}
</div> </div>
); );
} }

@ -1,6 +1,7 @@
import React from 'react'; import React from 'react';
import { SessionModal } from './SessionModal'; import { SessionModal } from './SessionModal';
import { SessionButton, SessionButtonColor } from './SessionButton'; import { SessionButton, SessionButtonColor } from './SessionButton';
import { SessionHtmlRenderer } from './SessionHTMLRenderer';
interface Props { interface Props {
message: string; message: string;
@ -61,7 +62,11 @@ export class SessionConfirm extends React.Component<Props> {
{!showHeader && <div className="spacer-lg" />} {!showHeader && <div className="spacer-lg" />}
<div className="session-modal__centered"> <div className="session-modal__centered">
<span className={messageSubText}>{message}</span> <SessionHtmlRenderer
tag="span"
className={messageSubText}
html={message}
/>
{messageSub && ( {messageSub && (
<span className="session-confirm-sub-message subtle"> <span className="session-confirm-sub-message subtle">
{messageSub} {messageSub}

@ -5,6 +5,7 @@ interface ReceivedProps {
html: string; html: string;
tag?: string; tag?: string;
key?: any; key?: any;
className?: string;
} }
// Needed because of https://github.com/microsoft/tslint-microsoft-contrib/issues/339 // Needed because of https://github.com/microsoft/tslint-microsoft-contrib/issues/339
@ -14,14 +15,16 @@ export const SessionHtmlRenderer: React.SFC<Props> = ({
tag = 'div', tag = 'div',
key, key,
html, html,
className,
}) => { }) => {
const clean = DOMPurify.sanitize(html, { const clean = DOMPurify.sanitize(html, {
USE_PROFILES: { html: true }, USE_PROFILES: { html: true },
FORBID_ATTR: ['style', 'script'], FORBID_ATTR: ['script'],
}); });
return React.createElement(tag, { return React.createElement(tag, {
key, key,
className,
dangerouslySetInnerHTML: { __html: clean }, dangerouslySetInnerHTML: { __html: clean },
}); });
}; };

@ -644,7 +644,7 @@ export class SettingsView extends React.Component<SettingsViewProps, State> {
id: 'no-linked-device', id: 'no-linked-device',
title: noPairedDeviceText, title: noPairedDeviceText,
type: undefined, type: undefined,
description: '', description: window.i18n('multiDeviceDisabledTemporary'),
category: SessionSettingCategory.Devices, category: SessionSettingCategory.Devices,
content: {}, content: {},
comparisonValue: undefined, comparisonValue: undefined,

@ -74,9 +74,12 @@ export class SettingsHeader extends React.Component<Props, any> {
? `${categoryTitlePrefix.slice(0, -1)} Settings` ? `${categoryTitlePrefix.slice(0, -1)} Settings`
: `${categoryTitlePrefix} Settings`; : `${categoryTitlePrefix} Settings`;
const showSearch = false; const showSearch = false;
const showAddDevice = const showAddDevice = false;
/* FIXME enable back to allow linking of device
const showAddDevice =
category === SessionSettingCategory.Devices && category === SessionSettingCategory.Devices &&
this.props.showLinkDeviceButton; this.props.showLinkDeviceButton;
*/
return ( return (
<div className="session-settings-header"> <div className="session-settings-header">

Loading…
Cancel
Save