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 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "tinode-webapp", "name": "tinode-webapp",
"description": "Tinode messenger for the web", "description": "Tinode messenger for the web",
"version": "0.16.4", "version": "0.16.5-beta5",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/tinode/example-react-js.git" "url": "https://github.com/tinode/example-react-js.git"
+1
View File
@@ -11,6 +11,7 @@
"label_message_sound": "Message sound:", "label_message_sound": "Message sound:",
"label_push_notifications": "Notification alerts:", "label_push_notifications": "Notification alerts:",
"label_push_notifications_disabled": "Notification alerts (requires HTTPS):", "label_push_notifications_disabled": "Notification alerts (requires HTTPS):",
"label_incognito_mode": "Incognito mode:",
"title_tag_manager": "Tags (user discovery)", "title_tag_manager": "Tags (user discovery)",
"label_user_contacts": "Contacts:", "label_user_contacts": "Contacts:",
"label_user_id": "Address:", "label_user_id": "Address:",
+2 -1
View File
@@ -152,5 +152,6 @@
"topic_block_warning": "Вы действительно хотите заблокировать этот чат?", "topic_block_warning": "Вы действительно хотите заблокировать этот чат?",
"search_no_results": "Ничего не найдено", "search_no_results": "Ничего не найдено",
"deleted_content": "удалено", "deleted_content": "удалено",
"image_caption_prompt": "Подпись к фото" "image_caption_prompt": "Подпись к фото",
"label_incognito_mode": "Режим инкогнито:"
} }
+2 -1
View File
@@ -152,5 +152,6 @@
"search_no_results": "搜索返回任何结果", "search_no_results": "搜索返回任何结果",
"deleted_content": "内容已删除", "deleted_content": "内容已删除",
"image_caption_prompt": "图片标题", "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_message_sound": "Message sound:",
"label_push_notifications": "Notification alerts:", "label_push_notifications": "Notification alerts:",
"label_push_notifications_disabled": "Notification alerts (requires HTTPS):", "label_push_notifications_disabled": "Notification alerts (requires HTTPS):",
"label_incognito_mode": "Incognito mode:",
"title_tag_manager": "Tags (user discovery)", "title_tag_manager": "Tags (user discovery)",
"label_user_contacts": "Contacts:", "label_user_contacts": "Contacts:",
"label_user_id": "Address:", "label_user_id": "Address:",
@@ -309,7 +310,8 @@
"topic_block_warning": "Вы действительно хотите заблокировать этот чат?", "topic_block_warning": "Вы действительно хотите заблокировать этот чат?",
"search_no_results": "Ничего не найдено", "search_no_results": "Ничего не найдено",
"deleted_content": "удалено", "deleted_content": "удалено",
"image_caption_prompt": "Подпись к фото" "image_caption_prompt": "Подпись к фото",
"label_incognito_mode": "Режим инкогнито:"
}, },
"zh": { "zh": {
"archived_contacts": "已归档联系人 ({count})", "archived_contacts": "已归档联系人 ({count})",
@@ -465,6 +467,7 @@
"search_no_results": "搜索返回任何结果", "search_no_results": "搜索返回任何结果",
"deleted_content": "内容已删除", "deleted_content": "内容已删除",
"image_caption_prompt": "图片标题", "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. // 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); this.props.onToggleMessageSounds(checked);
} else if (what == 'alert') { } else if (what == 'alert') {
this.props.onTogglePushNotifications(checked); 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" /> description="Label for message sounds toggle" />
</label> </label>
<CheckBox name="sound" id="message-sound" <CheckBox name="sound" id="message-sound"
checked={this.props.messageSounds} checked={this.props.messageSounds} onChange={this.handleCheckboxClick} />
onChange={this.handleCheckboxClick} />
</div> </div>
<div className="panel-form-row"> <div className="panel-form-row">
<label htmlFor="desktop-alerts"> <label htmlFor="desktop-alerts">
@@ -243,6 +244,14 @@ export default class EditAccountView extends React.Component {
checked={this.props.desktopAlerts} checked={this.props.desktopAlerts}
onChange={this.props.desktopAlertsEnabled ? this.handleCheckboxClick : null} /> onChange={this.props.desktopAlertsEnabled ? this.handleCheckboxClick : null} />
</div> </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" /> <div className="hr" />
<FormattedMessage id="title_tag_manager" defaultMessage="Tags (user discovery)" <FormattedMessage id="title_tag_manager" defaultMessage="Tags (user discovery)"
description="Section title for TagManager">{ description="Section title for TagManager">{
+2
View File
@@ -134,10 +134,12 @@ class SidepanelView extends React.Component {
messageSounds={this.props.messageSounds} messageSounds={this.props.messageSounds}
desktopAlerts={this.props.desktopAlerts} desktopAlerts={this.props.desktopAlerts}
desktopAlertsEnabled={this.props.desktopAlertsEnabled} desktopAlertsEnabled={this.props.desktopAlertsEnabled}
incognitoMode={this.props.incognitoMode}
onUpdateAccount={this.props.onUpdateAccount} onUpdateAccount={this.props.onUpdateAccount}
onUpdateTags={this.props.onUpdateAccountTags} onUpdateTags={this.props.onUpdateAccountTags}
onTogglePushNotifications={this.props.onTogglePushNotifications} onTogglePushNotifications={this.props.onTogglePushNotifications}
onToggleMessageSounds={this.props.onToggleMessageSounds} onToggleMessageSounds={this.props.onToggleMessageSounds}
onToggleIncognitoMode={this.props.onToggleIncognitoMode}
onCredAdd={this.props.onCredAdd} onCredAdd={this.props.onCredAdd}
onCredDelete={this.props.onCredDelete} onCredDelete={this.props.onCredDelete}
onCredConfirm={this.props.onCredConfirm} onCredConfirm={this.props.onCredConfirm}
+24 -5
View File
@@ -80,6 +80,7 @@ class TinodeWeb extends React.Component {
this.handleNewAccountRequest = this.handleNewAccountRequest.bind(this); this.handleNewAccountRequest = this.handleNewAccountRequest.bind(this);
this.handleUpdateAccountRequest = this.handleUpdateAccountRequest.bind(this); this.handleUpdateAccountRequest = this.handleUpdateAccountRequest.bind(this);
this.handleUpdateAccountTagsRequest = this.handleUpdateAccountTagsRequest.bind(this); this.handleUpdateAccountTagsRequest = this.handleUpdateAccountTagsRequest.bind(this);
this.handleToggleIncognitoMode = this.handleToggleIncognitoMode.bind(this);
this.handleSettings = this.handleSettings.bind(this); this.handleSettings = this.handleSettings.bind(this);
this.handleGlobalSettings = this.handleGlobalSettings.bind(this); this.handleGlobalSettings = this.handleGlobalSettings.bind(this);
this.handleShowArchive = this.handleShowArchive.bind(this); this.handleShowArchive = this.handleShowArchive.bind(this);
@@ -129,6 +130,7 @@ class TinodeWeb extends React.Component {
serverVersion: "no connection", serverVersion: "no connection",
// "On" is the default, so saving the "off" state. // "On" is the default, so saving the "off" state.
messageSounds: !settings.messageSoundsOff, messageSounds: !settings.messageSoundsOff,
incognitoMode: false,
desktopAlerts: settings.desktopAlerts, desktopAlerts: settings.desktopAlerts,
desktopAlertsEnabled: (isSecureConnection() || isLocalHost()) && desktopAlertsEnabled: (isSecureConnection() || isLocalHost()) &&
(typeof firebase != 'undefined') && (typeof navigator != 'undefined') && (typeof firebase != 'undefined') && (typeof navigator != 'undefined') &&
@@ -530,11 +532,18 @@ class TinodeWeb extends React.Component {
} }
tnMeMetaDesc(desc) { tnMeMetaDesc(desc) {
if (desc && desc.public) { if (desc) {
this.setState({ if (desc.public) {
sidePanelTitle: desc.public.fn, this.setState({
sidePanelAvatar: makeImageUrl(desc.public.photo) 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) { handleUpdateAccountTagsRequest(tags) {
this.tinode.getMeTopic().setMeta({tags: tags}) this.tinode.getMeTopic().setMeta({tags: tags})
.catch((err) => { .catch((err) => {
@@ -1377,6 +1394,7 @@ class TinodeWeb extends React.Component {
messageSounds={this.state.messageSounds} messageSounds={this.state.messageSounds}
desktopAlerts={this.state.desktopAlerts} desktopAlerts={this.state.desktopAlerts}
desktopAlertsEnabled={this.state.desktopAlertsEnabled} desktopAlertsEnabled={this.state.desktopAlertsEnabled}
incognitoMode={this.state.incognitoMode}
serverAddress={this.state.serverAddress} serverAddress={this.state.serverAddress}
onGlobalSettings={this.handleGlobalSettings} onGlobalSettings={this.handleGlobalSettings}
@@ -1388,6 +1406,7 @@ class TinodeWeb extends React.Component {
onUpdateAccountTags={this.handleUpdateAccountTagsRequest} onUpdateAccountTags={this.handleUpdateAccountTagsRequest}
onTogglePushNotifications={this.togglePushToken} onTogglePushNotifications={this.togglePushToken}
onToggleMessageSounds={this.handleToggleMessageSounds} onToggleMessageSounds={this.handleToggleMessageSounds}
onToggleIncognitoMode={this.handleToggleIncognitoMode}
onCredAdd={this.handleCredAdd} onCredAdd={this.handleCredAdd}
onCredDelete={this.handleCredDelete} onCredDelete={this.handleCredDelete}
onCredConfirm={this.handleCredConfirm} onCredConfirm={this.handleCredConfirm}
+48 -7
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+11 -7
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long