Sender Key: Prepare for testing in beta

This commit is contained in:
Scott Nonnenberg 2021-08-02 17:12:49 -07:00 committed by GitHub
parent c5de4c6284
commit ab5a12fded
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 18 deletions

View file

@ -18,7 +18,6 @@ export type ConfigKeyType =
| 'desktop.retryReceiptLifespan' | 'desktop.retryReceiptLifespan'
| 'desktop.retryRespondMaxAge' | 'desktop.retryRespondMaxAge'
| 'desktop.screensharing2' | 'desktop.screensharing2'
| 'desktop.sendSenderKey2'
| 'desktop.storage' | 'desktop.storage'
| 'desktop.storageWrite3' | 'desktop.storageWrite3'
| 'desktop.worksAtSignal' | 'desktop.worksAtSignal'

View file

@ -2312,9 +2312,7 @@ export async function startApp(): Promise<void> {
announcementGroup: true, announcementGroup: true,
'gv2-3': true, 'gv2-3': true,
'gv1-migration': true, 'gv1-migration': true,
senderKey: window.Signal.RemoteConfig.isEnabled( senderKey: true,
'desktop.sendSenderKey2'
),
}); });
} catch (error) { } catch (error) {
window.log.error( window.log.error(

View file

@ -748,10 +748,10 @@ export type CapabilitiesType = {
senderKey: boolean; senderKey: boolean;
}; };
export type CapabilitiesUploadType = { export type CapabilitiesUploadType = {
announcementGroup: boolean; announcementGroup: true;
'gv2-3': boolean; 'gv2-3': true;
'gv1-migration': boolean; 'gv1-migration': true;
senderKey: boolean; senderKey: true;
}; };
type StickerPackManifestType = any; type StickerPackManifestType = any;
@ -1478,7 +1478,7 @@ export function initialize({
announcementGroup: true, announcementGroup: true,
'gv2-3': true, 'gv2-3': true,
'gv1-migration': true, 'gv1-migration': true,
senderKey: false, senderKey: true,
}; };
const { accessKey } = options; const { accessKey } = options;

View file

@ -7,7 +7,8 @@ import {
} from '@signalapp/signal-client'; } from '@signalapp/signal-client';
import { isNumber } from 'lodash'; import { isNumber } from 'lodash';
import { assert } from './assert'; import { isBeta } from './version';
import { strictAssert } from './assert';
import { getSendOptions } from './getSendOptions'; import { getSendOptions } from './getSendOptions';
import { handleMessageSend } from './handleMessageSend'; import { handleMessageSend } from './handleMessageSend';
import { isGroupV2 } from './whatTypeOfConversation'; import { isGroupV2 } from './whatTypeOfConversation';
@ -116,13 +117,11 @@ export async function onRetryRequest(event: RetryRequestEvent): Promise<void> {
} }
function maybeShowDecryptionToast(logId: string) { function maybeShowDecryptionToast(logId: string) {
if (!RemoteConfig.isEnabled('desktop.internalUser')) { if (!isBeta(window.getVersion())) {
return; return;
} }
window.log.info( window.log.info(`onDecryptionError/${logId}: Showing decryption error toast`);
`onDecryptionError/${logId}: Showing toast for internal user`
);
window.Whisper.ToastView.show( window.Whisper.ToastView.show(
window.Whisper.DecryptionErrorToast, window.Whisper.DecryptionErrorToast,
document.getElementsByClassName('conversation-stack')[0] document.getElementsByClassName('conversation-stack')[0]
@ -434,7 +433,7 @@ async function requestResend(decryptionError: DecryptionErrorEventData) {
// We believe that it could be successfully re-sent, so we'll add a placeholder. // We believe that it could be successfully re-sent, so we'll add a placeholder.
if (contentHint === ContentHint.RESENDABLE) { if (contentHint === ContentHint.RESENDABLE) {
const { retryPlaceholders } = window.Signal.Services; const { retryPlaceholders } = window.Signal.Services;
assert(retryPlaceholders, 'requestResend: adding placeholder'); strictAssert(retryPlaceholders, 'requestResend: adding placeholder');
window.log.info(`requestResend/${logId}: Adding placeholder`); window.log.info(`requestResend/${logId}: Adding placeholder`);

View file

@ -18,7 +18,6 @@ import {
SenderCertificateMode, SenderCertificateMode,
SendLogCallbackType, SendLogCallbackType,
} from '../textsecure/OutgoingMessage'; } from '../textsecure/OutgoingMessage';
import { isEnabled } from '../RemoteConfig';
import { isOlderThan } from './timestamp'; import { isOlderThan } from './timestamp';
import { import {
@ -142,7 +141,6 @@ export async function sendContentMessageToGroup({
const ourConversation = window.ConversationController.get(ourConversationId); const ourConversation = window.ConversationController.get(ourConversationId);
if ( if (
isEnabled('desktop.sendSenderKey2') &&
ourConversation?.get('capabilities')?.senderKey && ourConversation?.get('capabilities')?.senderKey &&
isGroupV2(conversation.attributes) isGroupV2(conversation.attributes)
) { ) {

View file

@ -206,9 +206,10 @@ Whisper.TapToViewExpiredOutgoingToast = Whisper.ToastView.extend({
}); });
Whisper.DecryptionErrorToast = Whisper.ToastView.extend({ Whisper.DecryptionErrorToast = Whisper.ToastView.extend({
className: 'toast toast-clickable', className: 'toast toast-clickable decryption-error',
events: { events: {
click: 'onClick', click: 'onClick',
keydown: 'onKeyDown',
}, },
render_attributes() { render_attributes() {
return { return {
@ -218,6 +219,15 @@ Whisper.DecryptionErrorToast = Whisper.ToastView.extend({
// Note: this is the same thing as ToastView, except it's missing the setTimeout, so it // Note: this is the same thing as ToastView, except it's missing the setTimeout, so it
// will stick around until the user interacts with it. // will stick around until the user interacts with it.
render() { render() {
const toasts = document.getElementsByClassName('decryption-error');
if (toasts.length > 1) {
window.log.info(
'DecryptionErrorToast: We are second decryption error toast. Closing.'
);
this.close();
return;
}
this.$el.html( this.$el.html(
window.Mustache.render( window.Mustache.render(
window._.result(this, 'template', ''), window._.result(this, 'template', ''),
@ -226,11 +236,23 @@ Whisper.DecryptionErrorToast = Whisper.ToastView.extend({
); );
this.$el.attr('tabIndex', 0); this.$el.attr('tabIndex', 0);
this.$el.show(); this.$el.show();
if (window.getInteractionMode() === 'keyboard') {
setTimeout(() => {
this.$el.focus();
}, 1);
}
}, },
onClick() { onClick() {
this.close(); this.close();
window.showDebugLog(); window.showDebugLog();
}, },
onKeyDown(event: KeyboardEvent) {
if (event.key !== 'Enter' && event.key !== ' ') {
return;
}
this.onClick();
},
}); });
Whisper.FileSavedToast = Whisper.ToastView.extend({ Whisper.FileSavedToast = Whisper.ToastView.extend({