Skip to content

Commit

Permalink
Revert "#1201 | Use crypto.randomUUID to generate random v4 uuids"
Browse files Browse the repository at this point in the history
This reverts commit 9aac1b8.
  • Loading branch information
1t5j0y committed Nov 28, 2023
1 parent 9aac1b8 commit a578af1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 23 deletions.
20 changes: 0 additions & 20 deletions packages/openchs-android/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/openchs-android/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
"react-native-keep-awake": "^4.0.0",
"react-native-keychain": "^8.1.1",
"react-native-mime-types": "2.3.0",
"react-native-random-uuid": "^0.1.4",
"react-native-randombytes": "^3.6.1",
"react-native-restart": "0.0.24",
"react-native-safe-area-context": "4.3.1",
Expand Down
7 changes: 5 additions & 2 deletions packages/openchs-android/src/utility/General.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {Concept, Duration, Observation} from 'avni-models';
import _ from 'lodash';
import moment from "moment";
import EnvironmentConfig from "../framework/EnvironmentConfig";
import 'react-native-random-uuid'

let currentLogLevel;

Expand Down Expand Up @@ -179,8 +178,12 @@ class General {
return dest;
}

//http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
static randomUUID() {
return crypto.randomUUID();
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
const r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}

static objectsShallowEquals(a: Object, b: Object): Boolean {
Expand Down

0 comments on commit a578af1

Please sign in to comment.