Skip to content

Commit

Permalink
fix: Do not show Profile Onboarding after restoring wallet from the seed
Browse files Browse the repository at this point in the history
  • Loading branch information
limpbrains committed Oct 9, 2023
1 parent e00f7b9 commit fa0c170
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/screens/Onboarding/Restoring.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,29 @@ import GlowingBackground from '../../components/GlowingBackground';
import SafeAreaInset from '../../components/SafeAreaInset';
import GlowImage from '../../components/GlowImage';
import Button from '../../components/Button';
import LoadingWalletScreen from './Loading';
import Dialog from '../../components/Dialog';
import LoadingWalletScreen from './Loading';
import { useAppSelector } from '../../hooks/redux';
import { useProfile2, useSelectedSlashtag2 } from '../../hooks/slashtags2';
import { setOnboardingProfileStep } from '../../store/actions/slashtags';
import { onboardingProfileStepSelector } from '../../store/reselect/slashtags';

const checkImageSrc = require('../../assets/illustrations/check.png');
const crossImageSrc = require('../../assets/illustrations/cross.png');

let attemptedAutoRestore = false;

const RestoringScreen = (): ReactElement => {
const { t } = useTranslation('onboarding');
const slashtag = useSelectedSlashtag();
const { url } = useSelectedSlashtag2();
const { profile } = useProfile2(url);
const onboardingStep = useAppSelector(onboardingProfileStepSelector);
const [showRestored, setShowRestored] = useState(false);
const [showFailed, setShowFailed] = useState(false);
const [proceedWBIsLoading, setProceedWBIsLoading] = useState(false);
const [tryAgainCount, setTryAgainCount] = useState(0);
const [showCautionDialog, setShowCautionDialog] = useState(false);
const slashtag = useSelectedSlashtag();
const { t } = useTranslation('onboarding');

const onRemoteRestore = useCallback(async (): Promise<void> => {
attemptedAutoRestore = true;
Expand Down Expand Up @@ -70,6 +77,13 @@ const RestoringScreen = (): ReactElement => {
onRemoteRestore().then();
}, [onRemoteRestore]);

useEffect(() => {
// If the user has a name, we can assume they have completed the profile onboarding
if (onboardingStep !== 'Done' && profile.name) {
setOnboardingProfileStep('Done');
}
}, [profile.name, onboardingStep]);

let color: keyof IColors = 'brand';
let content = <LoadingWalletScreen />;

Expand Down

0 comments on commit fa0c170

Please sign in to comment.