@brucewayne1939/sword-security 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,7 +13,7 @@ public class SecurityPlugin extends Plugin {
13
13
  private Security implementation = new Security();
14
14
 
15
15
  @PluginMethod
16
- public void isDeveloperModeEnabled(PluginCall call) {
16
+ public void isDeveloperModeEnabled(PluginCall call) {
17
17
 
18
18
  boolean enabled =
19
19
  Settings.Global.getInt(
@@ -28,16 +28,38 @@ public class SecurityPlugin extends Plugin {
28
28
  call.resolve(ret);
29
29
  }
30
30
 
31
- @PluginMethod
32
- public void isRooted(PluginCall call) {
31
+ @PluginMethod
32
+ public void isRooted(PluginCall call) {
33
33
 
34
- boolean rooted = checkRootMethod1() || checkRootMethod2();
34
+ boolean rooted = checkRootMethod1() || checkRootMethod2();
35
35
 
36
- JSObject ret = new JSObject();
37
- ret.put("rooted", rooted);
36
+ JSObject ret = new JSObject();
37
+ ret.put("rooted", rooted);
38
38
 
39
- call.resolve(ret);
40
- }
39
+ call.resolve(ret);
40
+ }
41
+
42
+ private boolean isUsbDebuggingEnabled() {
43
+
44
+ return Settings.Global.getInt(
45
+ getContext().getContentResolver(),
46
+ Settings.Global.ADB_ENABLED,
47
+ 0
48
+ ) == 1;
49
+ }
50
+
51
+ @PluginMethod
52
+ public void openDeveloperSettings(PluginCall call) {
53
+
54
+ Intent intent =
55
+ new Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS);
56
+
57
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
58
+
59
+ getContext().startActivity(intent);
60
+
61
+ call.resolve();
62
+ }
41
63
 
42
64
  private boolean checkRootMethod1() {
43
65
  String buildTags = android.os.Build.TAGS;
@@ -5,4 +5,5 @@ export interface SecurityPlugin {
5
5
  isRooted(): Promise<{
6
6
  rooted: boolean;
7
7
  }>;
8
+ openDeveloperSettings(): Promise<void>;
8
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface SecurityPlugin {\n isDeveloperModeEnabled(): Promise<{ enabled: boolean }>;\n isRooted(): Promise<{ rooted: boolean }>;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface SecurityPlugin {\n isDeveloperModeEnabled(): Promise<{ enabled: boolean }>;\n isRooted(): Promise<{ rooted: boolean }>;\n openDeveloperSettings(): Promise<void>;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -7,4 +7,5 @@ export declare class SecurityWeb extends WebPlugin implements SecurityPlugin {
7
7
  isRooted(): Promise<{
8
8
  rooted: boolean;
9
9
  }>;
10
+ openDeveloperSettings(): Promise<void>;
10
11
  }
package/dist/esm/web.js CHANGED
@@ -8,5 +8,8 @@ export class SecurityWeb extends WebPlugin {
8
8
  // Web implementation - rooting is not applicable on web
9
9
  return { rooted: false };
10
10
  }
11
+ async openDeveloperSettings() {
12
+ console.warn('Not supported on web');
13
+ }
11
14
  }
12
15
  //# sourceMappingURL=web.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,WAAY,SAAQ,SAAS;IACxC,KAAK,CAAC,sBAAsB;QAC1B,kEAAkE;QAClE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,wDAAwD;QACxD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC3B,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { SecurityPlugin } from './definitions';\n\nexport class SecurityWeb extends WebPlugin implements SecurityPlugin {\n async isDeveloperModeEnabled(): Promise<{ enabled: boolean }> {\n // Web implementation - developer mode is typically not applicable\n return { enabled: false };\n }\n\n async isRooted(): Promise<{ rooted: boolean }> {\n // Web implementation - rooting is not applicable on web\n return { rooted: false };\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,WAAY,SAAQ,SAAS;IACxC,KAAK,CAAC,sBAAsB;QAC1B,kEAAkE;QAClE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,wDAAwD;QACxD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,qBAAqB;QACzB,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IACvC,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { SecurityPlugin } from './definitions';\n\nexport class SecurityWeb extends WebPlugin implements SecurityPlugin {\n async isDeveloperModeEnabled(): Promise<{ enabled: boolean }> {\n // Web implementation - developer mode is typically not applicable\n return { enabled: false };\n }\n\n async isRooted(): Promise<{ rooted: boolean }> {\n // Web implementation - rooting is not applicable on web\n return { rooted: false };\n }\n\n async openDeveloperSettings(): Promise<void> {\n console.warn('Not supported on web');\n }\n}\n"]}
@@ -15,6 +15,9 @@ class SecurityWeb extends core.WebPlugin {
15
15
  // Web implementation - rooting is not applicable on web
16
16
  return { rooted: false };
17
17
  }
18
+ async openDeveloperSettings() {
19
+ console.warn('Not supported on web');
20
+ }
18
21
  }
19
22
 
20
23
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Security = registerPlugin('Security', {\n web: () => import('./web').then((m) => new m.SecurityWeb()),\n});\nexport * from './definitions';\nexport { Security };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class SecurityWeb extends WebPlugin {\n async isDeveloperModeEnabled() {\n // Web implementation - developer mode is typically not applicable\n return { enabled: false };\n }\n async isRooted() {\n // Web implementation - rooting is not applicable on web\n return { rooted: false };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,QAAQ,GAAGA,mBAAc,CAAC,UAAU,EAAE;AAC5C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;AAC/D,CAAC;;ACFM,MAAM,WAAW,SAASC,cAAS,CAAC;AAC3C,IAAI,MAAM,sBAAsB,GAAG;AACnC;AACA,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;AACjC,IAAI;AACJ,IAAI,MAAM,QAAQ,GAAG;AACrB;AACA,QAAQ,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE;AAChC,IAAI;AACJ;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Security = registerPlugin('Security', {\n web: () => import('./web').then((m) => new m.SecurityWeb()),\n});\nexport * from './definitions';\nexport { Security };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class SecurityWeb extends WebPlugin {\n async isDeveloperModeEnabled() {\n // Web implementation - developer mode is typically not applicable\n return { enabled: false };\n }\n async isRooted() {\n // Web implementation - rooting is not applicable on web\n return { rooted: false };\n }\n async openDeveloperSettings() {\n console.warn('Not supported on web');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,QAAQ,GAAGA,mBAAc,CAAC,UAAU,EAAE;AAC5C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;AAC/D,CAAC;;ACFM,MAAM,WAAW,SAASC,cAAS,CAAC;AAC3C,IAAI,MAAM,sBAAsB,GAAG;AACnC;AACA,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;AACjC,IAAI;AACJ,IAAI,MAAM,QAAQ,GAAG;AACrB;AACA,QAAQ,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE;AAChC,IAAI;AACJ,IAAI,MAAM,qBAAqB,GAAG;AAClC,QAAQ,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC;AAC5C,IAAI;AACJ;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -14,6 +14,9 @@ var capacitorExample = (function (exports, core) {
14
14
  // Web implementation - rooting is not applicable on web
15
15
  return { rooted: false };
16
16
  }
17
+ async openDeveloperSettings() {
18
+ console.warn('Not supported on web');
19
+ }
17
20
  }
18
21
 
19
22
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Security = registerPlugin('Security', {\n web: () => import('./web').then((m) => new m.SecurityWeb()),\n});\nexport * from './definitions';\nexport { Security };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class SecurityWeb extends WebPlugin {\n async isDeveloperModeEnabled() {\n // Web implementation - developer mode is typically not applicable\n return { enabled: false };\n }\n async isRooted() {\n // Web implementation - rooting is not applicable on web\n return { rooted: false };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,QAAQ,GAAGA,mBAAc,CAAC,UAAU,EAAE;IAC5C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IAC/D,CAAC;;ICFM,MAAM,WAAW,SAASC,cAAS,CAAC;IAC3C,IAAI,MAAM,sBAAsB,GAAG;IACnC;IACA,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IACjC,IAAI;IACJ,IAAI,MAAM,QAAQ,GAAG;IACrB;IACA,QAAQ,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE;IAChC,IAAI;IACJ;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Security = registerPlugin('Security', {\n web: () => import('./web').then((m) => new m.SecurityWeb()),\n});\nexport * from './definitions';\nexport { Security };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class SecurityWeb extends WebPlugin {\n async isDeveloperModeEnabled() {\n // Web implementation - developer mode is typically not applicable\n return { enabled: false };\n }\n async isRooted() {\n // Web implementation - rooting is not applicable on web\n return { rooted: false };\n }\n async openDeveloperSettings() {\n console.warn('Not supported on web');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,QAAQ,GAAGA,mBAAc,CAAC,UAAU,EAAE;IAC5C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IAC/D,CAAC;;ICFM,MAAM,WAAW,SAASC,cAAS,CAAC;IAC3C,IAAI,MAAM,sBAAsB,GAAG;IACnC;IACA,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IACjC,IAAI;IACJ,IAAI,MAAM,QAAQ,GAAG;IACrB;IACA,QAAQ,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE;IAChC,IAAI;IACJ,IAAI,MAAM,qBAAqB,GAAG;IAClC,QAAQ,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC;IAC5C,IAAI;IACJ;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brucewayne1939/sword-security",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "this plugin enables the app to use security features",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -77,4 +77,4 @@
77
77
  "src": "android"
78
78
  }
79
79
  }
80
- }
80
+ }