@capgo/capacitor-sim 7.0.8 → 7.1.0

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.
package/README.md CHANGED
@@ -123,6 +123,10 @@ A SIM card description.
123
123
  | **`mobileCountryCode`** | <code>string</code> | Mobile Country Code (MCC) of the service provider. On iOS 16.4+ the system may return placeholder values such as `65535`. See https://github.com/jonz94/capacitor-sim/issues/8 for details. | 1.0.0 |
124
124
  | **`mobileNetworkCode`** | <code>string</code> | Mobile Network Code (MNC) of the service provider. On iOS 16.4+ the system may return placeholder values such as `65535`. See https://github.com/jonz94/capacitor-sim/issues/8 for details. | 1.0.0 |
125
125
 
126
+ | Method | Signature | Description |
127
+ | -------------------- | -------------------------------------------- | --------------------------------------- |
128
+ | **getPluginVersion** | () =&gt; Promise&lt;{ version: string; }&gt; | Get the native Capacitor plugin version |
129
+
126
130
 
127
131
  #### PermissionStatus
128
132
 
@@ -28,6 +28,8 @@ import java.util.List;
28
28
  )
29
29
  public class SimPlugin extends Plugin {
30
30
 
31
+ private final String PLUGIN_VERSION = "7.1.0";
32
+
31
33
  static final String READ_PHONE_STATE = "readPhoneState";
32
34
  static final String READ_PHONE_NUMBERS = "readPhoneNumbers";
33
35
  private static final String PERMISSION_DENIED_ERROR = "Unable to get information from SIM cards, user denied permission request.";
@@ -121,4 +123,15 @@ public class SimPlugin extends Plugin {
121
123
 
122
124
  return results;
123
125
  }
126
+
127
+ @PluginMethod
128
+ public void getPluginVersion(final PluginCall call) {
129
+ try {
130
+ final JSObject ret = new JSObject();
131
+ ret.put("version", this.PLUGIN_VERSION);
132
+ call.resolve(ret);
133
+ } catch (final Exception e) {
134
+ call.reject("Could not get plugin version", e);
135
+ }
136
+ }
124
137
  }
package/dist/docs.json CHANGED
@@ -93,7 +93,27 @@
93
93
  "name": "since"
94
94
  }
95
95
  ],
96
- "methods": [],
96
+ "methods": [
97
+ {
98
+ "name": "getPluginVersion",
99
+ "signature": "() => Promise<{ version: string; }>",
100
+ "parameters": [],
101
+ "returns": "Promise<{ version: string; }>",
102
+ "tags": [
103
+ {
104
+ "name": "returns",
105
+ "text": "an Promise with version for this device"
106
+ },
107
+ {
108
+ "name": "throws",
109
+ "text": "An error if the something went wrong"
110
+ }
111
+ ],
112
+ "docs": "Get the native Capacitor plugin version",
113
+ "complexTypes": [],
114
+ "slug": "getpluginversion"
115
+ }
116
+ ],
97
117
  "properties": [
98
118
  {
99
119
  "name": "number",
@@ -105,4 +105,13 @@ export interface SimCard {
105
105
  * @since 1.0.0
106
106
  */
107
107
  mobileNetworkCode: string;
108
+ /**
109
+ * Get the native Capacitor plugin version
110
+ *
111
+ * @returns {Promise<{ id: string }>} an Promise with version for this device
112
+ * @throws An error if the something went wrong
113
+ */
114
+ getPluginVersion(): Promise<{
115
+ version: string;
116
+ }>;
108
117
  }
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PermissionState } from '@capacitor/core';\n\n/**\n * Result of a permission check or request.\n *\n * @since 1.0.0\n */\nexport interface PermissionStatus {\n readSimCard: PermissionState;\n}\n\nexport interface SimPlugin {\n /**\n * Get information from the device's SIM cards.\n *\n * @since 1.0.0\n */\n getSimCards(): Promise<GetSimCardsResult>;\n\n /**\n * Check permission to access SIM card information.\n *\n * On iOS and Web the status is always granted or denied respectively without prompting.\n *\n * @since 1.0.0\n */\n checkPermissions(): Promise<PermissionStatus>;\n\n /**\n * Request permission to access SIM card information.\n *\n * On iOS the status is always granted. On Web the status remains denied.\n *\n * @since 1.0.0\n */\n requestPermissions(): Promise<PermissionStatus>;\n}\n\n/**\n * Result returned by {@link SimPlugin.getSimCards}.\n *\n * @since 1.0.0\n */\nexport interface GetSimCardsResult {\n simCards: SimCard[];\n}\n\n/**\n * A SIM card description.\n *\n * @since 1.0.0\n */\nexport interface SimCard {\n /**\n * Android only: Phone number for this SIM slot, when available.\n *\n * @since 1.0.0\n */\n number?: string;\n\n /**\n * Android only: Unique subscription identifier.\n *\n * @since 1.1.0\n */\n subscriptionId?: string;\n\n /**\n * Android only: Physical SIM slot index for this subscription.\n *\n * @since 1.1.0\n */\n simSlotIndex?: number;\n\n /**\n * iOS only: Indicates whether the carrier supports VoIP.\n *\n * @since 1.0.0\n */\n allowsVOIP?: boolean;\n\n /**\n * Display name of the cellular service provider.\n *\n * On iOS 16.4+ the system may return placeholder values such as `--`.\n * See https://github.com/jonz94/capacitor-sim/issues/8 for details.\n *\n * @since 1.0.0\n */\n carrierName: string;\n\n /**\n * ISO 3166-1 alpha-2 country code of the service provider.\n *\n * On iOS 16.4+ the system may return an empty string or `--`.\n * See https://github.com/jonz94/capacitor-sim/issues/8 for details.\n *\n * @since 1.0.0\n */\n isoCountryCode: string;\n\n /**\n * Mobile Country Code (MCC) of the service provider.\n *\n * On iOS 16.4+ the system may return placeholder values such as `65535`.\n * See https://github.com/jonz94/capacitor-sim/issues/8 for details.\n *\n * @since 1.0.0\n */\n mobileCountryCode: string;\n\n /**\n * Mobile Network Code (MNC) of the service provider.\n *\n * On iOS 16.4+ the system may return placeholder values such as `65535`.\n * See https://github.com/jonz94/capacitor-sim/issues/8 for details.\n *\n * @since 1.0.0\n */\n mobileNetworkCode: string;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PermissionState } from '@capacitor/core';\n\n/**\n * Result of a permission check or request.\n *\n * @since 1.0.0\n */\nexport interface PermissionStatus {\n readSimCard: PermissionState;\n}\n\nexport interface SimPlugin {\n /**\n * Get information from the device's SIM cards.\n *\n * @since 1.0.0\n */\n getSimCards(): Promise<GetSimCardsResult>;\n\n /**\n * Check permission to access SIM card information.\n *\n * On iOS and Web the status is always granted or denied respectively without prompting.\n *\n * @since 1.0.0\n */\n checkPermissions(): Promise<PermissionStatus>;\n\n /**\n * Request permission to access SIM card information.\n *\n * On iOS the status is always granted. On Web the status remains denied.\n *\n * @since 1.0.0\n */\n requestPermissions(): Promise<PermissionStatus>;\n}\n\n/**\n * Result returned by {@link SimPlugin.getSimCards}.\n *\n * @since 1.0.0\n */\nexport interface GetSimCardsResult {\n simCards: SimCard[];\n}\n\n/**\n * A SIM card description.\n *\n * @since 1.0.0\n */\nexport interface SimCard {\n /**\n * Android only: Phone number for this SIM slot, when available.\n *\n * @since 1.0.0\n */\n number?: string;\n\n /**\n * Android only: Unique subscription identifier.\n *\n * @since 1.1.0\n */\n subscriptionId?: string;\n\n /**\n * Android only: Physical SIM slot index for this subscription.\n *\n * @since 1.1.0\n */\n simSlotIndex?: number;\n\n /**\n * iOS only: Indicates whether the carrier supports VoIP.\n *\n * @since 1.0.0\n */\n allowsVOIP?: boolean;\n\n /**\n * Display name of the cellular service provider.\n *\n * On iOS 16.4+ the system may return placeholder values such as `--`.\n * See https://github.com/jonz94/capacitor-sim/issues/8 for details.\n *\n * @since 1.0.0\n */\n carrierName: string;\n\n /**\n * ISO 3166-1 alpha-2 country code of the service provider.\n *\n * On iOS 16.4+ the system may return an empty string or `--`.\n * See https://github.com/jonz94/capacitor-sim/issues/8 for details.\n *\n * @since 1.0.0\n */\n isoCountryCode: string;\n\n /**\n * Mobile Country Code (MCC) of the service provider.\n *\n * On iOS 16.4+ the system may return placeholder values such as `65535`.\n * See https://github.com/jonz94/capacitor-sim/issues/8 for details.\n *\n * @since 1.0.0\n */\n mobileCountryCode: string;\n\n /**\n * Mobile Network Code (MNC) of the service provider.\n *\n * On iOS 16.4+ the system may return placeholder values such as `65535`.\n * See https://github.com/jonz94/capacitor-sim/issues/8 for details.\n *\n * @since 1.0.0\n */\n mobileNetworkCode: string;\n\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -4,4 +4,7 @@ export declare class SimWeb extends WebPlugin implements SimPlugin {
4
4
  getSimCards(): Promise<GetSimCardsResult>;
5
5
  checkPermissions(): Promise<PermissionStatus>;
6
6
  requestPermissions(): Promise<PermissionStatus>;
7
+ getPluginVersion(): Promise<{
8
+ version: string;
9
+ }>;
7
10
  }
package/dist/esm/web.js CHANGED
@@ -9,5 +9,8 @@ export class SimWeb extends WebPlugin {
9
9
  async requestPermissions() {
10
10
  return this.checkPermissions();
11
11
  }
12
+ async getPluginVersion() {
13
+ return { version: 'web' };
14
+ }
12
15
  }
13
16
  //# 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,MAAO,SAAQ,SAAS;IACnC,KAAK,CAAC,WAAW;QACf,MAAM,IAAI,CAAC,aAAa,CAAC,4CAA4C,CAAC,CAAC;IACzE,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,kBAAkB;QACtB,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACjC,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { GetSimCardsResult, PermissionStatus, SimPlugin } from './definitions';\n\nexport class SimWeb extends WebPlugin implements SimPlugin {\n async getSimCards(): Promise<GetSimCardsResult> {\n throw this.unimplemented('Sim.getSimCards is not implemented on web.');\n }\n\n async checkPermissions(): Promise<PermissionStatus> {\n return { readSimCard: 'denied' };\n }\n\n async requestPermissions(): Promise<PermissionStatus> {\n return this.checkPermissions();\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,MAAO,SAAQ,SAAS;IACnC,KAAK,CAAC,WAAW;QACf,MAAM,IAAI,CAAC,aAAa,CAAC,4CAA4C,CAAC,CAAC;IACzE,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,kBAAkB;QACtB,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { GetSimCardsResult, PermissionStatus, SimPlugin } from './definitions';\n\nexport class SimWeb extends WebPlugin implements SimPlugin {\n async getSimCards(): Promise<GetSimCardsResult> {\n throw this.unimplemented('Sim.getSimCards is not implemented on web.');\n }\n\n async checkPermissions(): Promise<PermissionStatus> {\n return { readSimCard: 'denied' };\n }\n\n async requestPermissions(): Promise<PermissionStatus> {\n return this.checkPermissions();\n }\n\n async getPluginVersion(): Promise<{ version: string }> {\n return { version: 'web' };\n }\n}\n"]}
@@ -16,6 +16,9 @@ class SimWeb extends core.WebPlugin {
16
16
  async requestPermissions() {
17
17
  return this.checkPermissions();
18
18
  }
19
+ async getPluginVersion() {
20
+ return { version: 'web' };
21
+ }
19
22
  }
20
23
 
21
24
  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 Sim = registerPlugin('Sim', {\n web: () => import('./web').then((m) => new m.SimWeb()),\n});\nexport * from './definitions';\nexport { Sim };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class SimWeb extends WebPlugin {\n async getSimCards() {\n throw this.unimplemented('Sim.getSimCards is not implemented on web.');\n }\n async checkPermissions() {\n return { readSimCard: 'denied' };\n }\n async requestPermissions() {\n return this.checkPermissions();\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,GAAG,GAAGA,mBAAc,CAAC,KAAK,EAAE;AAClC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AAC1D,CAAC;;ACFM,MAAM,MAAM,SAASC,cAAS,CAAC;AACtC,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,4CAA4C,CAAC;AAC9E,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE;AACxC,IAAI;AACJ,IAAI,MAAM,kBAAkB,GAAG;AAC/B,QAAQ,OAAO,IAAI,CAAC,gBAAgB,EAAE;AACtC,IAAI;AACJ;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Sim = registerPlugin('Sim', {\n web: () => import('./web').then((m) => new m.SimWeb()),\n});\nexport * from './definitions';\nexport { Sim };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class SimWeb extends WebPlugin {\n async getSimCards() {\n throw this.unimplemented('Sim.getSimCards is not implemented on web.');\n }\n async checkPermissions() {\n return { readSimCard: 'denied' };\n }\n async requestPermissions() {\n return this.checkPermissions();\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,GAAG,GAAGA,mBAAc,CAAC,KAAK,EAAE;AAClC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AAC1D,CAAC;;ACFM,MAAM,MAAM,SAASC,cAAS,CAAC;AACtC,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,4CAA4C,CAAC;AAC9E,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE;AACxC,IAAI;AACJ,IAAI,MAAM,kBAAkB,GAAG;AAC/B,QAAQ,OAAO,IAAI,CAAC,gBAAgB,EAAE;AACtC,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;AACjC,IAAI;AACJ;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -15,6 +15,9 @@ var capacitorSim = (function (exports, core) {
15
15
  async requestPermissions() {
16
16
  return this.checkPermissions();
17
17
  }
18
+ async getPluginVersion() {
19
+ return { version: 'web' };
20
+ }
18
21
  }
19
22
 
20
23
  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 Sim = registerPlugin('Sim', {\n web: () => import('./web').then((m) => new m.SimWeb()),\n});\nexport * from './definitions';\nexport { Sim };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class SimWeb extends WebPlugin {\n async getSimCards() {\n throw this.unimplemented('Sim.getSimCards is not implemented on web.');\n }\n async checkPermissions() {\n return { readSimCard: 'denied' };\n }\n async requestPermissions() {\n return this.checkPermissions();\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,GAAG,GAAGA,mBAAc,CAAC,KAAK,EAAE;IAClC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1D,CAAC;;ICFM,MAAM,MAAM,SAASC,cAAS,CAAC;IACtC,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,4CAA4C,CAAC;IAC9E,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE;IACxC,IAAI;IACJ,IAAI,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,OAAO,IAAI,CAAC,gBAAgB,EAAE;IACtC,IAAI;IACJ;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Sim = registerPlugin('Sim', {\n web: () => import('./web').then((m) => new m.SimWeb()),\n});\nexport * from './definitions';\nexport { Sim };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class SimWeb extends WebPlugin {\n async getSimCards() {\n throw this.unimplemented('Sim.getSimCards is not implemented on web.');\n }\n async checkPermissions() {\n return { readSimCard: 'denied' };\n }\n async requestPermissions() {\n return this.checkPermissions();\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,GAAG,GAAGA,mBAAc,CAAC,KAAK,EAAE;IAClC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1D,CAAC;;ICFM,MAAM,MAAM,SAASC,cAAS,CAAC;IACtC,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,4CAA4C,CAAC;IAC9E,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE;IACxC,IAAI;IACJ,IAAI,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,OAAO,IAAI,CAAC,gBAAgB,EAAE;IACtC,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IACjC,IAAI;IACJ;;;;;;;;;;;;;;;"}
@@ -4,12 +4,14 @@ import Foundation
4
4
 
5
5
  @objc(SimPlugin)
6
6
  public class SimPlugin: CAPPlugin, CAPBridgedPlugin {
7
+ private let PLUGIN_VERSION: String = "7.1.0"
7
8
  public let identifier = "SimPlugin"
8
9
  public let jsName = "Sim"
9
10
  public let pluginMethods: [CAPPluginMethod] = [
10
11
  CAPPluginMethod(name: "getSimCards", returnType: CAPPluginReturnPromise),
11
12
  CAPPluginMethod(name: "checkPermissions", returnType: CAPPluginReturnPromise),
12
- CAPPluginMethod(name: "requestPermissions", returnType: CAPPluginReturnPromise)
13
+ CAPPluginMethod(name: "requestPermissions", returnType: CAPPluginReturnPromise),
14
+ CAPPluginMethod(name: "getPluginVersion", returnType: CAPPluginReturnPromise)
13
15
  ]
14
16
 
15
17
  @objc func getSimCards(_ call: CAPPluginCall) {
@@ -50,4 +52,9 @@ public class SimPlugin: CAPPlugin, CAPBridgedPlugin {
50
52
  "mobileNetworkCode": carrier.mobileNetworkCode ?? ""
51
53
  ]
52
54
  }
55
+
56
+ @objc func getPluginVersion(_ call: CAPPluginCall) {
57
+ call.resolve(["version": self.PLUGIN_VERSION])
58
+ }
59
+
53
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-sim",
3
- "version": "7.0.8",
3
+ "version": "7.1.0",
4
4
  "description": "Capacitor plugin to get information from device's sim cards",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",