Skip to content

Commit

Permalink
chore: updated react-native patch to include react-native-mmkv and us…
Browse files Browse the repository at this point in the history
…e it
  • Loading branch information
andreabadesso committed Apr 11, 2024
1 parent f45e436 commit 218e722
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions patches/react-native+0.72.5.patch
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
diff --git a/node_modules/react-native/Libraries/Core/InitializeCore.js b/node_modules/react-native/Libraries/Core/InitializeCore.js
index 25377f6..b0dd11d 100644
index 25377f6..ae30ee4 100644
--- a/node_modules/react-native/Libraries/Core/InitializeCore.js
+++ b/node_modules/react-native/Libraries/Core/InitializeCore.js
@@ -24,6 +24,37 @@
@@ -24,6 +24,45 @@

'use strict';

+const Platform = require('../Utilities/Platform');
+import { MMKV } from 'react-native-mmkv';
+
+const storage = new MMKV();
+let isSesEnabled = storage.getBoolean('should-enable-ses');
+
+// Enable SES by default
+if (isSesEnabled === undefined) {
+ isSesEnabled = true;
+ storage.set('should-enable-ses', true);
+}
+
+const IS_LOCKDOWN_ENABLED = true;
+const Platform = require('../Utilities/Platform');
+
+// This piece of code was taken from this PR: https://github.com/MetaMask/metamask-mobile/pull/6586/files
+// which is the reference implementation of SES On react-native
+if (IS_LOCKDOWN_ENABLED && Platform.OS === 'ios' && !global?.HermesInternal) {
+if (isSesEnabled && Platform.OS === 'ios' && !global?.HermesInternal) {
+ require('../../../../lockdown.umd.js');
+
+ /**
Expand All @@ -35,7 +44,6 @@ index 25377f6..b0dd11d 100644
+
+ hardenIntrinsics();
+}
+
+
const start = Date.now();

Expand Down

0 comments on commit 218e722

Please sign in to comment.