support for incognito mode

This commit is contained in:
or-else
2020-04-01 21:13:32 +03:00
parent 6222610836
commit cdd40facec
15 changed files with 112 additions and 31 deletions
+1
View File
@@ -11,6 +11,7 @@
"label_message_sound": "Message sound:",
"label_push_notifications": "Notification alerts:",
"label_push_notifications_disabled": "Notification alerts (requires HTTPS):",
"label_incognito_mode": "Incognito mode:",
"title_tag_manager": "Tags (user discovery)",
"label_user_contacts": "Contacts:",
"label_user_id": "Address:",
+2 -1
View File
@@ -152,5 +152,6 @@
"topic_block_warning": "Вы действительно хотите заблокировать этот чат?",
"search_no_results": "Ничего не найдено",
"deleted_content": "удалено",
"image_caption_prompt": "Подпись к фото"
"image_caption_prompt": "Подпись к фото",
"label_incognito_mode": "Режим инкогнито:"
}
+2 -1
View File
@@ -152,5 +152,6 @@
"search_no_results": "搜索返回任何结果",
"deleted_content": "内容已删除",
"image_caption_prompt": "图片标题",
"menu_item_send_retry": "重试"
"menu_item_send_retry": "重试",
"label_incognito_mode": "无痕模式:"
}
+5 -2
View File
@@ -12,6 +12,7 @@
"label_message_sound": "Message sound:",
"label_push_notifications": "Notification alerts:",
"label_push_notifications_disabled": "Notification alerts (requires HTTPS):",
"label_incognito_mode": "Incognito mode:",
"title_tag_manager": "Tags (user discovery)",
"label_user_contacts": "Contacts:",
"label_user_id": "Address:",
@@ -309,7 +310,8 @@
"topic_block_warning": "Вы действительно хотите заблокировать этот чат?",
"search_no_results": "Ничего не найдено",
"deleted_content": "удалено",
"image_caption_prompt": "Подпись к фото"
"image_caption_prompt": "Подпись к фото",
"label_incognito_mode": "Режим инкогнито:"
},
"zh": {
"archived_contacts": "已归档联系人 ({count})",
@@ -465,6 +467,7 @@
"search_no_results": "搜索返回任何结果",
"deleted_content": "内容已删除",
"image_caption_prompt": "图片标题",
"menu_item_send_retry": "重试"
"menu_item_send_retry": "重试",
"label_incognito_mode": "无痕模式:"
}
}
+1 -1
View File
@@ -1,3 +1,3 @@
// This is a generated file. Don't edit.
export const PACKAGE_VERSION = "0.16.4";
export const PACKAGE_VERSION = "0.16.5-beta5";
+11 -2
View File
@@ -92,6 +92,8 @@ export default class EditAccountView extends React.Component {
this.props.onToggleMessageSounds(checked);
} else if (what == 'alert') {
this.props.onTogglePushNotifications(checked);
} else if (what == 'incognito') {
this.props.onToggleIncognitoMode(checked);
}
}
@@ -225,8 +227,7 @@ export default class EditAccountView extends React.Component {
description="Label for message sounds toggle" />
</label>
<CheckBox name="sound" id="message-sound"
checked={this.props.messageSounds}
onChange={this.handleCheckboxClick} />
checked={this.props.messageSounds} onChange={this.handleCheckboxClick} />
</div>
<div className="panel-form-row">
<label htmlFor="desktop-alerts">
@@ -243,6 +244,14 @@ export default class EditAccountView extends React.Component {
checked={this.props.desktopAlerts}
onChange={this.props.desktopAlertsEnabled ? this.handleCheckboxClick : null} />
</div>
<div className="panel-form-row">
<label htmlFor="incognito-mode">
<FormattedMessage id="label_incognito_mode" defaultMessage="Incognito mode:"
description="Label for incognito mode toggle" />
</label>
<CheckBox name="incognito" id="incognito-mode"
checked={this.props.incognitoMode} onChange={this.handleCheckboxClick} />
</div>
<div className="hr" />
<FormattedMessage id="title_tag_manager" defaultMessage="Tags (user discovery)"
description="Section title for TagManager">{
+2
View File
@@ -134,10 +134,12 @@ class SidepanelView extends React.Component {
messageSounds={this.props.messageSounds}
desktopAlerts={this.props.desktopAlerts}
desktopAlertsEnabled={this.props.desktopAlertsEnabled}
incognitoMode={this.props.incognitoMode}
onUpdateAccount={this.props.onUpdateAccount}
onUpdateTags={this.props.onUpdateAccountTags}
onTogglePushNotifications={this.props.onTogglePushNotifications}
onToggleMessageSounds={this.props.onToggleMessageSounds}
onToggleIncognitoMode={this.props.onToggleIncognitoMode}
onCredAdd={this.props.onCredAdd}
onCredDelete={this.props.onCredDelete}
onCredConfirm={this.props.onCredConfirm}
+24 -5
View File
@@ -80,6 +80,7 @@ class TinodeWeb extends React.Component {
this.handleNewAccountRequest = this.handleNewAccountRequest.bind(this);
this.handleUpdateAccountRequest = this.handleUpdateAccountRequest.bind(this);
this.handleUpdateAccountTagsRequest = this.handleUpdateAccountTagsRequest.bind(this);
this.handleToggleIncognitoMode = this.handleToggleIncognitoMode.bind(this);
this.handleSettings = this.handleSettings.bind(this);
this.handleGlobalSettings = this.handleGlobalSettings.bind(this);
this.handleShowArchive = this.handleShowArchive.bind(this);
@@ -129,6 +130,7 @@ class TinodeWeb extends React.Component {
serverVersion: "no connection",
// "On" is the default, so saving the "off" state.
messageSounds: !settings.messageSoundsOff,
incognitoMode: false,
desktopAlerts: settings.desktopAlerts,
desktopAlertsEnabled: (isSecureConnection() || isLocalHost()) &&
(typeof firebase != 'undefined') && (typeof navigator != 'undefined') &&
@@ -530,11 +532,18 @@ class TinodeWeb extends React.Component {
}
tnMeMetaDesc(desc) {
if (desc && desc.public) {
this.setState({
sidePanelTitle: desc.public.fn,
sidePanelAvatar: makeImageUrl(desc.public.photo)
});
if (desc) {
if (desc.public) {
this.setState({
sidePanelTitle: desc.public.fn,
sidePanelAvatar: makeImageUrl(desc.public.photo)
});
}
if (desc.acs) {
this.setState({
incognitoMode: !desc.acs.isPresencer()
});
}
}
}
@@ -859,6 +868,14 @@ class TinodeWeb extends React.Component {
}
}
handleToggleIncognitoMode(on) {
const me = this.tinode.getMeTopic();
const am = me.getAccessMode().updateWant(on ? '-P' : '+P').getWant();
me.setMeta({sub: {mode: am}}).catch((err) => {
this.handleError(err.message, 'err');
});
}
handleUpdateAccountTagsRequest(tags) {
this.tinode.getMeTopic().setMeta({tags: tags})
.catch((err) => {
@@ -1377,6 +1394,7 @@ class TinodeWeb extends React.Component {
messageSounds={this.state.messageSounds}
desktopAlerts={this.state.desktopAlerts}
desktopAlertsEnabled={this.state.desktopAlertsEnabled}
incognitoMode={this.state.incognitoMode}
serverAddress={this.state.serverAddress}
onGlobalSettings={this.handleGlobalSettings}
@@ -1388,6 +1406,7 @@ class TinodeWeb extends React.Component {
onUpdateAccountTags={this.handleUpdateAccountTagsRequest}
onTogglePushNotifications={this.togglePushToken}
onToggleMessageSounds={this.handleToggleMessageSounds}
onToggleIncognitoMode={this.handleToggleIncognitoMode}
onCredAdd={this.handleCredAdd}
onCredDelete={this.handleCredDelete}
onCredConfirm={this.handleCredConfirm}