fix: cleanup

pull/3056/head
William Grant
parent 76390ceb9d
commit 1e40f1b608

@ -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';

@ -1,5 +1,5 @@
import classNames from 'classnames';
import React, { CSSProperties } from 'react';
import { CSSProperties } from 'react';
import {
useIsPrivate,

@ -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));
}
}

@ -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();
});

@ -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))
);
}

@ -64,7 +64,6 @@ export const registrationSlice = createSlice({
initialState,
reducers: {
resetOnboardingState() {
window.log.debug(`WIP: [onboarding] resetOnboardingState() called`);
return { ...initialState };
},
setOnboardingStep(state, action: PayloadAction<Onboarding>) {

@ -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');
}

Loading…
Cancel
Save