Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .yarn/patches/jail-monkey-npm-2.8.0-77e4d06b40.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
diff --git a/android/src/main/java/com/gantix/JailMonkey/JailMonkeyModule.java b/android/src/main/java/com/gantix/JailMonkey/JailMonkeyModule.java
index 018d7051a57a2250c738e018ba8e1518d1b9525a..e89a135c10edc50174315c5cf0a3c9871fe65e6a 100644
--- a/android/src/main/java/com/gantix/JailMonkey/JailMonkeyModule.java
+++ b/android/src/main/java/com/gantix/JailMonkey/JailMonkeyModule.java
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you also drop a quick comment in packages/core-mobile/docs/patches.md about this patch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -74,11 +74,7 @@ public class JailMonkeyModule extends ReactContextBaseJavaModule {
final Map<String, Object> constants = new HashMap<>();

constants.put("isJailBroken", rootedCheck.isJailBroken());
- constants.put("rootedDetectionMethods", rootedCheck.getResultByDetectionMethod());
- constants.put("hookDetected", hookDetected(context));
- constants.put("canMockLocation", isMockLocationOn(context));
- constants.put("isOnExternalStorage", isOnExternalStorage(context));
- constants.put("AdbEnabled", AdbEnabled(context));
return constants;
}
}
+
diff --git a/android/src/main/java/com/gantix/JailMonkey/Rooted/RootedCheck.java b/android/src/main/java/com/gantix/JailMonkey/Rooted/RootedCheck.java
index bf75f27fd11293205bf6d58de4f8069ea0a155fe..2151858623d5be0f58aa752a1d8b16bafc133dd0 100644
--- a/android/src/main/java/com/gantix/JailMonkey/Rooted/RootedCheck.java
+++ b/android/src/main/java/com/gantix/JailMonkey/Rooted/RootedCheck.java
@@ -4,6 +4,7 @@ import android.content.Context;
import com.scottyab.rootbeer.RootBeer;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.CountDownLatch;

public class RootedCheck {
private static boolean checkWithJailMonkeyMethod() {
@@ -17,12 +18,23 @@ public class RootedCheck {
return check.checkRooted();
}

- private final boolean jailMonkeyResult;
- private final RootBeerResults rootBeerResults;
+ private static boolean jailMonkeyResult;
+ private static RootBeerResults rootBeerResults;
+ private static CountDownLatch latch = new CountDownLatch(1);
+ public static void precompute(Context context) {
+ new Thread(() -> {
+ jailMonkeyResult = checkWithJailMonkeyMethod();
+ rootBeerResults = new RootBeerResults(context);
+ latch.countDown();
+ }).start();
+ }

public RootedCheck(Context context) {
- jailMonkeyResult = checkWithJailMonkeyMethod();
- rootBeerResults = new RootBeerResults(context);
+ try {
+ latch.await();
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
}

public boolean isJailBroken() {
@@ -87,3 +99,4 @@ public class RootedCheck {
}
}
}
+
6 changes: 3 additions & 3 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
checksumBehavior: update

enableScripts: false

enableTelemetry: false
Expand All @@ -6,12 +8,10 @@ nmHoistingLimits: workspaces

nmSelfReferences: false

checksumBehavior: update

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: '@yarnpkg/plugin-workspace-tools'
spec: "@yarnpkg/plugin-workspace-tools"

yarnPath: .yarn/releases/yarn-3.6.4.cjs
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
"@scure/bip39/@noble/hashes": "1.8.0",
"@scure/btc-signer/@noble/hashes": "1.8.0",
"[email protected]": "4.17.21",
"@ledgerhq/hw-transport": "6.31.0"
"@ledgerhq/hw-transport": "6.31.0",
"[email protected]": "patch:jail-monkey@npm%3A2.8.0#./.yarn/patches/jail-monkey-npm-2.8.0-77e4d06b40.patch"
},
"engines": {
"node": ">=20.18.0",
Expand Down
7 changes: 6 additions & 1 deletion packages/core-mobile/docs/patches.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,9 @@ You can wrap a toast container with a custom wrapper.
...
</>

// In order to display a toast over a native-stack modal, use [FullWindowOverlay component](https://github.com/software-mansion/react-native-screens?tab=readme-ov-file#fullwindowoverlay).
// In order to display a toast over a native-stack modal, use [FullWindowOverlay component](https://github.com/software-mansion/react-native-screens?tab=readme-ov-file#fullwindowoverlay).
```

### jail-monkey

We patched this to precompute constants so we don't block js thread when whe check if phone is rooted.
9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -22949,6 +22949,13 @@ __metadata:
languageName: node
linkType: hard

"jail-monkey@patch:jail-monkey@npm%3A2.8.0#./.yarn/patches/jail-monkey-npm-2.8.0-77e4d06b40.patch::locator=mobile-monorepo%40workspace%3A.":
version: 2.8.0
resolution: "jail-monkey@patch:jail-monkey@npm%3A2.8.0#./.yarn/patches/jail-monkey-npm-2.8.0-77e4d06b40.patch::version=2.8.0&hash=225a6a&locator=mobile-monorepo%40workspace%3A."
checksum: c5caacdc4a38dcdd45209f55c3376d39cd2ea7ae788f90e4bdb270838cb8f13c1b5001a79cd7c6f1ed7f0d462c9ef2d0fbc959e1e48a26dff4dd9aa7ab9ab4f4
languageName: node
linkType: hard

"jake@npm:^10.8.5":
version: 10.9.2
resolution: "jake@npm:10.9.2"
Expand Down Expand Up @@ -28746,7 +28753,7 @@ react-native-webview@ava-labs/react-native-webview:
peerDependencies:
react: "*"
react-native: "*"
checksum: 44ee8c8ebc4dc4d3423e9045e1aebac31829eb518824e24f41b2bd10ab1e8343e824e9d912f259bfec7bfa798e96513cc05dbdcdf36087b2a43806f74a3b0fa2
checksum: df3e07107bec2bab08ffe837b81a8e9d4b8f8a3940833dead94a6d994aa38253cfd5d4d9484ad24efe3bf2b89a6697fd6bf0750785e168b58f5ed5f74ff8383a
languageName: node
linkType: hard

Expand Down