From 962a2def189a04875cd6775e22c53e10bf30f63c Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Tue, 22 Oct 2024 11:49:44 -0700 Subject: [PATCH] Re-enable link-and-sync in Alpha --- ts/state/ducks/installer.ts | 2 +- ts/textsecure/Provisioner.ts | 7 +++++-- ts/util/isLinkAndSyncEnabled.ts | 5 +++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ts/state/ducks/installer.ts b/ts/state/ducks/installer.ts index 8f56ec09c..0d4f170ff 100644 --- a/ts/state/ducks/installer.ts +++ b/ts/state/ducks/installer.ts @@ -196,7 +196,7 @@ function startInstaller(): ThunkAction< const { server } = window.textsecure; strictAssert(server, 'Expected a server'); - const provisioner = new Provisioner(server); + const provisioner = new Provisioner(server, window.getVersion()); const abortController = new AbortController(); const { signal } = abortController; diff --git a/ts/textsecure/Provisioner.ts b/ts/textsecure/Provisioner.ts index 675cf870a..1b462dd04 100644 --- a/ts/textsecure/Provisioner.ts +++ b/ts/textsecure/Provisioner.ts @@ -78,7 +78,10 @@ export class Provisioner { private state: StateType = { step: Step.Idle }; private wsr: IWebSocketResource | undefined; - constructor(private readonly server: WebAPIType) {} + constructor( + private readonly server: WebAPIType, + private readonly appVersion: string + ) {} public close(error = new Error('Provisioner closed')): void { try { @@ -242,7 +245,7 @@ export class Provisioner { .toAppUrl({ uuid, pubKey: Bytes.toBase64(pubKey), - capabilities: isLinkAndSyncEnabled() ? ['backup'] : [], + capabilities: isLinkAndSyncEnabled(this.appVersion) ? ['backup'] : [], }) .toString(); diff --git a/ts/util/isLinkAndSyncEnabled.ts b/ts/util/isLinkAndSyncEnabled.ts index e02fd4387..a7fbe6472 100644 --- a/ts/util/isLinkAndSyncEnabled.ts +++ b/ts/util/isLinkAndSyncEnabled.ts @@ -3,13 +3,14 @@ import { isTestOrMockEnvironment } from '../environment'; import { isStagingServer } from './isStagingServer'; +import { isAlpha } from './version'; import { everDone as wasRegistrationEverDone } from './registration'; -export function isLinkAndSyncEnabled(): boolean { +export function isLinkAndSyncEnabled(version: string): boolean { // Cannot overwrite existing message history if (wasRegistrationEverDone()) { return false; } - return isStagingServer() || isTestOrMockEnvironment(); + return isStagingServer() || isTestOrMockEnvironment() || isAlpha(version); }