@capgo/native-market 8.0.0 → 8.0.2

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.
Files changed (44) hide show
  1. package/CapgoNativeMarket.podspec +16 -12
  2. package/LICENSE +373 -21
  3. package/Package.swift +28 -0
  4. package/README.md +75 -49
  5. package/android/build.gradle +9 -9
  6. package/android/src/main/java/com/getcapacitor/community/nativemarket/NativeMarket.java +111 -112
  7. package/dist/docs.json +107 -35
  8. package/dist/esm/definitions.d.ts +82 -31
  9. package/dist/esm/index.d.ts +2 -2
  10. package/dist/esm/index.js +4 -4
  11. package/dist/esm/web.d.ts +10 -7
  12. package/dist/esm/web.js +14 -11
  13. package/dist/esm/web.js.map +1 -1
  14. package/dist/plugin.cjs.js +14 -11
  15. package/dist/plugin.cjs.js.map +1 -1
  16. package/dist/plugin.js +14 -11
  17. package/dist/plugin.js.map +1 -1
  18. package/ios/Sources/NativeMarketPlugin/NativeMarketPlugin.swift +120 -0
  19. package/ios/Tests/NativeMarketPluginTests/NativeMarketPluginTests.swift +20 -0
  20. package/package.json +59 -54
  21. package/android/.classpath +0 -6
  22. package/android/android.iml +0 -109
  23. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  24. package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
  25. package/android/gradle.properties +0 -20
  26. package/android/gradlew +0 -244
  27. package/android/gradlew.bat +0 -92
  28. package/android/proguard-rules.pro +0 -21
  29. package/android/settings.gradle +0 -2
  30. package/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java +0 -28
  31. package/android/src/main/res/layout/bridge_layout_main.xml +0 -15
  32. package/android/src/main/res/values/colors.xml +0 -3
  33. package/android/src/main/res/values/strings.xml +0 -3
  34. package/android/src/main/res/values/styles.xml +0 -3
  35. package/android/src/test/java/com/getcapacitor/ExampleUnitTest.java +0 -18
  36. package/ios/Plugin/Info.plist +0 -24
  37. package/ios/Plugin/Plugin.h +0 -10
  38. package/ios/Plugin/Plugin.m +0 -12
  39. package/ios/Plugin/Plugin.swift +0 -94
  40. package/ios/Plugin.xcodeproj/project.pbxproj +0 -556
  41. package/ios/Plugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  42. package/ios/PluginTests/Info.plist +0 -22
  43. package/ios/PluginTests/PluginTests.swift +0 -35
  44. package/ios/Podfile +0 -16
@@ -1,8 +1,8 @@
1
1
  ext {
2
2
  junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
4
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
5
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.1'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.3.0'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.7.0'
6
6
  }
7
7
 
8
8
  buildscript {
@@ -11,18 +11,18 @@ buildscript {
11
11
  mavenCentral()
12
12
  }
13
13
  dependencies {
14
- classpath 'com.android.tools.build:gradle:8.0.1'
14
+ classpath 'com.android.tools.build:gradle:8.13.0'
15
15
  }
16
16
  }
17
17
 
18
18
  apply plugin: 'com.android.library'
19
19
 
20
20
  android {
21
- namespace "com.getcapacitor.community.nativemarket.nativemarket"
22
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
21
+ namespace = "com.getcapacitor.community.nativemarket.nativemarket"
22
+ compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
23
23
  defaultConfig {
24
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
25
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
24
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
25
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
26
26
  versionCode 1
27
27
  versionName "1.0"
28
28
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -34,7 +34,7 @@ android {
34
34
  }
35
35
  }
36
36
  lintOptions {
37
- abortOnError false
37
+ abortOnError = false
38
38
  disable "UnsafeExperimentalUsageError",
39
39
  "UnsafeExperimentalUsageWarning"
40
40
  }
@@ -3,7 +3,7 @@ package com.getcapacitor.community.nativemarket;
3
3
  import android.content.Context;
4
4
  import android.content.Intent;
5
5
  import android.net.Uri;
6
- import com.getcapacitor.NativePlugin;
6
+ import com.getcapacitor.JSObject;
7
7
  import com.getcapacitor.Plugin;
8
8
  import com.getcapacitor.PluginCall;
9
9
  import com.getcapacitor.PluginMethod;
@@ -12,120 +12,119 @@ import com.getcapacitor.annotation.CapacitorPlugin;
12
12
  @CapacitorPlugin(name = "NativeMarket")
13
13
  public class NativeMarket extends Plugin {
14
14
 
15
- @PluginMethod
16
- public void openStoreListing(PluginCall call) {
17
- try {
18
- if (call.hasOption("appId")) {
19
- String appId = call.getString("appId");
20
-
21
- Context context = this.bridge.getActivity().getApplicationContext();
22
- Intent intent = new Intent(
23
- Intent.ACTION_VIEW,
24
- Uri.parse("market://details?id=" + appId)
25
- );
26
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
27
- context.startActivity(intent);
28
-
29
- call.resolve();
30
- } else {
31
- call.reject("appId is missing");
32
- }
33
- } catch (Exception ex) {
34
- call.error(ex.getLocalizedMessage());
15
+ private final String pluginVersion = "";
16
+
17
+ @PluginMethod
18
+ public void openStoreListing(PluginCall call) {
19
+ try {
20
+ String appId = call.getString("appId");
21
+ if (appId == null || appId.isEmpty()) {
22
+ call.reject("appId is missing");
23
+ return;
24
+ }
25
+
26
+ Context context = this.bridge.getActivity().getApplicationContext();
27
+ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appId));
28
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
29
+ context.startActivity(intent);
30
+
31
+ call.resolve();
32
+ } catch (Exception ex) {
33
+ call.reject(ex.getLocalizedMessage());
34
+ }
35
35
  }
36
- }
37
-
38
- @PluginMethod
39
- public void openDevPage(PluginCall call) {
40
- try {
41
- if (call.hasOption("devId")) {
42
- String devId = call.getString("devId");
43
-
44
- Context context = this.getContext();
45
- Intent intent = new Intent(Intent.ACTION_VIEW);
46
- intent.setData(
47
- Uri.parse("https://play.google.com/store/apps/dev?id=" + devId)
48
- );
49
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
50
- context.startActivity(intent);
51
-
52
- call.resolve();
53
- } else {
54
- call.reject("devId is missing");
55
- }
56
- } catch (Exception ex) {
57
- call.error(ex.getLocalizedMessage());
36
+
37
+ @PluginMethod
38
+ public void openDevPage(PluginCall call) {
39
+ try {
40
+ String devId = call.getString("devId");
41
+ if (devId == null || devId.isEmpty()) {
42
+ call.reject("devId is missing");
43
+ return;
44
+ }
45
+
46
+ Context context = this.getContext();
47
+ Intent intent = new Intent(Intent.ACTION_VIEW);
48
+ intent.setData(Uri.parse("https://play.google.com/store/apps/dev?id=" + devId));
49
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
50
+ context.startActivity(intent);
51
+
52
+ call.resolve();
53
+ } catch (Exception ex) {
54
+ call.reject(ex.getLocalizedMessage());
55
+ }
56
+ }
57
+
58
+ @PluginMethod
59
+ public void openCollection(PluginCall call) {
60
+ try {
61
+ String name = call.getString("name");
62
+ if (name == null || name.isEmpty()) {
63
+ call.reject("name is missing");
64
+ return;
65
+ }
66
+
67
+ Context context = this.getContext();
68
+ Intent intent = new Intent(Intent.ACTION_VIEW);
69
+ intent.setData(Uri.parse("https://play.google.com/store/apps/collection/" + name));
70
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
71
+ context.startActivity(intent);
72
+
73
+ call.resolve();
74
+ } catch (Exception ex) {
75
+ call.reject(ex.getLocalizedMessage());
76
+ }
58
77
  }
59
- }
60
-
61
- @PluginMethod
62
- public void openCollection(PluginCall call) {
63
- try {
64
- if (call.hasOption("name")) {
65
- String name = call.getString("name");
66
-
67
- Context context = this.getContext();
68
- Intent intent = new Intent(Intent.ACTION_VIEW);
69
- intent.setData(
70
- Uri.parse("https://play.google.com/store/apps/collection/" + name)
71
- );
72
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
73
- context.startActivity(intent);
74
-
75
- call.resolve();
76
- } else {
77
- call.reject("name is missing");
78
- }
79
- } catch (Exception ex) {
80
- call.error(ex.getLocalizedMessage());
78
+
79
+ @PluginMethod
80
+ public void openEditorChoicePage(PluginCall call) {
81
+ try {
82
+ String editorChoice = call.getString("editorChoice");
83
+ if (editorChoice == null || editorChoice.isEmpty()) {
84
+ call.reject("editorChoice is missing");
85
+ return;
86
+ }
87
+
88
+ Context context = this.getContext();
89
+ Intent intent = new Intent(Intent.ACTION_VIEW);
90
+ intent.setData(Uri.parse("https://play.google.com/store/apps/topic?id=" + editorChoice));
91
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
92
+ context.startActivity(intent);
93
+
94
+ call.resolve();
95
+ } catch (Exception ex) {
96
+ call.reject(ex.getLocalizedMessage());
97
+ }
81
98
  }
82
- }
83
-
84
- @PluginMethod
85
- public void openEditorChoicePage(PluginCall call) {
86
- try {
87
- if (call.hasOption("editorChoice")) {
88
- String editorChoice = call.getString("editorChoice");
89
-
90
- Context context = this.getContext();
91
- Intent intent = new Intent(Intent.ACTION_VIEW);
92
- intent.setData(
93
- Uri.parse(
94
- "https://play.google.com/store/apps/topic?id=" + editorChoice
95
- )
96
- );
97
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
98
- context.startActivity(intent);
99
-
100
- call.resolve();
101
- } else {
102
- call.reject("editorChoice is missing");
103
- }
104
- } catch (Exception ex) {
105
- call.error(ex.getLocalizedMessage());
99
+
100
+ @PluginMethod
101
+ public void search(PluginCall call) {
102
+ try {
103
+ String terms = call.getString("terms");
104
+ if (terms == null || terms.isEmpty()) {
105
+ call.reject("terms is missing");
106
+ return;
107
+ }
108
+
109
+ Context context = this.getContext();
110
+ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=" + terms));
111
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
112
+ context.startActivity(intent);
113
+
114
+ call.resolve();
115
+ } catch (Exception ex) {
116
+ call.reject(ex.getLocalizedMessage());
117
+ }
106
118
  }
107
- }
108
-
109
- @PluginMethod
110
- public void search(PluginCall call) {
111
- try {
112
- if (call.hasOption("terms")) {
113
- String terms = call.getString("terms");
114
-
115
- Context context = this.getContext();
116
- Intent intent = new Intent(
117
- Intent.ACTION_VIEW,
118
- Uri.parse("market://search?q=" + terms)
119
- );
120
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
121
- context.startActivity(intent);
122
-
123
- call.resolve();
124
- } else {
125
- call.reject("terms is missing");
126
- }
127
- } catch (Exception ex) {
128
- call.error(ex.getLocalizedMessage());
119
+
120
+ @PluginMethod
121
+ public void getPluginVersion(final PluginCall call) {
122
+ try {
123
+ final JSObject ret = new JSObject();
124
+ ret.put("version", this.pluginVersion);
125
+ call.resolve(ret);
126
+ } catch (final Exception e) {
127
+ call.reject("Could not get plugin version", e);
128
+ }
129
129
  }
130
- }
131
130
  }
package/dist/docs.json CHANGED
@@ -2,157 +2,229 @@
2
2
  "api": {
3
3
  "name": "NativeMarketPlugin",
4
4
  "slug": "nativemarketplugin",
5
- "docs": "",
6
- "tags": [],
5
+ "docs": "Capacitor Native Market Plugin for opening app store listings and pages.",
6
+ "tags": [
7
+ {
8
+ "text": "1.0.0",
9
+ "name": "since"
10
+ }
11
+ ],
7
12
  "methods": [
8
13
  {
9
14
  "name": "openStoreListing",
10
- "signature": "(options: { appId: string; country?: string; }) => any",
15
+ "signature": "(options: { appId: string; country?: string; }) => Promise<void>",
11
16
  "parameters": [
12
17
  {
13
18
  "name": "options",
14
- "docs": "",
19
+ "docs": "- Configuration for opening the store listing",
15
20
  "type": "{ appId: string; country?: string | undefined; }"
16
21
  }
17
22
  ],
18
- "returns": "any",
23
+ "returns": "Promise<void>",
19
24
  "tags": [
20
25
  {
21
26
  "name": "param",
22
- "text": "appId - ID of your application. Eg. com.example.app"
27
+ "text": "options - Configuration for opening the store listing"
23
28
  },
24
29
  {
25
- "name": "param",
26
- "text": "country - International country code if application is not published in the US App store (only for iOS). Eg. IT"
30
+ "name": "returns",
31
+ "text": "Promise that resolves when the store is opened"
27
32
  },
28
33
  {
29
- "name": "returns",
30
- "text": "void"
34
+ "name": "throws",
35
+ "text": "Error if opening the store fails"
31
36
  },
32
37
  {
33
38
  "name": "since",
34
39
  "text": "1.0.0"
40
+ },
41
+ {
42
+ "name": "example",
43
+ "text": "```typescript\n// Open app in store\nawait NativeMarket.openStoreListing({\n appId: 'com.example.app'\n});\n\n// Open app in specific country store (iOS only)\nawait NativeMarket.openStoreListing({\n appId: 'com.example.app',\n country: 'IT'\n});\n```"
35
44
  }
36
45
  ],
37
- "docs": "This method will launch link in Play/App Store.",
46
+ "docs": "Launch app listing page in Play Store (Android) or App Store (iOS).",
38
47
  "complexTypes": [],
39
48
  "slug": "openstorelisting"
40
49
  },
41
50
  {
42
51
  "name": "openDevPage",
43
- "signature": "(options: { devId: string; }) => any",
52
+ "signature": "(options: { devId: string; }) => Promise<void>",
44
53
  "parameters": [
45
54
  {
46
55
  "name": "options",
47
- "docs": "",
56
+ "docs": "- Configuration with developer ID",
48
57
  "type": "{ devId: string; }"
49
58
  }
50
59
  ],
51
- "returns": "any",
60
+ "returns": "Promise<void>",
52
61
  "tags": [
53
62
  {
54
63
  "name": "param",
55
- "text": "devId - ID of developer. Eg. com.example.app"
64
+ "text": "options - Configuration with developer ID"
56
65
  },
57
66
  {
58
67
  "name": "returns",
59
- "text": "void"
68
+ "text": "Promise that resolves when the page is opened"
69
+ },
70
+ {
71
+ "name": "throws",
72
+ "text": "Error if opening the page fails or if called on iOS"
60
73
  },
61
74
  {
62
75
  "name": "since",
63
76
  "text": "1.0.0"
77
+ },
78
+ {
79
+ "name": "example",
80
+ "text": "```typescript\nawait NativeMarket.openDevPage({\n devId: 'Google+LLC'\n});\n```"
64
81
  }
65
82
  ],
66
- "docs": "This method will deep-link directly to an Play/App store listing page.\n\nOnly in Android.",
83
+ "docs": "Deep-link directly to a developer's page in the Play Store.\nAndroid only.",
67
84
  "complexTypes": [],
68
85
  "slug": "opendevpage"
69
86
  },
70
87
  {
71
88
  "name": "openCollection",
72
- "signature": "(options: { name: string; }) => any",
89
+ "signature": "(options: { name: string; }) => Promise<void>",
73
90
  "parameters": [
74
91
  {
75
92
  "name": "options",
76
- "docs": "",
93
+ "docs": "- Configuration with collection name",
77
94
  "type": "{ name: string; }"
78
95
  }
79
96
  ],
80
- "returns": "any",
97
+ "returns": "Promise<void>",
81
98
  "tags": [
82
99
  {
83
100
  "name": "param",
84
- "text": "name - name of the collection. Click [here](https://developer.android.com/distribute/marketing-tools/linking-to-google-play#OpeningCollection) for android options."
101
+ "text": "options - Configuration with collection name"
85
102
  },
86
103
  {
87
104
  "name": "returns",
88
- "text": "void"
105
+ "text": "Promise that resolves when the collection is opened"
106
+ },
107
+ {
108
+ "name": "throws",
109
+ "text": "Error if opening the collection fails or if called on iOS"
89
110
  },
90
111
  {
91
112
  "name": "since",
92
113
  "text": "1.0.0"
114
+ },
115
+ {
116
+ "name": "example",
117
+ "text": "```typescript\nawait NativeMarket.openCollection({\n name: 'featured'\n});\n```"
118
+ },
119
+ {
120
+ "name": "see",
121
+ "text": "https ://developer.android.com/distribute/marketing-tools/linking-to-google-play#OpeningCollection"
93
122
  }
94
123
  ],
95
- "docs": "This method will link users to a collection or top charts.\nOnly in Android.",
124
+ "docs": "Link users to a collection or top charts in the Play Store.\nAndroid only.",
96
125
  "complexTypes": [],
97
126
  "slug": "opencollection"
98
127
  },
99
128
  {
100
129
  "name": "openEditorChoicePage",
101
- "signature": "(options: { editorChoice: string; }) => any",
130
+ "signature": "(options: { editorChoice: string; }) => Promise<void>",
102
131
  "parameters": [
103
132
  {
104
133
  "name": "options",
105
- "docs": "",
134
+ "docs": "- Configuration with editor choice ID",
106
135
  "type": "{ editorChoice: string; }"
107
136
  }
108
137
  ],
109
- "returns": "any",
138
+ "returns": "Promise<void>",
110
139
  "tags": [
111
140
  {
112
141
  "name": "param",
113
- "text": "editorChoice - ID of your application. Eg. editorial_fitness_apps_us"
142
+ "text": "options - Configuration with editor choice ID"
114
143
  },
115
144
  {
116
145
  "name": "returns",
117
- "text": "void"
146
+ "text": "Promise that resolves when the page is opened"
147
+ },
148
+ {
149
+ "name": "throws",
150
+ "text": "Error if opening the page fails or if called on iOS"
118
151
  },
119
152
  {
120
153
  "name": "since",
121
154
  "text": "1.0.0"
155
+ },
156
+ {
157
+ "name": "example",
158
+ "text": "```typescript\nawait NativeMarket.openEditorChoicePage({\n editorChoice: 'editorial_fitness_apps_us'\n});\n```"
122
159
  }
123
160
  ],
124
- "docs": "This method will link users to Editor's choice page.\n\nOnly in Android.",
161
+ "docs": "Link users to Editor's choice page in the Play Store.\nAndroid only.",
125
162
  "complexTypes": [],
126
163
  "slug": "openeditorchoicepage"
127
164
  },
128
165
  {
129
166
  "name": "search",
130
- "signature": "(options: { terms: string; }) => any",
167
+ "signature": "(options: { terms: string; }) => Promise<void>",
131
168
  "parameters": [
132
169
  {
133
170
  "name": "options",
134
- "docs": "",
171
+ "docs": "- Configuration with search terms",
135
172
  "type": "{ terms: string; }"
136
173
  }
137
174
  ],
138
- "returns": "any",
175
+ "returns": "Promise<void>",
139
176
  "tags": [
140
177
  {
141
178
  "name": "param",
142
- "text": "editorChoice - terms to be searched in Play/App store."
179
+ "text": "options - Configuration with search terms"
143
180
  },
144
181
  {
145
182
  "name": "returns",
146
- "text": "void"
183
+ "text": "Promise that resolves when the search is opened"
184
+ },
185
+ {
186
+ "name": "throws",
187
+ "text": "Error if opening search fails or if called on iOS"
147
188
  },
148
189
  {
149
190
  "name": "since",
150
191
  "text": "1.0.0"
192
+ },
193
+ {
194
+ "name": "example",
195
+ "text": "```typescript\nawait NativeMarket.search({\n terms: 'fitness apps'\n});\n```"
151
196
  }
152
197
  ],
153
- "docs": "This method will link users to custom search query.\n\nOnly in Android.",
198
+ "docs": "Search the Play Store with custom search terms.\nAndroid only.",
154
199
  "complexTypes": [],
155
200
  "slug": "search"
201
+ },
202
+ {
203
+ "name": "getPluginVersion",
204
+ "signature": "() => Promise<{ version: string; }>",
205
+ "parameters": [],
206
+ "returns": "Promise<{ version: string; }>",
207
+ "tags": [
208
+ {
209
+ "name": "returns",
210
+ "text": "Promise that resolves with the plugin version"
211
+ },
212
+ {
213
+ "name": "throws",
214
+ "text": "Error if getting the version fails"
215
+ },
216
+ {
217
+ "name": "since",
218
+ "text": "1.0.0"
219
+ },
220
+ {
221
+ "name": "example",
222
+ "text": "```typescript\nconst { version } = await NativeMarket.getPluginVersion();\nconsole.log('Plugin version:', version);\n```"
223
+ }
224
+ ],
225
+ "docs": "Get the native Capacitor plugin version.",
226
+ "complexTypes": [],
227
+ "slug": "getpluginversion"
156
228
  }
157
229
  ],
158
230
  "properties": []