@capgo/native-market 1.0.10 → 1.0.12

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
@@ -1,5 +1,6 @@
1
1
  # Capacitor Native Market Plugin
2
- <a href="https://capgo.app/"><img src='https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png' alt='Capgo - Instant updates for capacitor'/></a>
2
+
3
+ <a href="https://capgo.app/"><img src='https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png' alt='Capgo - Instant updates for capacitor'/></a>
3
4
 
4
5
  <div align="center">
5
6
  <h2><a href="https://capgo.app/">Check out: Capgo — Instant updates for capacitor</a></h2>
@@ -11,7 +12,7 @@ Capacitor community plugin for native market for Play Store/App Store.
11
12
 
12
13
  | Maintainer | GitHub | Social | Sponsoring Company |
13
14
  | --------------- | ----------------------------------- | ----------------------------------------------------- | ------------------ |
14
- | Martin Donadieu | [riderx](https://github.com/riderx) | [@martindonadieu](https://twitter.com/martindonadieu) | |
15
+ | Martin Donadieu | [riderx](https://github.com/riderx) | [@martindonadieu](https://twitter.com/martindonadieu) | |
15
16
 
16
17
  Maintenance Status: Actively Maintained
17
18
 
@@ -27,35 +27,33 @@ struct APIResult: Codable {
27
27
  public class NativeMarket: CAPPlugin {
28
28
 
29
29
  @objc func openStoreListing(_ call: CAPPluginCall) {
30
- if call.hasOption("appId") {
31
- let appId = call.getString("appId")
30
+ guard let appId = call.getString("appId") else {
31
+ call.reject("appId is missing")
32
+ return
33
+ }
34
+ do {
35
+ let url = URL(string: "http://itunes.apple.com/lookup?bundleId=\(appId)")
36
+ let data = try Data(contentsOf: url!)
37
+ let decoder = JSONDecoder()
38
+ let apps = try! decoder.decode(APIResult.self, from: data).apps
39
+ let urlStore = "itms-apps://itunes.apple.com/app/id\(apps[0].trackId)"
40
+ let appUrl = URL(string: urlStore)
32
41
 
33
- do {
34
- let url = URL(string: "http://itunes.apple.com/lookup?bundleId=\(appId)")
35
- let data = try Data(contentsOf: url!)
36
- let decoder = JSONDecoder()
37
- let apps = try! decoder.decode(APIResult.self, from: data).apps
38
- let urlStore = "itms-apps://itunes.apple.com/app/id\(apps[0].trackId)"
39
- let appUrl = URL(string: urlStore)
40
-
41
- DispatchQueue.main.async {
42
- if UIApplication.shared.canOpenURL(appUrl!) {
43
- if #available(iOS 10.0, *) {
44
- UIApplication.shared.open(appUrl!, options: [:]) { (success) in
45
- call.resolve()
46
- }
47
- } else {
48
- UIApplication.shared.openURL(appUrl!)
42
+ DispatchQueue.main.async {
43
+ if UIApplication.shared.canOpenURL(appUrl!) {
44
+ if #available(iOS 10.0, *) {
45
+ UIApplication.shared.open(appUrl!, options: [:]) { (success) in
49
46
  call.resolve()
50
47
  }
48
+ } else {
49
+ UIApplication.shared.openURL(appUrl!)
50
+ call.resolve()
51
51
  }
52
52
  }
53
- } catch {
54
- print("trackId cannot be found from appId")
55
- call.reject("trackId cannot be found from appId")
56
53
  }
57
- } else {
58
- call.reject("appId is missing")
54
+ } catch {
55
+ print("trackId cannot be found from appId")
56
+ call.reject("trackId cannot be found from appId")
59
57
  }
60
58
  }
61
59
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/native-market",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
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",
@@ -11,31 +11,27 @@
11
11
  "watch": "tsc --watch",
12
12
  "docgen": "docgen --api NativeMarketPlugin --output-readme README.md --output-json dist/docs.json",
13
13
  "prepublishOnly": "npm run build",
14
- "npm-publish": "np"
14
+ "npm-publish": "np",
15
+ "prepare": "husky install"
15
16
  },
16
17
  "author": "Martin Donadieu <martindonadieu@gmail.com>",
17
18
  "license": "MIT",
18
19
  "dependencies": {
19
- "@capacitor/core": "^3.3.2"
20
+ "@capacitor/core": "^4.4.0"
20
21
  },
21
22
  "devDependencies": {
22
- "@capacitor/android": "^3.3.4",
23
- "@capacitor/cli": "^3.3.4",
23
+ "@capacitor/android": "^4.4.0",
24
+ "@capacitor/cli": "^4.4.0",
24
25
  "@capacitor/docgen": "^0.2.0",
25
- "@capacitor/ios": "^3.3.4",
26
- "@types/node": "^17.0.8",
27
- "husky": "^4.2.5",
28
- "np": "^6.2.4",
29
- "prettier": "^2.5.1",
30
- "prettier-plugin-java": "^1.6.0",
26
+ "@capacitor/ios": "^4.4.0",
27
+ "@types/node": "^18.11.9",
28
+ "husky": "^8.0.2",
29
+ "np": "^7.6.2",
30
+ "prettier": "^2.7.1",
31
+ "prettier-plugin-java": "^1.6.2",
31
32
  "pretty-quick": "^3.1.3",
32
33
  "rimraf": "^3.0.2",
33
- "typescript": "^4.3.5"
34
- },
35
- "husky": {
36
- "hooks": {
37
- "pre-commit": "pretty-quick --staged"
38
- }
34
+ "typescript": "^4.8.4"
39
35
  },
40
36
  "files": [
41
37
  "dist/",