add env constants

This commit is contained in:
pmigueld
2022-02-21 00:06:56 +08:00
parent 17ff0ed7c4
commit c43ee1b2f0
13 changed files with 52 additions and 47 deletions

35
app.config.ts Normal file
View File

@@ -0,0 +1,35 @@
export default {
name: 'MOSIP Resident App',
slug: 'mosip-resident-app',
version: '1.0.0',
orientation: 'portrait',
icon: './assets/icon.png',
splash: {
image: './assets/splash.png',
resizeMode: 'contain',
backgroundColor: '#ffffff',
},
updates: {
fallbackToCacheTimeout: 0,
},
assetBundlePatterns: ['**/*'],
ios: {
bundleIdentifier: 'io.mosip.residentapp',
buildNumber: '1.0.0',
supportsTablet: true,
},
android: {
package: 'io.mosip.residentapp',
versionCode: 1,
adaptiveIcon: {
foregroundImage: './assets/adaptive-icon.png',
backgroundColor: '#FFFFFF',
},
},
web: {
favicon: './assets/favicon.png',
},
extra: {
backendServiceUrl: process.env.BACKEND_SERVICE_URL,
},
};

View File

@@ -1,36 +0,0 @@
{
"expo": {
"name": "MOSIP Resident App",
"slug": "mosip-resident-app",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"bundleIdentifier": "io.mosip.residentapp",
"buildNumber": "1.0.0",
"supportsTablet": true
},
"android": {
"package": "io.mosip.residentapp",
"versionCode": 1,
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
}
},
"web": {
"favicon": "./assets/favicon.png"
}
}
}

View File

@@ -1,7 +1,7 @@
import { EventFrom, send, sendParent, StateFrom } from 'xstate';
import { createModel } from 'xstate/lib/model';
import { AppServices } from '../shared/GlobalContext';
import { ACTIVITY_LOG_STORE_KEY } from '../shared/storeKeys';
import { ACTIVITY_LOG_STORE_KEY } from '../shared/constants';
import { StoreEvents } from './store';
const model = createModel(

View File

@@ -12,7 +12,7 @@ import { AppServices } from '../shared/GlobalContext';
import {
RECEIVED_VIDS_STORE_KEY,
VID_ITEM_STORE_KEY,
} from '../shared/storeKeys';
} from '../shared/constants';
import { ActivityLogEvents } from './activityLog';
import { VidEvents } from './vid';

View File

@@ -9,7 +9,7 @@ import { getDeviceNameSync } from 'react-native-device-info';
import { VID } from '../types/vid';
import { AppServices } from '../shared/GlobalContext';
import { ActivityLogEvents } from './activityLog';
import { VID_ITEM_STORE_KEY } from '../shared/storeKeys';
import { VID_ITEM_STORE_KEY } from '../shared/constants';
const model = createModel(
{

View File

@@ -1,7 +1,7 @@
import { ContextFrom, EventFrom, send, sendUpdate, StateFrom } from 'xstate';
import { createModel } from 'xstate/lib/model';
import { AppServices } from '../shared/GlobalContext';
import { SETTINGS_STORE_KEY } from '../shared/storeKeys';
import { SETTINGS_STORE_KEY } from '../shared/constants';
import { VIDLabel } from '../types/vid';
import { StoreEvents } from './store';

View File

@@ -10,7 +10,7 @@ import {
MY_VIDS_STORE_KEY,
RECEIVED_VIDS_STORE_KEY,
VID_ITEM_STORE_KEY,
} from '../shared/storeKeys';
} from '../shared/constants';
const model = createModel(
{

View File

@@ -1,6 +1,6 @@
import { ActorRefFrom, ContextFrom, EventFrom, send, StateFrom } from 'xstate';
import { createModel } from 'xstate/lib/model';
import { VID_ITEM_STORE_KEY } from '../shared/storeKeys';
import { VID_ITEM_STORE_KEY } from '../shared/constants';
import { AppServices } from '../shared/GlobalContext';
import { CredentialDownloadResponse, request } from '../shared/request';
import { VID, VIDCredential, VIDVerifiableCredential } from '../types/vid';

View File

@@ -33,10 +33,10 @@
"react-native": "0.64.3",
"react-native-app-intro-slider": "^4.0.4",
"react-native-bluetooth-state-manager": "^1.3.2",
"react-native-idpass-smartshare": "^0.1.0",
"react-native-device-info": "^8.4.8",
"react-native-elements": "^3.4.2",
"react-native-gesture-handler": "~1.10.2",
"react-native-idpass-smartshare": "^0.1.0",
"react-native-keychain": "^8.0.0",
"react-native-location-enabler": "^4.1.0",
"react-native-qrcode-svg": "^6.1.1",
@@ -63,4 +63,4 @@
"private": true,
"name": "mosip-resident-app",
"version": "1.0.0"
}
}

View File

@@ -9,7 +9,7 @@ import {
import { log } from 'xstate/lib/actions';
import { createModel } from 'xstate/lib/model';
import { BackendResponseError, request } from '../../../shared/request';
import { VID_ITEM_STORE_KEY } from '../../../shared/storeKeys';
import { VID_ITEM_STORE_KEY } from '../../../shared/constants';
const model = createModel(
{

View File

@@ -16,7 +16,7 @@ import { AppServices } from '../../shared/GlobalContext';
import {
MY_VIDS_STORE_KEY,
ONBOARDING_STATUS_STORE_KEY,
} from '../../shared/storeKeys';
} from '../../shared/constants';
import { AddVidModalMachine } from './MyVids/AddVidModalMachine';
const model = createModel(

View File

@@ -1,3 +1,9 @@
import Constants from 'expo-constants';
export const HOST =
Constants.manifest.extra.backendServiceUrl ||
'https://resident-app.newlogic.dev';
export const MY_VIDS_STORE_KEY = 'myVids';
export const RECEIVED_VIDS_STORE_KEY = 'receivedVids';

View File

@@ -1,4 +1,4 @@
const HOST = 'https://resident-app.newlogic.dev';
import { HOST } from './constants';
export class BackendResponseError extends Error {
constructor(name: string, message: string) {