chore: include privacy policy in app
This commit is contained in:
@@ -13,11 +13,27 @@ module.exports = (async () => {
|
|||||||
} = await getDefaultConfig();
|
} = await getDefaultConfig();
|
||||||
return {
|
return {
|
||||||
transformer: {
|
transformer: {
|
||||||
babelTransformerPath: require.resolve('react-native-svg-transformer')
|
babelTransformerPath: require.resolve('./scripts/transformer.js'),
|
||||||
},
|
},
|
||||||
resolver: {
|
resolver: {
|
||||||
assetExts: assetExts.filter(ext => ext !== 'svg'),
|
assetExts: [
|
||||||
sourceExts: [...sourceExts, 'svg']
|
...assetExts.filter((ext) => ext !== 'svg'),
|
||||||
}
|
],
|
||||||
|
sourceExts: [
|
||||||
|
...sourceExts,
|
||||||
|
'svg',
|
||||||
|
'md'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
['content-transformer', {
|
||||||
|
transformers: [
|
||||||
|
{
|
||||||
|
file: /\.md$/,
|
||||||
|
format: 'string'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}],
|
||||||
|
]
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|||||||
24
scripts/transformer.js
Normal file
24
scripts/transformer.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
const upstreamTransformer = require('metro-react-native-babel-transformer');
|
||||||
|
const svgTransformer = require('react-native-svg-transformer');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Since we are using multiple types of transformers for Metro, we need to chain
|
||||||
|
* them into a single transform unit.
|
||||||
|
*/
|
||||||
|
module.exports.transform = function({ src, filename, options }) {
|
||||||
|
// GUARD: Pass SVGs onto react-native-svg-transformer
|
||||||
|
if (filename.endsWith('.svg')) {
|
||||||
|
return svgTransformer.transform({ src, filename, options });
|
||||||
|
// GUARD: Catch markdown files
|
||||||
|
} else if (filename.endsWith('.md')) {
|
||||||
|
const parsedString = src.replaceAll(/(?<!\n)\r?\n(?!\r?\n)/g, '');
|
||||||
|
return upstreamTransformer.transform({
|
||||||
|
src: `const content = ${JSON.stringify(parsedString)}; export default content;`,
|
||||||
|
filename,
|
||||||
|
options,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Pass any remaining files onto the regular Metro transformer
|
||||||
|
return upstreamTransformer.transform({ src, filename, options });
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -69,5 +69,6 @@
|
|||||||
"color-scheme-system": "System",
|
"color-scheme-system": "System",
|
||||||
"color-scheme-light": "Light Mode",
|
"color-scheme-light": "Light Mode",
|
||||||
"color-scheme-dark": "Dark Mode",
|
"color-scheme-dark": "Dark Mode",
|
||||||
"artists": "Artists"
|
"artists": "Artists",
|
||||||
|
"privacy-policy": "Privacy Policy"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,4 +67,5 @@ export type LocaleKeys = 'play-next'
|
|||||||
| 'color-scheme-system'
|
| 'color-scheme-system'
|
||||||
| 'color-scheme-light'
|
| 'color-scheme-light'
|
||||||
| 'color-scheme-dark'
|
| 'color-scheme-dark'
|
||||||
| 'artists'
|
| 'artists'
|
||||||
|
| 'privacy-policy'
|
||||||
|
|||||||
17
src/screens/Settings/components/PrivacyPolicy.tsx
Normal file
17
src/screens/Settings/components/PrivacyPolicy.tsx
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import styled from 'styled-components/native';
|
||||||
|
import { Paragraph } from 'components/Typography';
|
||||||
|
import { SafeScrollView } from 'components/SafeNavigatorView';
|
||||||
|
import policy from '../../../../docs/privacy-policy.md';
|
||||||
|
|
||||||
|
const Container = styled(SafeScrollView)`
|
||||||
|
padding: 24px;
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default function PrivacyPolicy() {
|
||||||
|
return (
|
||||||
|
<Container>
|
||||||
|
<Paragraph>{policy}</Paragraph>
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -15,6 +15,7 @@ import Library from './stacks/Library';
|
|||||||
import ColorScheme from './stacks/ColorScheme';
|
import ColorScheme from './stacks/ColorScheme';
|
||||||
import PlaybackReporting from './stacks/PlaybackReporting';
|
import PlaybackReporting from './stacks/PlaybackReporting';
|
||||||
import { SafeScrollView } from 'components/SafeNavigatorView';
|
import { SafeScrollView } from 'components/SafeNavigatorView';
|
||||||
|
import PrivacyPolicy from './components/PrivacyPolicy';
|
||||||
|
|
||||||
export function SettingsList() {
|
export function SettingsList() {
|
||||||
const navigation = useNavigation<SettingsNavigationProp>();
|
const navigation = useNavigation<SettingsNavigationProp>();
|
||||||
@@ -23,6 +24,7 @@ export function SettingsList() {
|
|||||||
const handleSentryClick = useCallback(() => { navigation.navigate('Sentry'); }, [navigation]);
|
const handleSentryClick = useCallback(() => { navigation.navigate('Sentry'); }, [navigation]);
|
||||||
const handlePlaybackReportingClick = useCallback(() => { navigation.navigate('Playback Reporting'); }, [navigation]);
|
const handlePlaybackReportingClick = useCallback(() => { navigation.navigate('Playback Reporting'); }, [navigation]);
|
||||||
const handleColorSchemeClick = useCallback(() => { navigation.navigate('Color Scheme'); }, [navigation]);
|
const handleColorSchemeClick = useCallback(() => { navigation.navigate('Color Scheme'); }, [navigation]);
|
||||||
|
const handlePrivacyPolicyClick = useCallback(() => { navigation.navigate('PrivacyPolicy'); }, [navigation]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeScrollView>
|
<SafeScrollView>
|
||||||
@@ -31,6 +33,7 @@ export function SettingsList() {
|
|||||||
<ListButton onPress={handleSentryClick}>{t('error-reporting')}</ListButton>
|
<ListButton onPress={handleSentryClick}>{t('error-reporting')}</ListButton>
|
||||||
<ListButton onPress={handlePlaybackReportingClick}>{t('playback-reporting')}</ListButton>
|
<ListButton onPress={handlePlaybackReportingClick}>{t('playback-reporting')}</ListButton>
|
||||||
<ListButton onPress={handleColorSchemeClick}>{t('color-scheme')}</ListButton>
|
<ListButton onPress={handleColorSchemeClick}>{t('color-scheme')}</ListButton>
|
||||||
|
<ListButton onPress={handlePrivacyPolicyClick}>{t('privacy-policy')}</ListButton>
|
||||||
</SafeScrollView>
|
</SafeScrollView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -53,6 +56,7 @@ export default function Settings() {
|
|||||||
<Stack.Screen name="Sentry" component={Sentry} options={{ headerTitle: t('error-reporting') }} />
|
<Stack.Screen name="Sentry" component={Sentry} options={{ headerTitle: t('error-reporting') }} />
|
||||||
<Stack.Screen name="Playback Reporting" component={PlaybackReporting} options={{ headerTitle: t('playback-reporting')}} />
|
<Stack.Screen name="Playback Reporting" component={PlaybackReporting} options={{ headerTitle: t('playback-reporting')}} />
|
||||||
<Stack.Screen name="Color Scheme" component={ColorScheme} options={{ headerTitle: t('color-scheme')}} />
|
<Stack.Screen name="Color Scheme" component={ColorScheme} options={{ headerTitle: t('color-scheme')}} />
|
||||||
|
<Stack.Screen name="PrivacyPolicy" component={PrivacyPolicy} options={{ headerTitle: t('privacy-policy') }} />
|
||||||
</Stack.Navigator>
|
</Stack.Navigator>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
4
src/typings/md.d.ts
vendored
Normal file
4
src/typings/md.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
declare module '*.md' {
|
||||||
|
const content: string;
|
||||||
|
export default content;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user