Skip to content

Commit 658a55b

Browse files
authored
feat(cordova-plugin-iroot): add plugin (#4857)
1 parent ac767ab commit 658a55b

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

docs/plugins/i-root/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# IRoot
2+
3+
```text
4+
$ ionic cordova plugin add cordova-plugin-iroot
5+
$ npm install @awesome-cordova-plugins/i-root
6+
```
7+
8+
## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/iroot/)
9+
10+
Plugin Repo: [https://github.com/WuglyakBolgoink/cordova-plugin-iroot](https://github.com/WuglyakBolgoink/cordova-plugin-iroot)
11+
12+
Use this plugin to add an extra layer of security for your app by detecting if the device was rooted (on android) or jailbreaked (on iOS).
13+
14+
## Supported platforms
15+
16+
* Android
17+
* iOS
18+
19+
## Original Plugin Notes
20+
21+
### iOS - Postinstall
22+
23+
To avoid errors like
24+
25+
> -canOpenURL: failed for URL: "cydia://package/com.example.package" - error: "This app is not allowed to query for scheme cydia"
26+
27+
don’t forget to add `"cydia"` in `LSApplicationQueriesSchemes` key of `info.plist`. Otherwise `canOpenURL` will always return `false`.
28+
29+
```xml
30+
<xxx>
31+
<key>LSApplicationQueriesSchemes</key>
32+
<array>
33+
<string>cydia</string>
34+
</array>
35+
</xxx>
36+
```
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { Injectable } from '@angular/core';
2+
import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core';
3+
4+
/**
5+
* @name IRoot
6+
* @description
7+
* Use this plugin to add an extra layer of security for your app by detecting if the device was rooted (on android) or jailbreaked (on iOS).
8+
*
9+
* @usage
10+
* ```typescript
11+
* import { IRoot } from '@awesome-cordova-plugins/i-root';
12+
*
13+
* constructor(private iRoot: IRoot) { }
14+
*
15+
* ...
16+
*
17+
* this.iRoot.isRooted()
18+
* .then((res: boolean) => console.log('is rooted?', res))
19+
* .catch((error: string) => console.error(error));
20+
*
21+
* this.iRoot.isRootedWithBusyBox()
22+
* .then((res: boolean) => console.log('is rooted?', res))
23+
* .catch((error: string) => console.error(error));
24+
* ```
25+
*/
26+
@Plugin({
27+
pluginName: 'IRoot',
28+
plugin: 'cordova-plugin-IRoot',
29+
pluginRef: 'IRoot',
30+
repo: 'https://github.com/WuglyakBolgoink/cordova-plugin-IRoot',
31+
platforms: ['Android', 'iOS'],
32+
})
33+
@Injectable()
34+
export class IRoot extends AwesomeCordovaNativePlugin {
35+
/**
36+
* Checks if the device is rooted/jailbroken.
37+
* @return {Promise<boolean>} Resolves to true if the device is Jailbroken/rooted, otherwise false.
38+
*/
39+
@Cordova()
40+
isRooted(): Promise<boolean> {
41+
return;
42+
}
43+
44+
/**
45+
* Android only! Checks if the device was rooted via busybox.
46+
* @return {Promise<boolean>} Resolves to true if the device is Jailbroken/rooted, otherwise false.
47+
*/
48+
@Cordova({
49+
platforms: ['android'],
50+
})
51+
isRootedWithBusyBox(): Promise<boolean> {
52+
return;
53+
}
54+
}

0 commit comments

Comments
 (0)