Skip to content

Commit 6a36ad1

Browse files
committed
Merge branch 'develop'
2 parents c3a9de2 + d1a2989 commit 6a36ad1

File tree

16 files changed

+95
-155
lines changed

16 files changed

+95
-155
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,37 @@ See [https://docs.msupply.foundation/en:cold_chain:start](https://docs.msupply.f
2222
- Install Android Studio and SDK tools: https://developer.android.com/studio.
2323
- Install SDKMAN for managing Java versions: https://sdkman.io/.
2424

25+
The application is using java v1.8 you may need to target a specific java version in order to run the app locally.
26+
2527
#### React Native
2628

2729
- Install nvm for managing Node versions: https://github.com/nvm-sh/nvm.
2830
- Install yarn for managing Node packages: https://yarnpkg.com/lang/en/.
2931
- Install React Native: https://reactnative.dev/docs/environment-setup. Follow the steps listed under "Building Projects with Native Code" and set Target OS as "Android".
3032

33+
The node version should be >= 12.8.4.
34+
3135
### Installing
3236

3337
- Clone the repo: `git clone https://github.com/openmsupply/mobile.git`.
3438
- Setup local node environment as specified in `.nvmrc`: `nvm install && nvm use`.
3539
- Install/update app dependencies: `yarn install`.
3640

41+
### Building
42+
43+
Simply run `yarn build` to build the app.
44+
If you have the following error:
45+
`A problem occurred starting process 'command 'node''`
46+
47+
try editing `android/app/build.gradle` and adding the `nodeExecutableAndArgs` value, specific to your environment:
48+
49+
```
50+
project.ext.react = [
51+
nodeExecutableAndArgs: ["/usr/local/bin/node"]
52+
...other entries
53+
]
54+
```
55+
3756
## Contributors
3857

3958
We welcome contributions from external developers!

android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ import groovy.json.JsonSlurper
8383
project.ext.react = [
8484
entryFile: "index.ts",
8585
enableHermes: true, // clean and rebuild if changing
86-
extraPackagerArgs: ['--minify=false']
87-
86+
extraPackagerArgs: ['--minify=false'],
87+
// nodeExecutableAndArgs: ["/usr/local/bin/node"]
8888
]
8989

9090
apply from: "../../node_modules/react-native/react.gradle"
-15.6 MB
Binary file not shown.
-2.2 KB
Binary file not shown.
99.8 KB
Binary file not shown.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mSupplyColdChain",
3-
"version": "0.5.3",
3+
"version": "0.5.4",
44
"description": "Cold chain temperature monitoring",
55
"author": "mSupply Foundation",
66
"main": "index.ts",
@@ -92,7 +92,7 @@
9292
"react-native-gesture-handler": "1.6.1",
9393
"react-native-linear-gradient": "^2.5.6",
9494
"react-native-localize": "1.4.0",
95-
"react-native-mail": "^6.1.0",
95+
"react-native-mail": "^6.1.1",
9696
"react-native-modal": "^11.10.0",
9797
"react-native-permissions": "^2.2.2",
9898
"react-native-pin-view": "^3.0.1",

src/common/constants/Setting.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ export const BLUETOOTH_SETTING = {
33
};
44

55
export const SYNC_SETTING = {
6-
AUTH_URL: 'authUrl',
6+
SERVER_URL: 'serverUrl',
77
AUTH_USERNAME: 'authUsername',
88
AUTH_PASSWORD: 'authPassword',
9-
SENSOR_URL: 'sensorUrl',
10-
TEMPERATURE_LOG_URL: 'temperatureLogUrl',
11-
TEMPERATURE_BREACH_URL: 'temperatureBreachUrl',
129
LAST_SYNC: 'lastSync',
1310
IS_PASSIVE_SYNC_ENABLED: 'isPassiveSyncEnabled',
1411
IS_INTEGRATING: 'isIntegrating',

src/common/translations/en.json

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,9 @@
8888
"CONNECTING": "Setting up sensor..",
8989
"AGO": "ago",
9090
"BETWEEN": "between",
91-
"LOGIN": "Login",
92-
"LOGIN_URL": "Login URL",
93-
"EDIT_LOGIN_URL": "Edit login URL",
94-
"SENSORS": "Sensors",
95-
"SENSOR_URL": "Sensor URL",
96-
"EDIT_SENSOR_URL": "Edit sensor URL",
97-
"TEMPERATURES": "Temperatures",
98-
"TEMPERATURE_URL": "Temperature URL",
99-
"EDIT_TEMPERATURE_URL": "Edit temperature URL",
100-
"TEMPERATURE_BREACHES": "Temperature Breaches",
101-
"TEMPERATURE_BREACHES_URL": "Temperature breaches URL",
102-
"EDIT_TEMPERATURE_BREACHES_URL": "Edit temperature breaches URL",
91+
"SERVER": "Server",
92+
"SERVER_URL": "Server URL",
93+
"EDIT_SERVER_URL": "Edit server URL (Enter just the server URL and port, if necessary. e.g. https://demo.msupply.org:8080)",
10394
"CREDENTIALS": "Store credentials",
10495
"USERNAME": "Username",
10596
"EDIT_USERNAME": "Edit username",

src/features/Entities/Setting/SettingManager.ts

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,9 @@ interface Setting {
99
}
1010

1111
const SettingKeys = [
12-
'authUrl',
12+
'serverUrl',
1313
'authUsername',
1414
'authPassword',
15-
'sensorUrl',
16-
'temperatureLogUrl',
17-
'temperatureBreachUrl',
1815
'lastSync',
1916
'isPassiveSyncEnabled',
2017
'isIntegrating',
@@ -24,25 +21,19 @@ const SettingKeys = [
2421
export type SettingKey = typeof SettingKeys[number];
2522

2623
export enum SettingType {
27-
authUrl = 'string',
24+
serverUrl = 'string',
2825
authUsername = 'string',
2926
authPassword = 'string',
30-
sensorUrl = 'string',
31-
temperatureLogUrl = 'string',
32-
temperatureBreachUrl = 'string',
3327
lastSync = 'number',
3428
defaultLogInterval = 'number',
3529
isPassiveSyncEnabled = 'bool',
3630
isIntegrating = 'bool',
3731
}
3832

3933
export interface SettingMap {
40-
authUrl: string;
34+
serverUrl: string;
4135
authUsername: string;
4236
authPassword: string;
43-
sensorUrl: string;
44-
temperatureLogUrl: string;
45-
temperatureBreachUrl: string;
4637
lastSync: number;
4738
isPassiveSyncEnabled: boolean;
4839
isIntegrating: boolean;
@@ -99,13 +90,11 @@ export class SettingManager {
9990
this.getSetting(key as SettingKey).then(result => ({ key, value: result }))
10091
);
10192
const settings = await Promise.all(getSettingPromises);
93+
10294
return settings.reduce((acc, value) => ({ ...acc, [value.key]: value.value }), {
103-
authUrl: '',
95+
serverUrl: '',
10496
authUsername: '',
10597
authPassword: '',
106-
sensorUrl: '',
107-
temperatureLogUrl: '',
108-
temperatureBreachUrl: '',
10998
lastSync: 0,
11099
isPassiveSyncEnabled: false,
111100
isIntegrating: false,
@@ -119,25 +108,13 @@ export class SettingManager {
119108
};
120109

121110
getSyncSettings = async (): Promise<SyncSettingMap> => {
122-
const {
123-
authUrl,
124-
authUsername,
125-
authPassword,
126-
sensorUrl,
127-
temperatureLogUrl,
128-
temperatureBreachUrl,
129-
lastSync,
130-
isPassiveSyncEnabled,
131-
isIntegrating,
132-
} = await this.getSettings();
111+
const { serverUrl, authUsername, authPassword, lastSync, isPassiveSyncEnabled, isIntegrating } =
112+
await this.getSettings();
133113

134114
return {
135-
authUrl,
115+
serverUrl,
136116
authUsername,
137117
authPassword,
138-
sensorUrl,
139-
temperatureLogUrl,
140-
temperatureBreachUrl,
141118
lastSync,
142119
isPassiveSyncEnabled,
143120
isIntegrating,

src/features/Entities/Setting/SettingSlice.ts

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,9 @@ type SettingStateShape = SettingMap;
1010

1111
const initialState: SettingStateShape = {
1212
defaultLogInterval: 0,
13-
authUrl: '',
13+
serverUrl: '',
1414
authUsername: '',
1515
authPassword: '',
16-
sensorUrl: '',
17-
temperatureLogUrl: '',
18-
temperatureBreachUrl: '',
1916
lastSync: 0,
2017
isPassiveSyncEnabled: false,
2118
isIntegrating: false,
@@ -73,6 +70,7 @@ const { actions: SettingAction, reducer: SettingReducer } = createSlice({
7370
const getSettings = (rootState: RootState): SettingStateShape => {
7471
const { entities } = rootState;
7572
const { setting } = entities;
73+
7674
return setting;
7775
};
7876

@@ -81,9 +79,9 @@ const getDefaultLogInterval = (rootState: RootState): number => {
8179
return defaultLogInterval;
8280
};
8381

84-
const getAuthUrl = (rootState: RootState): string => {
85-
const { authUrl } = getSettings(rootState);
86-
return authUrl;
82+
const getServerUrl = (rootState: RootState): string => {
83+
const { serverUrl } = getSettings(rootState);
84+
return serverUrl;
8785
};
8886

8987
const getAuthUsername = (rootState: RootState): string | null => {
@@ -96,30 +94,12 @@ const getAuthPassword = (rootState: RootState): string => {
9694
return authPassword;
9795
};
9896

99-
const getSensorUrl = (rootState: RootState): string => {
100-
const { sensorUrl } = getSettings(rootState);
101-
return sensorUrl;
102-
};
103-
104-
const getTemperatureLogUrl = (rootState: RootState): string => {
105-
const { temperatureLogUrl } = getSettings(rootState);
106-
return temperatureLogUrl;
107-
};
108-
109-
const getTemperatureBreachUrl = (rootState: RootState): string => {
110-
const { temperatureBreachUrl } = getSettings(rootState);
111-
return temperatureBreachUrl;
112-
};
113-
11497
const SettingSelector = {
11598
getSettings,
11699
getDefaultLogInterval,
117-
getAuthUrl,
100+
getServerUrl,
118101
getAuthUsername,
119102
getAuthPassword,
120-
getSensorUrl,
121-
getTemperatureLogUrl,
122-
getTemperatureBreachUrl,
123103
};
124104

125105
function* fetchAll(): SagaIterator {

0 commit comments

Comments
 (0)