Skip to content

Commit c5b597e

Browse files
authored
fix: move glacier drop feature flag to posthog (#1908)
1 parent 2382400 commit c5b597e

File tree

8 files changed

+18
-8
lines changed

8 files changed

+18
-8
lines changed

apps/browser-extension-wallet/.env.defaults

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ USE_ADVANCED_RECEIVE=true
3333
USE_POSTHOG_ANALYTICS_FOR_OPTED_OUT=false
3434
USE_MULTI_WALLET=true
3535
USE_MESSAGE_SIGNING=true
36-
USE_GLACIER_DROP=false
3736

3837
# In App URLs
3938
CATALYST_GOOGLE_PLAY_URL=https://play.google.com/store/apps/details?id=io.iohk.vitvoting

apps/browser-extension-wallet/.env.developerpreview

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ USE_FOOR_TOPUP=false
3131
USE_POSTHOG_ANALYTICS_FOR_OPTED_OUT=false
3232
USE_MULTI_WALLET=true
3333
USE_MESSAGE_SIGNING=true
34-
USE_GLACIER_DROP=false
3534

3635
# In App URLs
3736
CATALYST_GOOGLE_PLAY_URL=https://play.google.com/store/apps/details?id=io.iohk.vitvoting

apps/browser-extension-wallet/.env.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ USE_MULTI_DELEGATION_STAKING_FILTERS=false
3030
USE_ROS_STAKING_COLUMN=false
3131
USE_FOOR_TOPUP=true
3232
USE_MESSAGE_SIGNING=false
33-
USE_GLACIER_DROP=false
3433

3534
# In App URLs
3635
CATALYST_GOOGLE_PLAY_URL=https://play.google.com/store/apps/details?id=io.iohk.vitvoting

apps/browser-extension-wallet/src/lib/scripts/types/feature-flags.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export enum ExperimentName {
1313
DAPP_EXPLORER = 'dapp-explorer',
1414
SEND_CONSOLE_ERRORS_TO_SENTRY = 'send-console-errors-to-sentry',
1515
BITCOIN_WALLETS = 'bitcoin-wallets',
16-
NFTPRINTLAB = 'nftprintlab'
16+
NFTPRINTLAB = 'nftprintlab',
17+
GLACIER_DROP = 'glacier-drop'
1718
}
1819

1920
export type FeatureFlag = `${ExperimentName}`;

apps/browser-extension-wallet/src/providers/PostHogClientProvider/client/config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ const defaultFeatureFlags: FeatureFlags = {
3737
[ExperimentName.DAPP_EXPLORER]: false,
3838
[ExperimentName.SEND_CONSOLE_ERRORS_TO_SENTRY]: false,
3939
[ExperimentName.BITCOIN_WALLETS]: false,
40-
[ExperimentName.NFTPRINTLAB]: false
40+
[ExperimentName.NFTPRINTLAB]: false,
41+
[ExperimentName.GLACIER_DROP]: false
4142
};
4243

4344
export const featureFlagsByNetworkInitialValue: FeatureFlagsByNetwork = {

apps/browser-extension-wallet/src/views/browser-view/features/assets/components/MidnightEventBanner.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { storage } from 'webextension-polyfill';
55
import { MIDNIGHT_EVENT_BANNER_KEY, MidnightEventBannerStorage } from '@lib/scripts/types';
66
import { useTranslation } from 'react-i18next';
77
import { useExternalLinkOpener } from '@providers';
8+
import { usePostHogClientContext } from '@providers/PostHogClientProvider';
89

910
interface State {
1011
isLoading: boolean;
@@ -23,6 +24,9 @@ export const MidnightEventBanner = (): JSX.Element => {
2324
data: undefined
2425
});
2526
const openExternalLink = useExternalLinkOpener();
27+
const posthog = usePostHogClientContext();
28+
29+
const isGlacierDropEnabled = posthog?.isFeatureFlagEnabled('glacier-drop');
2630

2731
useEffect(() => {
2832
const loadStorage = async () => {
@@ -39,7 +43,7 @@ export const MidnightEventBanner = (): JSX.Element => {
3943
}, []);
4044

4145
const shouldHide = () => {
42-
if (process.env.USE_GLACIER_DROP !== 'true') {
46+
if (!isGlacierDropEnabled) {
4347
return true;
4448
}
4549

apps/browser-extension-wallet/src/views/browser-view/features/settings/components/SettingsLayout.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { MidnightPreLaunchSettingsBanner } from '@lace/core';
88
import { Box } from '@input-output-hk/lace-ui-toolkit';
99
import MidnightPreLaunchBannerImage from '../../../../../../../../packages/core/src/ui/assets/images/midnight-launch-event-sidebar-banner.png';
1010
import { useExternalLinkOpener } from '@providers';
11+
import { usePostHogClientContext } from '@providers/PostHogClientProvider';
1112

1213
export interface SettingsLayoutProps {
1314
defaultPassphraseVisible?: boolean;
@@ -20,10 +21,13 @@ export const SettingsLayout = ({
2021
}: SettingsLayoutProps): React.ReactElement => {
2122
const { t } = useTranslation();
2223
const openExternalLink = useExternalLinkOpener();
24+
const posthog = usePostHogClientContext();
25+
26+
const isGlacierDropEnabled = posthog?.isFeatureFlagEnabled('glacier-drop');
2327

2428
const sidePanelContent = (
2529
<div>
26-
{process.env.USE_GLACIER_DROP === 'true' ? (
30+
{isGlacierDropEnabled ? (
2731
<Box mb="$32">
2832
<MidnightPreLaunchSettingsBanner
2933
bannerImageUrl={MidnightPreLaunchBannerImage}

apps/browser-extension-wallet/src/views/browser-view/features/settings/components/SettingsWalletBase.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { CustomSubmitApiDrawer } from './CustomSubmitApiDrawer';
2222
import { COLLATERAL_AMOUNT_LOVELACES } from '@utils/constants';
2323
import { useCurrentBlockchain } from '@src/multichain';
2424
import { getNetworkName } from '@src/utils/get-network-name';
25+
import { usePostHogClientContext } from '@providers/PostHogClientProvider';
2526

2627
const { Title } = Typography;
2728

@@ -65,6 +66,7 @@ export const SettingsWalletBase = <AdditionalDrawers extends string>({
6566
const closeDrawer = useRedirection(walletRoutePaths.settings);
6667
const { blockchain } = useCurrentBlockchain();
6768
const isBitcoinWallet = blockchain === 'bitcoin';
69+
const posthog = usePostHogClientContext();
6870

6971
const { t } = useTranslation();
7072
const { environmentName, inMemoryWallet, walletInfo, setHdDiscoveryStatus, isSharedWallet } = useWalletStore();
@@ -80,6 +82,7 @@ export const SettingsWalletBase = <AdditionalDrawers extends string>({
8082

8183
const isNetworkChoiceEnabled = AVAILABLE_CHAINS.length > 1;
8284
const authorizedAppsEnabled = process.env.USE_DAPP_CONNECTOR === 'true' && !isSharedWallet;
85+
const isGlacierDropEnabled = posthog?.isFeatureFlagEnabled('glacier-drop');
8386

8487
useEffect(() => {
8588
const openCollateralDrawer = async () => {
@@ -177,7 +180,7 @@ export const SettingsWalletBase = <AdditionalDrawers extends string>({
177180
<Title level={5} className={styles.heading5} data-testid="wallet-settings-heading">
178181
{t('browserView.settings.wallet.title')}
179182
</Title>
180-
{process.env.USE_GLACIER_DROP === 'true' && (
183+
{isGlacierDropEnabled && (
181184
<SettingsLink
182185
description={t('browserView.settings.wallet.midnight.prelaunch.description')}
183186
data-testid="settings-wallet-midnight-prelaunch-link"

0 commit comments

Comments
 (0)