Skip to content

Commit 1761dc1

Browse files
committed
Enhance app configuration and EAS build profiles
- Updated app.config.js to include dynamic display names and release stages based on EAS build profiles. - Added NonProductionBanner component to App for better visibility of build status. - Modified eas.json to define channels for development, preview, and production builds. - Introduced new EAS build script for development-simulator in package.json. - Enhanced AboutScreen to display build labels based on the current release stage.
1 parent 012b30d commit 1761dc1

6 files changed

Lines changed: 95 additions & 0 deletions

File tree

App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ import { SafeAreaProvider } from 'react-native-safe-area-context';
44
import { AuthProvider } from './src/context/AuthContext';
55
import { WalletProvider } from './src/context/WalletContext';
66
import { SettingsProvider } from './src/context/SettingsContext';
7+
import { NonProductionBanner } from './src/components/common/NonProductionBanner';
78
import RootNavigator from './src/navigation/RootNavigator';
89

910
export default function App() {
1011
return (
1112
<SafeAreaProvider>
13+
<NonProductionBanner />
1214
<AuthProvider>
1315
<SettingsProvider>
1416
<WalletProvider>

app.config.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,37 @@
22
* Dynamic Expo config: injects Breez API key from the environment at build/start time.
33
* EAS: set `BREEZ_API_KEY` as a secret. Local dev: use `EXPO_PUBLIC_BREEZ_API_KEY` in `.env`
44
* or export `BREEZ_API_KEY` before `npx expo start`.
5+
*
6+
* EAS sets `EAS_BUILD_PROFILE` during cloud builds — used to label non-production installs
7+
* (home screen name, in-app banner, About).
58
*/
69
const appJson = require('./app.json');
710

11+
const easProfile = process.env.EAS_BUILD_PROFILE;
12+
13+
function displayName(base) {
14+
if (easProfile === 'development') return `${base} (Dev)`;
15+
if (easProfile === 'preview') return `${base} (Preview)`;
16+
return base;
17+
}
18+
19+
/** @type {'development' | 'preview' | 'production' | undefined} */
20+
function releaseStage() {
21+
if (easProfile === 'development' || easProfile === 'preview' || easProfile === 'production') {
22+
return easProfile;
23+
}
24+
return undefined;
25+
}
26+
827
module.exports = {
928
expo: {
1029
...appJson.expo,
30+
name: displayName(appJson.expo.name),
1131
extra: {
1232
...(appJson.expo?.extra ?? {}),
1333
breezApiKey: process.env.BREEZ_API_KEY || process.env.EXPO_PUBLIC_BREEZ_API_KEY || '',
34+
releaseStage: releaseStage(),
35+
easBuildProfile: easProfile ?? null,
1436
},
1537
},
1638
};

eas.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,28 @@
33
"development": {
44
"developmentClient": true,
55
"distribution": "internal",
6+
"channel": "development",
7+
"ios": {
8+
"simulator": false
9+
}
10+
},
11+
"development-simulator": {
12+
"developmentClient": true,
13+
"distribution": "internal",
14+
"channel": "development",
615
"ios": {
716
"simulator": true
817
}
918
},
1019
"preview": {
1120
"distribution": "internal",
21+
"channel": "preview",
1222
"ios": {
1323
"simulator": false
1424
}
1525
},
1626
"production": {
27+
"channel": "production",
1728
"ios": {
1829
"buildConfiguration": "Release"
1930
},

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"test:e2e": "bash scripts/qa-e2e-maestro.sh",
1515
"generate:app-icon": "node scripts/generate-app-icon.cjs",
1616
"eas:build:dev:ios": "npx --yes eas-cli build --profile development --platform ios",
17+
"eas:build:dev:ios:sim": "npx --yes eas-cli build --profile development-simulator --platform ios",
1718
"eas:build:dev:android": "npx --yes eas-cli build --profile development --platform android",
1819
"eas:build:preview:ios": "npx --yes eas-cli build --profile preview --platform ios",
1920
"eas:build:preview:android": "npx --yes eas-cli build --profile preview --platform android",
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import React from 'react';
2+
import { View, Text, StyleSheet } from 'react-native';
3+
import Constants from 'expo-constants';
4+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
5+
import { colors } from '@theme/colors';
6+
7+
const stage = Constants.expoConfig?.extra?.releaseStage as string | undefined;
8+
9+
export function NonProductionBanner() {
10+
const insets = useSafeAreaInsets();
11+
if (stage !== 'development' && stage !== 'preview') {
12+
return null;
13+
}
14+
const label = stage === 'preview' ? 'Preview build — not for production use' : 'Development build — not for production use';
15+
return (
16+
<View style={[styles.bar, { paddingTop: insets.top }]}>
17+
<Text style={styles.text}>{label}</Text>
18+
</View>
19+
);
20+
}
21+
22+
const styles = StyleSheet.create({
23+
bar: {
24+
backgroundColor: colors.warningMuted,
25+
borderBottomWidth: 1,
26+
borderBottomColor: colors.warning,
27+
paddingBottom: 8,
28+
paddingHorizontal: 12,
29+
},
30+
text: {
31+
color: colors.warning,
32+
fontSize: 12,
33+
fontWeight: '600',
34+
textAlign: 'center',
35+
},
36+
});

src/screens/settings/AboutScreen.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ export function AboutScreen() {
3434
const { height: tipHeight, loading: tipLoading } = useMainnetTipHeight();
3535

3636
const appVersion = Constants.expoConfig?.version ?? '—';
37+
const releaseStage = Constants.expoConfig?.extra?.releaseStage as string | undefined;
38+
const buildLabel =
39+
releaseStage === 'development'
40+
? 'Development'
41+
: releaseStage === 'preview'
42+
? 'Preview'
43+
: null;
3744
const blockHeightLabel = tipLoading
3845
? '…'
3946
: tipHeight != null
@@ -62,6 +69,18 @@ export function AboutScreen() {
6269
</View>
6370
<Text style={styles.rowValue}>{appVersion}</Text>
6471
</View>
72+
{buildLabel != null ? (
73+
<>
74+
<View style={styles.separator} />
75+
<View style={styles.row}>
76+
<View style={styles.rowLeft}>
77+
<Ionicons name="hammer-outline" size={20} color={colors.warning} />
78+
<Text style={styles.rowLabel}>Build</Text>
79+
</View>
80+
<Text style={[styles.rowValue, styles.rowValueWarning]}>{buildLabel}</Text>
81+
</View>
82+
</>
83+
) : null}
6584
<View style={styles.separator} />
6685
<View style={styles.row}>
6786
<View style={styles.rowLeft}>
@@ -173,6 +192,10 @@ const styles = StyleSheet.create({
173192
fontSize: 14,
174193
color: colors.textTertiary,
175194
},
195+
rowValueWarning: {
196+
color: colors.warning,
197+
fontWeight: '600',
198+
},
176199
separator: {
177200
height: 1,
178201
backgroundColor: colors.border,

0 commit comments

Comments
 (0)