forked from digitalfabrik/integreat-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildConfig.ts
73 lines (66 loc) · 3.12 KB
/
buildConfig.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// @ts-expect-error This module does not really exist but is instead proxied by the metro.config.js
// to the directory in the corresponding build config to allow passing the selected build config to the runtime code.
// More information can be found in native/docs/build-configs.md#technical-information
import name from 'build-config-name'
import { SvgProps } from 'react-native-svg'
import loadBuildConfig, { COMMON } from 'build-configs'
import { INTEGREAT_ASSETS, MALTE_ASSETS, ASCHAFFENBURG_ASSETS } from 'build-configs/AssetsType'
import { CommonBuildConfigType } from 'build-configs/BuildConfigType'
import aschaffenburgLoadingImage from 'build-configs/aschaffenburg/assets/app-icon-inverted.svg'
import aschaffenburgAppIcon from 'build-configs/aschaffenburg/assets/app-icon-round.svg'
import integreatLoadingImage from 'build-configs/integreat/assets/app-icon-inverted.svg'
import integreatAppIcon from 'build-configs/integreat/assets/app-icon-round.svg'
import integreatCityNotCooperatingIcon from 'build-configs/integreat/assets/city-not-cooperating.svg'
import integreatIntroEventsIcon from 'build-configs/integreat/assets/intro-slides/Events.svg'
import integreatIntroLanguageIcon from 'build-configs/integreat/assets/intro-slides/Language.svg'
import integreatIntroSearchIcon from 'build-configs/integreat/assets/intro-slides/Search.svg'
import malteLoadingImage from 'build-configs/malte/assets/app-icon-circle.svg'
import malteAppIcon from 'build-configs/malte/assets/app-icon-round.svg'
import malteIntroEventsIcon from 'build-configs/malte/assets/intro-slides/Events.svg'
import malteIntroLanguageIcon from 'build-configs/malte/assets/intro-slides/Language.svg'
import malteIntroSearchIcon from 'build-configs/malte/assets/intro-slides/Search.svg'
type AssetsType = {
AppIcon: React.JSXElementConstructor<SvgProps>
LoadingImage: React.JSXElementConstructor<SvgProps>
CityNotCooperatingIcon?: React.JSXElementConstructor<SvgProps>
intro?: {
Events: React.JSXElementConstructor<SvgProps>
Language: React.JSXElementConstructor<SvgProps>
Search: React.JSXElementConstructor<SvgProps>
}
}
const buildConfig = (): CommonBuildConfigType => loadBuildConfig(name, COMMON)
export const buildConfigAssets = (): AssetsType => {
const assetsName = buildConfig().assets
if (assetsName === INTEGREAT_ASSETS) {
return {
AppIcon: integreatAppIcon,
LoadingImage: integreatLoadingImage,
CityNotCooperatingIcon: integreatCityNotCooperatingIcon,
intro: {
Events: integreatIntroEventsIcon,
Language: integreatIntroLanguageIcon,
Search: integreatIntroSearchIcon,
},
}
}
if (assetsName === MALTE_ASSETS) {
return {
AppIcon: malteAppIcon,
LoadingImage: malteLoadingImage,
intro: {
Events: malteIntroEventsIcon,
Language: malteIntroLanguageIcon,
Search: malteIntroSearchIcon,
},
}
}
if (assetsName === ASCHAFFENBURG_ASSETS) {
return {
AppIcon: aschaffenburgAppIcon,
LoadingImage: aschaffenburgLoadingImage,
}
}
throw new Error(`Unknown icon set ${assetsName}. Check your build config!`)
}
export default buildConfig