From 1e40f1b608e16b47ec963e16ae522d2077ec5fae Mon Sep 17 00:00:00 2001 From: William Grant Date: Tue, 2 Apr 2024 15:46:04 +1100 Subject: [PATCH] fix: cleanup --- ts/components/SessionSearchInput.tsx | 3 ++- ts/components/conversation/ContactName.tsx | 2 +- ts/components/registration/hooks/index.tsx | 23 +++------------------- ts/mains/main_renderer.tsx | 2 +- ts/receiver/configMessage.ts | 4 ++-- ts/state/onboarding/ducks/registration.ts | 1 - ts/util/accountManager.ts | 4 ++-- 7 files changed, 11 insertions(+), 28 deletions(-) diff --git a/ts/components/SessionSearchInput.tsx b/ts/components/SessionSearchInput.tsx index 9c745a0a8..3d1a21f54 100644 --- a/ts/components/SessionSearchInput.tsx +++ b/ts/components/SessionSearchInput.tsx @@ -1,5 +1,6 @@ +import { Dispatch } from '@reduxjs/toolkit'; import { debounce } from 'lodash'; -import { Dispatch, useState } from 'react'; +import { useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import styled from 'styled-components'; import { clearSearch, search, updateSearchTerm } from '../state/ducks/search'; diff --git a/ts/components/conversation/ContactName.tsx b/ts/components/conversation/ContactName.tsx index 49523e64a..806c69d0e 100644 --- a/ts/components/conversation/ContactName.tsx +++ b/ts/components/conversation/ContactName.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import React, { CSSProperties } from 'react'; +import { CSSProperties } from 'react'; import { useIsPrivate, diff --git a/ts/components/registration/hooks/index.tsx b/ts/components/registration/hooks/index.tsx index 9ecc84839..0027ff201 100644 --- a/ts/components/registration/hooks/index.tsx +++ b/ts/components/registration/hooks/index.tsx @@ -22,8 +22,8 @@ type UseRecoveryProgressEffectProps = { /** * Effect to handle the progress rate of the recovery loading animation * @param step AccountRestoration the onboarding step we are currently on - * @param progress number the progress of the loading bar - * @param setProgress (progress: number) => AnyAction redux function to set the progress of the loading bar + * @param progress number the progress % of the loading bar + * @param setProgress (progress: number) => AnyAction redux function to set the progress % of the loading bar * @param ourPubkey: string the public key of the user * @param displayName: string the display name of the user */ @@ -40,10 +40,6 @@ export const useRecoveryProgressEffect = (props: UseRecoveryProgressEffectProps) useEffect(() => { if (step === AccountRestoration.Loading) { interval = setInterval(() => { - window.log.debug( - `WIP: [onboarding] restore account: ${AccountRestoration[step]} ${progress}%` - ); - if (progress < totalProgress) { dispatch(setProgress(progress + 1)); } @@ -58,10 +54,6 @@ export const useRecoveryProgressEffect = (props: UseRecoveryProgressEffectProps) if (step === AccountRestoration.Finishing) { interval = setInterval(() => { - window.log.debug( - `WIP: [onboarding] restore account: ${AccountRestoration[step]} ${progress}%` - ); - if (progress < totalProgress) { dispatch(setProgress(progress + 1)); } @@ -75,10 +67,6 @@ export const useRecoveryProgressEffect = (props: UseRecoveryProgressEffectProps) if (step === AccountRestoration.Finished) { interval = setInterval(() => { - window.log.debug( - `WIP: [onboarding] restore account: ${AccountRestoration[step]} ${progress}%` - ); - clearInterval(interval); if (!isEmpty(displayName)) { dispatch(setAccountRestorationStep(AccountRestoration.Complete)); @@ -90,16 +78,11 @@ export const useRecoveryProgressEffect = (props: UseRecoveryProgressEffectProps) } if (step === AccountRestoration.Complete) { - window.log.debug( - `WIP: [onboarding] restore account: ${AccountRestoration[step]} ${progress}%` - ); clearInterval(interval); if (!isEmpty(ourPubkey) && !isEmpty(displayName)) { void recoveryComplete(); } else { - window.log.debug( - `WIP: [onboarding] restore account: We don't have a pubkey or display name` - ); + window.log.debug(`[onboarding] restore account: We don't have a pubkey or display name`); dispatch(setAccountRestorationStep(AccountRestoration.DisplayName)); } } diff --git a/ts/mains/main_renderer.tsx b/ts/mains/main_renderer.tsx index 05835c17f..6a46e3341 100644 --- a/ts/mains/main_renderer.tsx +++ b/ts/mains/main_renderer.tsx @@ -285,7 +285,7 @@ async function start() { window.log.info('listening for registration events'); WhisperEvents.on('registration_done', () => { - window.log.info('WIP: [onboarding] handling registration event'); + window.log.info('[onboarding] handling registration event'); void connect(); }); diff --git a/ts/receiver/configMessage.ts b/ts/receiver/configMessage.ts index 465a98ac2..fc5b3b5e2 100644 --- a/ts/receiver/configMessage.ts +++ b/ts/receiver/configMessage.ts @@ -98,7 +98,7 @@ async function mergeConfigsWithIncomingUpdates( })); if (window.sessionFeatureFlags.debug.debugLibsessionDumps) { window.log.info( - `WIP: printDumpsForDebugging: before merge of ${variant}:`, + `printDumpsForDebugging: before merge of ${variant}:`, StringUtils.toHex(await GenericWrapperActions.dump(variant)) ); @@ -127,7 +127,7 @@ async function mergeConfigsWithIncomingUpdates( if (window.sessionFeatureFlags.debug.debugLibsessionDumps) { window.log.info( - `WIP: printDumpsForDebugging: after merge of ${variant}:`, + `printDumpsForDebugging: after merge of ${variant}:`, StringUtils.toHex(await GenericWrapperActions.dump(variant)) ); } diff --git a/ts/state/onboarding/ducks/registration.ts b/ts/state/onboarding/ducks/registration.ts index d4ed0b7c2..ef52f4bac 100644 --- a/ts/state/onboarding/ducks/registration.ts +++ b/ts/state/onboarding/ducks/registration.ts @@ -64,7 +64,6 @@ export const registrationSlice = createSlice({ initialState, reducers: { resetOnboardingState() { - window.log.debug(`WIP: [onboarding] resetOnboardingState() called`); return { ...initialState }; }, setOnboardingStep(state, action: PayloadAction) { diff --git a/ts/util/accountManager.ts b/ts/util/accountManager.ts index e546863c7..be6296a3f 100644 --- a/ts/util/accountManager.ts +++ b/ts/util/accountManager.ts @@ -188,7 +188,7 @@ async function createAccount(identityKeyPair: SessionKeyPair) { */ export async function registrationDone(ourPubkey: string, displayName: string) { window?.log?.info( - `WIP: [onboarding] registration done with user provided displayName "${displayName}" and pubkey "${ourPubkey}"` + `[onboarding] registration done with user provided displayName "${displayName}" and pubkey "${ourPubkey}"` ); // initializeLibSessionUtilWrappers needs our publicKey to be set @@ -225,7 +225,7 @@ export async function registrationDone(ourPubkey: string, displayName: string) { }; window.inboxStore?.dispatch(userActions.userChanged(user)); - window?.log?.info('WIP: [onboarding] dispatching registration event'); + window?.log?.info('[onboarding] dispatching registration event'); // this will make the poller start fetching messages trigger('registration_done'); }