mirror of
https://github.com/Boof2015/astra-mobile.git
synced 2026-08-18 19:54:26 +02:00
prep for release
This commit is contained in:
@@ -25,6 +25,7 @@ import { useDesktopSyncStore } from '@/stores/desktopSyncStore';
|
||||
import { useLastFmSettingsStore } from '@/stores/lastFmSettingsStore';
|
||||
import { useLibraryStore } from '@/stores/libraryStore';
|
||||
import { useRemoteSourcesStore } from '@/stores/remoteSourcesStore';
|
||||
import { createBuildInfo } from '@/release/buildInfo';
|
||||
import { useThemeStore } from '@/stores/themeStore';
|
||||
import { useSleepTimerStore } from '@/stores/sleepTimerStore';
|
||||
import { formatSleepTimerStatus } from '@/audio/sleepTimerState';
|
||||
@@ -63,7 +64,7 @@ export default function SettingsScreen() {
|
||||
|
||||
const totalTracks = folders.reduce((sum, folder) => sum + folder.track_count, 0);
|
||||
const connectedScrobblers = lastFmStatus?.profiles.filter((p) => p.connected).length ?? 0;
|
||||
const appVersion = Constants.expoConfig?.version;
|
||||
const buildInfo = createBuildInfo(Constants.expoConfig);
|
||||
|
||||
const librarySubtitle = folders.length === 0
|
||||
? 'Folders, artist grouping, album singles.'
|
||||
@@ -138,7 +139,7 @@ export default function SettingsScreen() {
|
||||
<SettingsNavRow
|
||||
icon="information-circle-outline"
|
||||
title="Info"
|
||||
subtitle={appVersion ? `v${appVersion}. Attribution, license, community links.` : 'Attribution, license, community links.'}
|
||||
subtitle={`${buildInfo.versionLabel}. Attribution, license, community links.`}
|
||||
onPress={() => router.push('/settings/info' as never)}
|
||||
/>
|
||||
</ScrollView>
|
||||
|
||||
@@ -11,12 +11,14 @@ import {
|
||||
SettingsSectionScreen,
|
||||
} from '@/components/settings/SettingsSectionScaffold';
|
||||
import { Text } from '@/components/Text';
|
||||
import { createBuildInfo } from '@/release/buildInfo';
|
||||
import { spacing } from '@/theme';
|
||||
import { createThemedStyles, useColors } from '@/theme/themed';
|
||||
|
||||
const ASTRA_REPOSITORY_URL = 'https://github.com/Boof2015/astra-mobile';
|
||||
const ASTRA_DISCORD_URL = 'https://discord.gg/hsKK8Kr9Nj';
|
||||
const ASTRA_SUPPORT_URL = 'https://ko-fi.com/boof2015';
|
||||
const ASTRA_PRIVACY_URL = 'https://github.com/Boof2015/astra-mobile/blob/main/PRIVACY.md';
|
||||
const ASTRA_LICENSE_URL = 'https://github.com/Boof2015/astra-mobile/blob/main/LICENSE';
|
||||
const GPL_V3_URL = 'https://www.gnu.org/licenses/gpl-3.0.html';
|
||||
|
||||
@@ -31,8 +33,7 @@ async function openExternalLink(url: string, label: string) {
|
||||
export default function InfoSettingsScreen() {
|
||||
const styles = useStyles();
|
||||
const colors = useColors();
|
||||
const appVersion = Constants.expoConfig?.version;
|
||||
const appVersionLabel = appVersion ? `v${appVersion}` : 'Unavailable';
|
||||
const buildInfo = createBuildInfo(Constants.expoConfig);
|
||||
|
||||
return (
|
||||
<SettingsSectionScreen title="Info">
|
||||
@@ -42,7 +43,7 @@ export default function InfoSettingsScreen() {
|
||||
<Text variant="caption" color={colors.textSecondary}>
|
||||
App Version
|
||||
</Text>
|
||||
<Text variant="body">{appVersionLabel}</Text>
|
||||
<Text variant="body">{buildInfo.versionLabel}</Text>
|
||||
</View>
|
||||
</SettingsCard>
|
||||
|
||||
@@ -69,12 +70,23 @@ export default function InfoSettingsScreen() {
|
||||
rightIcon="open-outline"
|
||||
onPress={() => void openExternalLink(ASTRA_DISCORD_URL, 'Discord')}
|
||||
/>
|
||||
{buildInfo.showExternalSupportLink ? (
|
||||
<SettingsNavRow
|
||||
icon="heart-outline"
|
||||
title="Ko-fi"
|
||||
subtitle="ko-fi.com/boof2015"
|
||||
rightIcon="open-outline"
|
||||
onPress={() => void openExternalLink(ASTRA_SUPPORT_URL, 'Ko-fi')}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
<SettingsSectionLabel spaced>PRIVACY</SettingsSectionLabel>
|
||||
<SettingsNavRow
|
||||
icon="heart-outline"
|
||||
title="Ko-fi"
|
||||
subtitle="ko-fi.com/boof2015"
|
||||
icon="shield-checkmark-outline"
|
||||
title="Privacy Policy"
|
||||
subtitle="How Astra handles local and optional service data"
|
||||
rightIcon="open-outline"
|
||||
onPress={() => void openExternalLink(ASTRA_SUPPORT_URL, 'Ko-fi')}
|
||||
onPress={() => void openExternalLink(ASTRA_PRIVACY_URL, 'the Privacy Policy')}
|
||||
/>
|
||||
|
||||
<SettingsSectionLabel spaced>LICENSE</SettingsSectionLabel>
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
|
||||
import { createBuildInfo, normalizeDistributionChannel } from './buildInfo.ts';
|
||||
|
||||
test('formats channel-specific release labels', () => {
|
||||
assert.equal(
|
||||
createBuildInfo({ version: '0.1.0', extra: { distribution: 'google-play' } }).versionLabel,
|
||||
'v0.1.0 (Google Play)'
|
||||
);
|
||||
assert.equal(
|
||||
createBuildInfo({ version: '0.1.0', extra: { distribution: 'github' } }).versionLabel,
|
||||
'v0.1.0 (GitHub)'
|
||||
);
|
||||
});
|
||||
|
||||
test('only the Google Play build hides external support links', () => {
|
||||
assert.equal(
|
||||
createBuildInfo({ version: '0.1.0', extra: { distribution: 'google-play' } }).showExternalSupportLink,
|
||||
false
|
||||
);
|
||||
assert.equal(
|
||||
createBuildInfo({ version: '0.1.0', extra: { distribution: 'github' } }).showExternalSupportLink,
|
||||
true
|
||||
);
|
||||
});
|
||||
|
||||
test('unknown or absent distributions safely fall back to development', () => {
|
||||
assert.equal(normalizeDistributionChannel('nightly'), 'development');
|
||||
assert.equal(createBuildInfo({ version: '0.1.0' }).versionLabel, 'v0.1.0 (Development)');
|
||||
assert.equal(createBuildInfo(null).versionLabel, 'Unavailable (Development)');
|
||||
});
|
||||
@@ -0,0 +1,39 @@
|
||||
export type DistributionChannel = 'development' | 'github' | 'google-play';
|
||||
|
||||
export interface ExpoBuildConfig {
|
||||
version?: string | null;
|
||||
extra?: Record<string, unknown> | null;
|
||||
}
|
||||
|
||||
export interface BuildInfo {
|
||||
distribution: DistributionChannel;
|
||||
distributionLabel: 'Development' | 'GitHub' | 'Google Play';
|
||||
showExternalSupportLink: boolean;
|
||||
version: string | null;
|
||||
versionLabel: string;
|
||||
}
|
||||
|
||||
const DISTRIBUTION_LABELS: Record<DistributionChannel, BuildInfo['distributionLabel']> = {
|
||||
development: 'Development',
|
||||
github: 'GitHub',
|
||||
'google-play': 'Google Play',
|
||||
};
|
||||
|
||||
export function normalizeDistributionChannel(value: unknown): DistributionChannel {
|
||||
return value === 'github' || value === 'google-play' ? value : 'development';
|
||||
}
|
||||
|
||||
export function createBuildInfo(config: ExpoBuildConfig | null | undefined): BuildInfo {
|
||||
const rawVersion = typeof config?.version === 'string' ? config.version.trim() : '';
|
||||
const version = rawVersion || null;
|
||||
const distribution = normalizeDistributionChannel(config?.extra?.distribution);
|
||||
const distributionLabel = DISTRIBUTION_LABELS[distribution];
|
||||
|
||||
return {
|
||||
distribution,
|
||||
distributionLabel,
|
||||
showExternalSupportLink: distribution !== 'google-play',
|
||||
version,
|
||||
versionLabel: version ? `v${version} (${distributionLabel})` : `Unavailable (${distributionLabel})`,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user