@capgo/native-market 5.0.3 → 5.0.5

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/dist/esm/web.d.ts CHANGED
@@ -1,20 +1,20 @@
1
1
  import { WebPlugin } from "@capacitor/core";
2
2
  import type { NativeMarketPlugin } from "./definitions";
3
3
  export declare class NativeMarketWeb extends WebPlugin implements NativeMarketPlugin {
4
- openStoreListing(_options: {
4
+ openStoreListing(options: {
5
5
  appId: string;
6
6
  country?: string;
7
7
  }): Promise<void>;
8
- openDevPage(_options: {
8
+ openDevPage(options: {
9
9
  devId: string;
10
10
  }): Promise<void>;
11
- openCollection(_options: {
11
+ openCollection(options: {
12
12
  name: string;
13
13
  }): Promise<void>;
14
- openEditorChoicePage(_options: {
14
+ openEditorChoicePage(options: {
15
15
  editorChoice: string;
16
16
  }): Promise<void>;
17
- search(_options: {
17
+ search(options: {
18
18
  terms: string;
19
19
  }): Promise<void>;
20
20
  }
package/dist/esm/web.js CHANGED
@@ -1,19 +1,19 @@
1
1
  import { WebPlugin } from "@capacitor/core";
2
2
  export class NativeMarketWeb extends WebPlugin {
3
- openStoreListing(_options) {
4
- throw new Error("Method not implemented.");
3
+ openStoreListing(options) {
4
+ throw new Error("Method not implemented." + options);
5
5
  }
6
- openDevPage(_options) {
7
- throw new Error("Method not implemented.");
6
+ openDevPage(options) {
7
+ throw new Error("Method not implemented." + options);
8
8
  }
9
- openCollection(_options) {
10
- throw new Error("Method not implemented.");
9
+ openCollection(options) {
10
+ throw new Error("Method not implemented." + options);
11
11
  }
12
- openEditorChoicePage(_options) {
13
- throw new Error("Method not implemented.");
12
+ openEditorChoicePage(options) {
13
+ throw new Error("Method not implemented." + options);
14
14
  }
15
- search(_options) {
16
- throw new Error("Method not implemented.");
15
+ search(options) {
16
+ throw new Error("Method not implemented." + options);
17
17
  }
18
18
  }
19
19
  //# 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,eAAgB,SAAQ,SAAS;IAC5C,gBAAgB,CAAC,QAGhB;QACC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,WAAW,CAAC,QAA2B;QACrC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,cAAc,CAAC,QAA0B;QACvC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,oBAAoB,CAAC,QAAkC;QACrD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,CAAC,QAA2B;QAChC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;CACF"}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAC5C,gBAAgB,CAAC,OAGhB;QACC,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,OAAO,CAAC,CAAC;IACvD,CAAC;IAED,WAAW,CAAC,OAA0B;QACpC,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,OAAO,CAAC,CAAC;IACvD,CAAC;IAED,cAAc,CAAC,OAAyB;QACtC,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,OAAO,CAAC,CAAC;IACvD,CAAC;IAED,oBAAoB,CAAC,OAAiC;QACpD,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,OAAO,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,CAAC,OAA0B;QAC/B,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,OAAO,CAAC,CAAC;IACvD,CAAC;CACF"}
@@ -7,20 +7,20 @@ const NativeMarket = core.registerPlugin("NativeMarket", {
7
7
  });
8
8
 
9
9
  class NativeMarketWeb extends core.WebPlugin {
10
- openStoreListing(_options) {
11
- throw new Error("Method not implemented.");
10
+ openStoreListing(options) {
11
+ throw new Error("Method not implemented." + options);
12
12
  }
13
- openDevPage(_options) {
14
- throw new Error("Method not implemented.");
13
+ openDevPage(options) {
14
+ throw new Error("Method not implemented." + options);
15
15
  }
16
- openCollection(_options) {
17
- throw new Error("Method not implemented.");
16
+ openCollection(options) {
17
+ throw new Error("Method not implemented." + options);
18
18
  }
19
- openEditorChoicePage(_options) {
20
- throw new Error("Method not implemented.");
19
+ openEditorChoicePage(options) {
20
+ throw new Error("Method not implemented." + options);
21
21
  }
22
- search(_options) {
23
- throw new Error("Method not implemented.");
22
+ search(options) {
23
+ throw new Error("Method not implemented." + options);
24
24
  }
25
25
  }
26
26
 
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst NativeMarket = registerPlugin(\"NativeMarket\", {\n web: () => import(\"./web\").then((m) => new m.NativeMarketWeb()),\n});\nexport * from \"./definitions\";\nexport { NativeMarket };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class NativeMarketWeb extends WebPlugin {\n openStoreListing(_options) {\n throw new Error(\"Method not implemented.\");\n }\n openDevPage(_options) {\n throw new Error(\"Method not implemented.\");\n }\n openCollection(_options) {\n throw new Error(\"Method not implemented.\");\n }\n openEditorChoicePage(_options) {\n throw new Error(\"Method not implemented.\");\n }\n search(_options) {\n throw new Error(\"Method not implemented.\");\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,YAAY,GAAGA,mBAAc,CAAC,cAAc,EAAE;AACpD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;AACnE,CAAC;;ACFM,MAAM,eAAe,SAASC,cAAS,CAAC;AAC/C,IAAI,gBAAgB,CAAC,QAAQ,EAAE;AAC/B,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;AACnD,KAAK;AACL,IAAI,WAAW,CAAC,QAAQ,EAAE;AAC1B,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;AACnD,KAAK;AACL,IAAI,cAAc,CAAC,QAAQ,EAAE;AAC7B,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;AACnD,KAAK;AACL,IAAI,oBAAoB,CAAC,QAAQ,EAAE;AACnC,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;AACnD,KAAK;AACL,IAAI,MAAM,CAAC,QAAQ,EAAE;AACrB,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;AACnD,KAAK;AACL;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst NativeMarket = registerPlugin(\"NativeMarket\", {\n web: () => import(\"./web\").then((m) => new m.NativeMarketWeb()),\n});\nexport * from \"./definitions\";\nexport { NativeMarket };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class NativeMarketWeb extends WebPlugin {\n openStoreListing(options) {\n throw new Error(\"Method not implemented.\" + options);\n }\n openDevPage(options) {\n throw new Error(\"Method not implemented.\" + options);\n }\n openCollection(options) {\n throw new Error(\"Method not implemented.\" + options);\n }\n openEditorChoicePage(options) {\n throw new Error(\"Method not implemented.\" + options);\n }\n search(options) {\n throw new Error(\"Method not implemented.\" + options);\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,YAAY,GAAGA,mBAAc,CAAC,cAAc,EAAE;AACpD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;AACnE,CAAC;;ACFM,MAAM,eAAe,SAASC,cAAS,CAAC;AAC/C,IAAI,gBAAgB,CAAC,OAAO,EAAE;AAC9B,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,OAAO,CAAC,CAAC;AAC7D,KAAK;AACL,IAAI,WAAW,CAAC,OAAO,EAAE;AACzB,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,OAAO,CAAC,CAAC;AAC7D,KAAK;AACL,IAAI,cAAc,CAAC,OAAO,EAAE;AAC5B,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,OAAO,CAAC,CAAC;AAC7D,KAAK;AACL,IAAI,oBAAoB,CAAC,OAAO,EAAE;AAClC,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,OAAO,CAAC,CAAC;AAC7D,KAAK;AACL,IAAI,MAAM,CAAC,OAAO,EAAE;AACpB,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,OAAO,CAAC,CAAC;AAC7D,KAAK;AACL;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -6,20 +6,20 @@ var capacitorCapacitorUpdater = (function (exports, core) {
6
6
  });
7
7
 
8
8
  class NativeMarketWeb extends core.WebPlugin {
9
- openStoreListing(_options) {
10
- throw new Error("Method not implemented.");
9
+ openStoreListing(options) {
10
+ throw new Error("Method not implemented." + options);
11
11
  }
12
- openDevPage(_options) {
13
- throw new Error("Method not implemented.");
12
+ openDevPage(options) {
13
+ throw new Error("Method not implemented." + options);
14
14
  }
15
- openCollection(_options) {
16
- throw new Error("Method not implemented.");
15
+ openCollection(options) {
16
+ throw new Error("Method not implemented." + options);
17
17
  }
18
- openEditorChoicePage(_options) {
19
- throw new Error("Method not implemented.");
18
+ openEditorChoicePage(options) {
19
+ throw new Error("Method not implemented." + options);
20
20
  }
21
- search(_options) {
22
- throw new Error("Method not implemented.");
21
+ search(options) {
22
+ throw new Error("Method not implemented." + options);
23
23
  }
24
24
  }
25
25
 
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst NativeMarket = registerPlugin(\"NativeMarket\", {\n web: () => import(\"./web\").then((m) => new m.NativeMarketWeb()),\n});\nexport * from \"./definitions\";\nexport { NativeMarket };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class NativeMarketWeb extends WebPlugin {\n openStoreListing(_options) {\n throw new Error(\"Method not implemented.\");\n }\n openDevPage(_options) {\n throw new Error(\"Method not implemented.\");\n }\n openCollection(_options) {\n throw new Error(\"Method not implemented.\");\n }\n openEditorChoicePage(_options) {\n throw new Error(\"Method not implemented.\");\n }\n search(_options) {\n throw new Error(\"Method not implemented.\");\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,YAAY,GAAGA,mBAAc,CAAC,cAAc,EAAE;IACpD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACnE,CAAC;;ICFM,MAAM,eAAe,SAASC,cAAS,CAAC;IAC/C,IAAI,gBAAgB,CAAC,QAAQ,EAAE;IAC/B,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACnD,KAAK;IACL,IAAI,WAAW,CAAC,QAAQ,EAAE;IAC1B,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACnD,KAAK;IACL,IAAI,cAAc,CAAC,QAAQ,EAAE;IAC7B,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACnD,KAAK;IACL,IAAI,oBAAoB,CAAC,QAAQ,EAAE;IACnC,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACnD,KAAK;IACL,IAAI,MAAM,CAAC,QAAQ,EAAE;IACrB,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACnD,KAAK;IACL;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst NativeMarket = registerPlugin(\"NativeMarket\", {\n web: () => import(\"./web\").then((m) => new m.NativeMarketWeb()),\n});\nexport * from \"./definitions\";\nexport { NativeMarket };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class NativeMarketWeb extends WebPlugin {\n openStoreListing(options) {\n throw new Error(\"Method not implemented.\" + options);\n }\n openDevPage(options) {\n throw new Error(\"Method not implemented.\" + options);\n }\n openCollection(options) {\n throw new Error(\"Method not implemented.\" + options);\n }\n openEditorChoicePage(options) {\n throw new Error(\"Method not implemented.\" + options);\n }\n search(options) {\n throw new Error(\"Method not implemented.\" + options);\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,YAAY,GAAGA,mBAAc,CAAC,cAAc,EAAE;IACpD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACnE,CAAC;;ICFM,MAAM,eAAe,SAASC,cAAS,CAAC;IAC/C,IAAI,gBAAgB,CAAC,OAAO,EAAE;IAC9B,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,OAAO,CAAC,CAAC;IAC7D,KAAK;IACL,IAAI,WAAW,CAAC,OAAO,EAAE;IACzB,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,OAAO,CAAC,CAAC;IAC7D,KAAK;IACL,IAAI,cAAc,CAAC,OAAO,EAAE;IAC5B,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,OAAO,CAAC,CAAC;IAC7D,KAAK;IACL,IAAI,oBAAoB,CAAC,OAAO,EAAE;IAClC,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,OAAO,CAAC,CAAC;IAC7D,KAAK;IACL,IAAI,MAAM,CAAC,OAAO,EAAE;IACpB,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,OAAO,CAAC,CAAC;IAC7D,KAAK;IACL;;;;;;;;;;;;;;;"}
@@ -33,28 +33,39 @@ public class NativeMarket: CAPPlugin {
33
33
  }
34
34
  let country = call.getString("country") ?? ""
35
35
  do {
36
- let url = URL(string: "https://itunes.apple.com/lookup?bundleId=\(appId)&country=\(country)")
37
- let data = try Data(contentsOf: url!)
36
+ guard let url = URL(string: "https://itunes.apple.com/lookup?bundleId=\(appId)&country=\(country)") else {
37
+ throw NSError(domain: "Invalid URL", code: 0, userInfo: nil)
38
+ }
39
+ let data = try Data(contentsOf: url)
38
40
  let decoder = JSONDecoder()
39
- let apps = try! decoder.decode(APIResult.self, from: data).apps
40
- let urlStore = "itms-apps://itunes.apple.com/app/id\(apps[0].trackId)"
41
- let appUrl = URL(string: urlStore)
41
+ let apiResult = try decoder.decode(APIResult.self, from: data)
42
+
43
+ guard let firstApp = apiResult.apps.first else {
44
+ print("No apps found for given appId")
45
+ call.reject("No apps found for given appId")
46
+ return
47
+ }
48
+
49
+ let urlStore = "itms-apps://itunes.apple.com/app/id\(firstApp.trackId)"
50
+ guard let appUrl = URL(string: urlStore) else {
51
+ throw NSError(domain: "Invalid Store URL", code: 0, userInfo: nil)
52
+ }
42
53
 
43
54
  DispatchQueue.main.async {
44
- if UIApplication.shared.canOpenURL(appUrl!) {
55
+ if UIApplication.shared.canOpenURL(appUrl) {
45
56
  if #available(iOS 10.0, *) {
46
- UIApplication.shared.open(appUrl!, options: [:]) { (_) in
57
+ UIApplication.shared.open(appUrl, options: [:]) { (_) in
47
58
  call.resolve()
48
59
  }
49
60
  } else {
50
- UIApplication.shared.openURL(appUrl!)
61
+ UIApplication.shared.openURL(appUrl)
51
62
  call.resolve()
52
63
  }
53
64
  }
54
65
  }
55
66
  } catch {
56
- print("trackId cannot be found from appId")
57
- call.reject("trackId cannot be found from appId")
67
+ print("Error: \(error.localizedDescription)")
68
+ call.reject("Error: \(error.localizedDescription)")
58
69
  }
59
70
  }
60
71
 
@@ -4,16 +4,6 @@ import Capacitor
4
4
 
5
5
  class PluginTests: XCTestCase {
6
6
 
7
- override func setUp() {
8
- super.setUp()
9
- // Put setup code here. This method is called before the invocation of each test method in the class.
10
- }
11
-
12
- override func tearDown() {
13
- // Put teardown code here. This method is called after the invocation of each test method in the class.
14
- super.tearDown()
15
- }
16
-
17
7
  func testEcho() {
18
8
  // This is an example of a functional test case for a plugin.
19
9
  // Use XCTAssert and related functions to verify your tests produce the correct results.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/native-market",
3
- "version": "5.0.3",
3
+ "version": "5.0.5",
4
4
  "description": "A native market plugin for linking to google play or app store.",
5
5
  "module": "dist/esm/index.js",
6
6
  "main": "dist/esm/index.js",
@@ -24,25 +24,25 @@
24
24
  "author": "Martin Donadieu <martindonadieu@gmail.com>",
25
25
  "license": "MIT",
26
26
  "dependencies": {
27
- "@capacitor/core": "^5.0.3"
27
+ "@capacitor/core": "^5.5.1"
28
28
  },
29
29
  "devDependencies": {
30
- "@capacitor/android": "^5.0.3",
31
- "@capacitor/cli": "^5.0.3",
32
- "@capacitor/core": "^5.0.3",
30
+ "@capacitor/android": "^5.5.1",
31
+ "@capacitor/cli": "^5.5.1",
32
+ "@capacitor/core": "^5.5.1",
33
33
  "@capacitor/docgen": "^0.2.1",
34
- "@capacitor/ios": "^5.0.3",
34
+ "@capacitor/ios": "^5.5.1",
35
35
  "@ionic/eslint-config": "^0.3.0",
36
- "@ionic/prettier-config": "^3.0.0",
36
+ "@ionic/prettier-config": "^4.0.0",
37
37
  "@ionic/swiftlint-config": "^1.1.2",
38
- "@typescript-eslint/eslint-plugin": "^5.59.7",
39
- "@typescript-eslint/parser": "^5.59.7",
40
- "eslint": "^8.41.0",
41
- "eslint-plugin-import": "^2.27.5",
38
+ "@typescript-eslint/eslint-plugin": "^6.10.0",
39
+ "@typescript-eslint/parser": "^6.10.0",
40
+ "eslint": "^8.53.0",
41
+ "eslint-plugin-import": "^2.29.0",
42
42
  "husky": "^8.0.3",
43
- "prettier": "^2.8.8",
44
- "prettier-plugin-java": "^2.1.0",
45
- "rimraf": "^5.0.1",
43
+ "prettier": "^3.1.0",
44
+ "prettier-plugin-java": "^2.4.0",
45
+ "rimraf": "^5.0.5",
46
46
  "rollup": "^3.23.0",
47
47
  "swiftlint": "^1.0.2",
48
48
  "typescript": "^5.0.4"