app.config.ts 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. import 'dotenv/config';
  2. import path from 'path';
  3. import dotenv from 'dotenv';
  4. import type { ConfigContext, ExpoConfig } from 'expo/config';
  5. const { DEEP_LINK_PATHS } = require('./config/deepLinks');
  6. const env = process.env;
  7. const API_HOST = env.ENV === 'production' ? env.PRODUCTION_API_HOST : env.DEVELOPMENT_API_HOST;
  8. const MAP_HOST = env.ENV === 'production' ? env.PRODUCTION_MAP_HOST : env.DEVELOPMENT_MAP_HOST;
  9. const NM_API_HOST = env.NM_API_HOST;
  10. const GOOGLE_MAP_PLACES_APIKEY = env.GOOGLE_MAP_PLACES_APIKEY;
  11. const WEBSOCKET_URL =
  12. env.ENV === 'production' ? env.PRODUCTION_WEBSOCKET_URL : env.DEVELOPMENT_WEBSOCKET_URL;
  13. dotenv.config({
  14. path: path.resolve(process.cwd(), '.env')
  15. });
  16. const intentData = [
  17. ...DEEP_LINK_PATHS.map((pathPrefix: string) => ({
  18. scheme: 'https',
  19. host: 'nomadmania.com',
  20. pathPrefix,
  21. })),
  22. ...DEEP_LINK_PATHS.map((pathPrefix: string) => ({
  23. scheme: 'https',
  24. host: 'nomadmania.eu',
  25. pathPrefix,
  26. }))
  27. ];
  28. export default ({ config }: ConfigContext): ExpoConfig => ({
  29. ...config,
  30. name: 'NomadMania',
  31. slug: 'nomadmania-app',
  32. owner: 'nomadmaniaou',
  33. scheme: 'nm',
  34. // Should be updated after every production release (deploy to AppStore/PlayMarket)
  35. version: '2.0.62',
  36. // Should be updated after every dependency change
  37. runtimeVersion: '1.7',
  38. orientation: 'portrait',
  39. icon: './assets/icon-logo.png',
  40. userInterfaceStyle: 'light',
  41. extra: {
  42. ENV: env.ENV,
  43. API_HOST: API_HOST,
  44. MAP_HOST: MAP_HOST,
  45. GOOGLE_MAP_PLACES_APIKEY: GOOGLE_MAP_PLACES_APIKEY,
  46. WEBSOCKET_URL: WEBSOCKET_URL,
  47. VECTOR_MAP_HOST: env.VECTOR_MAP_HOST,
  48. eas: {
  49. projectId: env.EAS_PROJECT_ID
  50. }
  51. },
  52. experiments: {
  53. tsconfigPaths: true
  54. },
  55. splash: {
  56. image: './assets/splash-screen-world.png',
  57. resizeMode: 'cover',
  58. backgroundColor: '#ffffff'
  59. },
  60. androidStatusBar: {
  61. backgroundColor: '#00000000',
  62. translucent: true,
  63. barStyle: 'dark-content'
  64. },
  65. notification: {
  66. icon: './assets/notification-android-icon.png',
  67. color: '#FFFFFF'
  68. },
  69. updates: {
  70. url: 'https://u.expo.dev/c31c6828-3c32-4c7a-aabc-f9b8336b3b66'
  71. },
  72. platforms: ['ios', 'android'],
  73. assetBundlePatterns: ['**/*', 'assets/db/*.db'],
  74. ios: {
  75. supportsTablet: false,
  76. bundleIdentifier: env.PACKAGE_NAME_IOS, // com.nomadmania.app2
  77. config: {
  78. googleMapsApiKey: env.IOS_GOOGLE_MAP_APIKEY
  79. },
  80. associatedDomains: ['applinks:nomadmania.com', 'applinks:nomadmania.eu'],
  81. infoPlist: {
  82. UIBackgroundModes: ['location', 'fetch', 'remote-notification'],
  83. NSLocationAlwaysUsageDescription:
  84. 'NomadMania uses your location in the background so other users see your latest location and regions are marked as visited automatically.',
  85. NSPhotoLibraryUsageDescription:
  86. 'Enable NomadMania.com to access your photo library to upload your profile picture. Any violence, excess of nudity, stolen picture, or scam is forbidden',
  87. NSPhotoLibraryAddUsageDescription:
  88. 'Enable NomadMania.com to access your photo library to upload your profile picture. Any violence, excess of nudity, stolen picture, or scam is forbidden',
  89. NSPushNotificationsDescription:
  90. 'This will allow NomadMania.com to send you notifications. Also you can disable it in app settings',
  91. NSDocumentsFolderUsageDescription:
  92. 'Nomadmania app needs access to the documents folder to select files.',
  93. NSCameraUsageDescription: 'Nomadmania app needs access to the camera to record video.',
  94. NSLocationWhenInUseUsageDescription:
  95. 'NomadMania uses your location to show it to other users and to help mark regions as visited.',
  96. NSLocationAlwaysAndWhenInUseUsageDescription:
  97. 'NomadMania uses your location in the background so other users see your latest location and regions are marked as visited automatically.',
  98. LSApplicationQueriesSchemes: ['comgooglemaps']
  99. },
  100. privacyManifests: {
  101. NSPrivacyAccessedAPITypes: [
  102. {
  103. NSPrivacyAccessedAPIType: 'NSPrivacyAccessedAPICategoryUserDefaults',
  104. NSPrivacyAccessedAPITypeReasons: ['CA92.1']
  105. }
  106. ]
  107. }
  108. },
  109. android: {
  110. package: env.PACKAGE_NAME_ANDROID, // com.nomadmania.presentation
  111. config: {
  112. googleMaps: {
  113. apiKey: env.ANDROID_GOOGLE_MAP_APIKEY
  114. }
  115. },
  116. intentFilters: [
  117. {
  118. action: 'VIEW',
  119. data: intentData,
  120. category: ['BROWSABLE', 'DEFAULT']
  121. }
  122. ],
  123. googleServicesFile: './google-services.json',
  124. permissions: [
  125. 'ACCESS_BACKGROUND_LOCATION',
  126. 'ACCESS_FINE_LOCATION',
  127. 'ACCESS_COARSE_LOCATION',
  128. 'READ_EXTERNAL_STORAGE',
  129. 'WRITE_EXTERNAL_STORAGE',
  130. 'NOTIFICATIONS',
  131. 'USER_FACING_NOTIFICATIONS',
  132. 'INTERNET',
  133. 'CAMERA',
  134. 'MODIFY_AUDIO_SETTINGS'
  135. ],
  136. splash: {
  137. backgroundColor: '#ffffff',
  138. imageWidth: 200,
  139. image: './assets/icon-logo.png',
  140. resizeMode: 'contain'
  141. },
  142. versionCode: 124 // 2.0.62, last version sent to Google is 123 (2.0.61)
  143. },
  144. plugins: [
  145. [
  146. 'expo-image-picker',
  147. {
  148. photosPermission: 'Allow NomadMania.com access to your photo library to upload photos.',
  149. cameraPermission: 'Allow NomadMania.com access to your camera to upload photos directly.'
  150. }
  151. ],
  152. [
  153. 'expo-build-properties',
  154. {
  155. ios: {
  156. newArchEnabled: true,
  157. deploymentTarget: '15.1'
  158. },
  159. android: {
  160. minSdkVersion: 24,
  161. targetSdkVersion: 36
  162. // kotlinVersion: '1.7.1'
  163. }
  164. }
  165. ],
  166. [
  167. '@sentry/react-native/expo',
  168. {
  169. organization: env.SENTRY_ORG,
  170. note: 'Use SENTRY_AUTH_TOKEN env to authenticate with Sentry.',
  171. project: env.SENTRY_PROJECT,
  172. url: 'https://sentry.io/'
  173. }
  174. ],
  175. [
  176. 'expo-asset',
  177. {
  178. assets: [
  179. './assets/db/nmRegions.db',
  180. './assets/db/darePlaces.db',
  181. './assets/db/nmCountries.db'
  182. ]
  183. }
  184. ],
  185. 'expo-font',
  186. [
  187. 'expo-audio',
  188. {
  189. microphonePermission: 'Allow Nomadmania to access your microphone.'
  190. }
  191. ],
  192. [
  193. 'expo-video',
  194. {
  195. supportsBackgroundPlayback: true,
  196. supportsPictureInPicture: true
  197. }
  198. ],
  199. ['@maplibre/maplibre-react-native'],
  200. [
  201. 'expo-location',
  202. {
  203. isIosBackgroundLocationEnabled: true,
  204. isAndroidBackgroundLocationEnabled: false
  205. }
  206. ],
  207. 'react-native-compressor'
  208. ]
  209. });