Skip to content

Commit 4ad297c

Browse files
Hide UI when disabled through config
1 parent 777ecb3 commit 4ad297c

File tree

1 file changed

+83
-71
lines changed

1 file changed

+83
-71
lines changed

src/views/navigation/screens/InformationGroup/AboutAppScreen.tsx

Lines changed: 83 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ const AboutAppScreen: FC<PropsWithNavigation> = ({ navigation }) => {
9393
<Appbar.Header>
9494
<Appbar.BackAction onPress={() => navigation.goBack()} />
9595
<Appbar.Content title={t('settings.aboutApp')} />
96-
<Appbar.Action icon="refresh" onPress={handleShowRefreshModal} />
96+
{Config.DISABLE_IN_APP_UPDATES !== 'true' ? (
97+
<Appbar.Action icon="refresh" onPress={handleShowRefreshModal} />
98+
) : null}
9799
</Appbar.Header>
98100
<StyledView theme={theme}>
99101
<GenericRefreshModal
@@ -125,79 +127,89 @@ const AboutAppScreen: FC<PropsWithNavigation> = ({ navigation }) => {
125127
</Box>
126128
</Box>
127129
</Box>
128-
<Divider />
129-
<Box p={8}>
130-
<Box
131-
style={{
132-
display: 'flex',
133-
flexDirection: 'row',
134-
justifyContent: 'center',
135-
gap: 4,
136-
}}
137-
>
138-
<Text variant="titleLarge" style={{ textAlign: 'center' }}>
139-
{hasNewAppVersion
140-
? t('aboutApp.newVersionAvailable')
141-
: t('aboutApp.latestAppRelease')}
142-
</Text>
143-
<Badge
144-
style={{
145-
alignSelf: 'center',
146-
backgroundColor: theme.colors.primary,
147-
}}
148-
>
149-
{prettyTagName}
150-
</Badge>
151-
</Box>
152-
<Box>
153-
<Text variant="bodySmall" style={{ textAlign: 'center' }}>
154-
{t('fetchedWithTime', { time: formattedReleaseFetchTime })}
155-
</Text>
156-
</Box>
157-
<Surface style={{ padding: 16, marginTop: 8, borderRadius: 16 }}>
158-
<Markdown
130+
{Config.DISABLE_IN_APP_UPDATES !== 'true' ? (
131+
<>
132+
<Divider />
133+
<Box p={8}>
134+
<Box
135+
style={{
136+
display: 'flex',
137+
flexDirection: 'row',
138+
justifyContent: 'center',
139+
gap: 4,
140+
}}
141+
>
142+
<Text variant="titleLarge" style={{ textAlign: 'center' }}>
143+
{hasNewAppVersion
144+
? t('aboutApp.newVersionAvailable')
145+
: t('aboutApp.latestAppRelease')}
146+
</Text>
147+
<Badge
148+
style={{
149+
alignSelf: 'center',
150+
backgroundColor: theme.colors.primary,
151+
}}
152+
>
153+
{prettyTagName}
154+
</Badge>
155+
</Box>
156+
<Box>
157+
<Text variant="bodySmall" style={{ textAlign: 'center' }}>
158+
{t('fetchedWithTime', {
159+
time: formattedReleaseFetchTime,
160+
})}
161+
</Text>
162+
</Box>
163+
<Surface
164+
style={{ padding: 16, marginTop: 8, borderRadius: 16 }}
165+
>
166+
<Markdown
167+
style={{
168+
body: {
169+
color: theme.colors.onSurface,
170+
},
171+
link: { textDecorationLine: 'none' },
172+
}}
173+
rules={rules}
174+
>
175+
{releaseInfo?.body || ''}
176+
</Markdown>
177+
</Surface>
178+
<Box mt={16} mb={8}>
179+
<Button
180+
buttonColor="#24292e"
181+
textColor="#ffffff"
182+
icon="github"
183+
onPress={() =>
184+
Linking.openURL(releaseInfo?.html_url || '')
185+
}
186+
disabled={!releaseInfo?.html_url}
187+
>
188+
{t('aboutApp.viewMore')}
189+
</Button>
190+
</Box>
191+
</Box>
192+
<Divider />
193+
<List.Item
194+
title={t('settings.activateInappUpdates')}
195+
onPress={handleToggleInAppUpdates}
196+
borderless
197+
right={props => (
198+
<Switch
199+
{...props}
200+
value={!!inAppUpdatesEnabled}
201+
onValueChange={handleToggleInAppUpdates}
202+
color={theme.colors.primary}
203+
disabled={Config.DISABLE_IN_APP_UPDATES === 'true'}
204+
/>
205+
)}
206+
disabled={Config.DISABLE_IN_APP_UPDATES === 'true'}
159207
style={{
160-
body: {
161-
color: theme.colors.onSurface,
162-
},
163-
link: { textDecorationLine: 'none' },
208+
opacity: Config.DISABLE_IN_APP_UPDATES === 'true' ? 0.5 : 1,
164209
}}
165-
rules={rules}
166-
>
167-
{releaseInfo?.body || ''}
168-
</Markdown>
169-
</Surface>
170-
<Box mt={16} mb={8}>
171-
<Button
172-
buttonColor="#24292e"
173-
textColor="#ffffff"
174-
icon="github"
175-
onPress={() => Linking.openURL(releaseInfo?.html_url || '')}
176-
disabled={!releaseInfo?.html_url}
177-
>
178-
{t('aboutApp.viewMore')}
179-
</Button>
180-
</Box>
181-
</Box>
182-
<Divider />
183-
<List.Item
184-
title={t('settings.activateInappUpdates')}
185-
onPress={handleToggleInAppUpdates}
186-
borderless
187-
right={props => (
188-
<Switch
189-
{...props}
190-
value={!!inAppUpdatesEnabled}
191-
onValueChange={handleToggleInAppUpdates}
192-
color={theme.colors.primary}
193-
disabled={Config.DISABLE_IN_APP_UPDATES === 'true'}
194210
/>
195-
)}
196-
disabled={Config.DISABLE_IN_APP_UPDATES === 'true'}
197-
style={{
198-
opacity: Config.DISABLE_IN_APP_UPDATES === 'true' ? 0.5 : 1,
199-
}}
200-
/>
211+
</>
212+
) : null}
201213
<View style={{ height: spacing * 2 }} />
202214
</ScrollView>
203215
</Box>

0 commit comments

Comments
 (0)