-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
65 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { APP_CONFIGS } from './features' | ||
|
||
export const appTypes = ['FUNKE_WALLET', 'PARADYM_WALLET'] as const | ||
export type AppType = (typeof appTypes)[number] | ||
|
||
const getAppType = (): AppType => { | ||
let appType = process.env.EXPO_PUBLIC_APP_TYPE as AppType | ||
|
||
if (!appType) { | ||
console.warn('⚠️ EXPO_PUBLIC_APP_TYPE not set, falling back to PARADYM_WALLET') | ||
appType = 'PARADYM_WALLET' | ||
} | ||
|
||
if (!appTypes.includes(appType)) { | ||
console.warn(`⚠️ EXPO_PUBLIC_APP_TYPE is not a valid app type: ${appType}. Falling back to PARADYM_WALLET.`) | ||
appType = 'PARADYM_WALLET' | ||
} | ||
|
||
const features = APP_CONFIGS[appType] | ||
const sortedFeatures = Object.entries(features).sort(([, a], [, b]) => (b ? 1 : 0) - (a ? 1 : 0)) | ||
|
||
console.log(` | ||
🔧 App Configuration | ||
━━━━━━━━━━━━━━━━━━━━ | ||
📱 App Type: ${appType} | ||
⚙️ Features:${sortedFeatures | ||
.map( | ||
([key, value]) => ` | ||
- ${key}: ${value ? '✅' : '❌'}` | ||
) | ||
.join('')}`) | ||
|
||
return appType as AppType | ||
} | ||
|
||
export const CURRENT_APP_TYPE = getAppType() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
export const FEATURES = { | ||
EID_CARD_FEATURE: 'eid_card_feature', | ||
AI_ANALYSIS_FEATURE: 'ai_analysis_feature', | ||
} | ||
import type { AppType } from './appType' | ||
|
||
export const APP_CONFIGS = { | ||
FUNKE_WALLET: { | ||
[FEATURES.EID_CARD_FEATURE]: true, | ||
[FEATURES.AI_ANALYSIS_FEATURE]: true, | ||
EID_CARD: true, | ||
AI_ANALYSIS: true, | ||
}, | ||
PARADYM_WALLET: { | ||
[FEATURES.EID_CARD_FEATURE]: false, | ||
[FEATURES.AI_ANALYSIS_FEATURE]: false, | ||
EID_CARD: false, | ||
AI_ANALYSIS: false, | ||
}, | ||
} satisfies Record<AppType, Record<FeatureKey, boolean>> | ||
|
||
export const FEATURES = { | ||
EID_CARD: 'eid_card', | ||
AI_ANALYSIS: 'ai_analysis', | ||
} | ||
|
||
export type AppType = keyof typeof APP_CONFIGS | ||
export type FeatureKey = keyof (typeof APP_CONFIGS)[AppType] | ||
export type FeatureKey = keyof typeof FEATURES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,7 +148,7 @@ const MenuItem = ({ item, idx, onPress }: { item: (typeof menuItems)[number]; id | |
<Stack | ||
onPressIn={handlePressIn} | ||
onPressOut={handlePressOut} | ||
onPress={withHaptics(() => Linking.openURL('mailto:[email protected]?subject=Feedback on the Funke EUDI Wallet'))} | ||
onPress={withHaptics(() => Linking.openURL('mailto:[email protected]?subject=Feedback on the Wallet'))} | ||
asChild | ||
> | ||
{content} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
import { CURRENT_APP_TYPE } from '../config/appType' | ||
import { APP_CONFIGS } from '../config/features' | ||
import type { AppType, FeatureKey } from '../config/features' | ||
|
||
const APP_TYPE = (process.env.EXPO_PUBLIC_APP_TYPE || 'PARADYM_WALLET') as AppType | ||
import type { FeatureKey } from '../config/features' | ||
|
||
export const useFeatureFlag = (featureKey: FeatureKey) => { | ||
return APP_CONFIGS[APP_TYPE]?.[featureKey] ?? false | ||
return APP_CONFIGS[CURRENT_APP_TYPE]?.[featureKey] ?? false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters