Skip to content

Commit

Permalink
give priority to backup sheet over nft icon unlocks, wrap nft icon un…
Browse files Browse the repository at this point in the history
…locks in swipe layout handler
  • Loading branch information
maxbbb committed Jan 3, 2025
1 parent 64de9d5 commit 36ae4d2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 31 deletions.
53 changes: 25 additions & 28 deletions src/featuresToUnlock/unlockableAppIconCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Routes from '@/navigation/routesNames';
import { UnlockableAppIconKey, unlockableAppIcons } from '@/appIcons/appIcons';
import { MMKV } from 'react-native-mmkv';
import { STORAGE_IDS } from '@/model/mmkv';
import { triggerOnSwipeLayout } from '@/navigation/onNavigationStateChange';

export const unlockableAppIconStorage = new MMKV({
id: STORAGE_IDS.UNLOCKABLE_APP_ICONS,
Expand Down Expand Up @@ -62,38 +63,34 @@ export const unlockableAppIconCheck = async (appIconKey: UnlockableAppIconKey, w

logger.debug(`[unlockableAppIconCheck]: ${appIconKey} check result: ${found}`);

// We open the sheet with a setTimeout 1 sec later to make sure we can return first
// so we can abort early if we're showing a sheet to prevent 2+ sheets showing at the same time
if (found) {
unlockableAppIconStorage.set(appIconKey, true);
logger.debug(`[unlockableAppIconCheck]: Feature check ${appIconKey} set to true. Wont show up anymore!`);

setTimeout(() => {
if (found) {
unlockableAppIconStorage.set(appIconKey, true);
logger.debug(`[unlockableAppIconCheck]: Feature check ${appIconKey} set to true. Wont show up anymore!`);
// Temporarily ignore some icons
// We can get rid of this in 2025!
const iconsToIgnore = [
'optimism',
'smol',
'zora',
'golddoge',
'raindoge',
'pooly',
'finiliar',
'zorb',
'poolboy',
'adworld',
'farcaster',
];

// Temporarily ignore some icons
// We can get rid of this in 2025!
const iconsToIgnore = [
'optimism',
'smol',
'zora',
'golddoge',
'raindoge',
'pooly',
'finiliar',
'zorb',
'poolboy',
'adworld',
'farcaster',
];
if (iconsToIgnore.includes(appIconKey)) {
return false;
}

if (iconsToIgnore.includes(appIconKey)) {
return false;
}
triggerOnSwipeLayout(() => Navigation.handleAction(Routes.APP_ICON_UNLOCK_SHEET, { appIconKey }));

Navigation.handleAction(Routes.APP_ICON_UNLOCK_SHEET, { appIconKey });
return true;
}
}, 1000);
return true;
}
return found;
} catch (e) {
logger.error(new RainbowError('[unlockableAppIconCheck]: UnlockableAppIconCheck blew up'), { e });
Expand Down
6 changes: 3 additions & 3 deletions src/handlers/walletReadyEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ export const runFeatureUnlockChecks = async (): Promise<boolean> => {
};

export const runFeaturesLocalCampaignAndBackupChecks = async () => {
if (await runFeatureUnlockChecks()) {
if (await runWalletBackupStatusChecks()) {
return true;
}
if (await runLocalCampaignChecks()) {
if (await runFeatureUnlockChecks()) {
return true;
}
if (await runWalletBackupStatusChecks()) {
if (await runLocalCampaignChecks()) {
return true;
}

Expand Down

0 comments on commit 36ae4d2

Please sign in to comment.