@@ -82,7 +82,7 @@ export const RegistrationStages = () => {
-
+
= [];
+
export const getSwarmPollingInstance = () => {
if (!instance) {
instance = new SwarmPolling();
@@ -96,9 +98,11 @@ export class SwarmPolling {
if (waitForFirstPoll) {
await this.pollForAllKeys();
} else {
- setTimeout(() => {
- void this.pollForAllKeys();
- }, 4000);
+ timeouts.push(
+ setTimeout(() => {
+ void this.pollForAllKeys();
+ }, 4000)
+ );
}
}
@@ -110,6 +114,15 @@ export class SwarmPolling {
this.hasStarted = false;
}
+ public stop(e?: Error) {
+ window.log.info('[swarmPolling] stopped swarm polling', e?.message || e || '');
+
+ for (let i = 0; i < timeouts.length; i++) {
+ clearTimeout(timeouts[i]);
+ }
+ this.resetSwarmPolling();
+ }
+
public forcePolledTimestamp(pubkey: PubKey, lastPoll: number) {
this.groupPolling = this.groupPolling.map(group => {
if (PubKey.isEqual(pubkey, group.pubkey)) {
@@ -175,7 +188,7 @@ export class SwarmPolling {
if (!window.getGlobalOnlineStatus()) {
window?.log?.error('pollForAllKeys: offline');
// Very important to set up a new polling call so we do retry at some point
- setTimeout(this.pollForAllKeys.bind(this), SWARM_POLLING_TIMEOUT.ACTIVE);
+ timeouts.push(setTimeout(this.pollForAllKeys.bind(this), SWARM_POLLING_TIMEOUT.ACTIVE));
return;
}
// we always poll as often as possible for our pubkey
@@ -212,7 +225,7 @@ export class SwarmPolling {
window?.log?.warn('pollForAllKeys exception: ', e);
throw e;
} finally {
- setTimeout(this.pollForAllKeys.bind(this), SWARM_POLLING_TIMEOUT.ACTIVE);
+ timeouts.push(setTimeout(this.pollForAllKeys.bind(this), SWARM_POLLING_TIMEOUT.ACTIVE));
}
}
diff --git a/ts/themes/SessionTheme.tsx b/ts/themes/SessionTheme.tsx
index 0b07ee3a7..ef0694aff 100644
--- a/ts/themes/SessionTheme.tsx
+++ b/ts/themes/SessionTheme.tsx
@@ -1,5 +1,6 @@
import { ipcRenderer } from 'electron';
+import { ReactNode } from 'react';
import { createGlobalStyle } from 'styled-components';
import { getOppositeTheme, isThemeMismatched } from '../util/theme';
import { classicDark } from './classicDark';
@@ -14,7 +15,7 @@ const SessionGlobalStyles = createGlobalStyle`
};
`;
-export const SessionTheme = ({ children }: { children: any }) => (
+export const SessionTheme = ({ children }: { children: ReactNode }) => (
<>
{children}
diff --git a/ts/themes/globals.tsx b/ts/themes/globals.tsx
index 7afad7b75..644350f27 100644
--- a/ts/themes/globals.tsx
+++ b/ts/themes/globals.tsx
@@ -1,3 +1,4 @@
+import { isTestIntegration } from '../shared/env_vars';
import { hexColorToRGB } from '../util/hexColorToRGB';
import { COLORS } from './constants/colors';
@@ -129,8 +130,8 @@ export const THEME_GLOBALS: ThemeGlobals = {
'--composition-container-height': '60px',
'--search-input-height': '34px',
- '--default-duration': '0.25s',
- '--default-duration-seconds': '0.25', // framer-motion requires a number
+ '--default-duration': isTestIntegration() ? '0s' : '0.25s',
+ '--default-duration-seconds': isTestIntegration() ? '0' : '0.25', // framer-motion requires a number
'--green-color': COLORS.PRIMARY.GREEN,
'--blue-color': COLORS.PRIMARY.BLUE,