@capgo/native-market 6.0.2 → 7.1.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.
Files changed (42) hide show
  1. package/.eslintignore +5 -0
  2. package/.github/FUNDING.yml +1 -0
  3. package/.github/ISSUE_TEMPLATE/bug_report.yml +86 -0
  4. package/.github/ISSUE_TEMPLATE/feature_request.yml +45 -0
  5. package/.github/workflows/autofix.yml +23 -0
  6. package/.github/workflows/build.yml +82 -0
  7. package/.github/workflows/bump_version.yml +57 -0
  8. package/.github/workflows/test.yml +58 -0
  9. package/.prettierrc.js +3 -0
  10. package/CHANGELOG.md +500 -0
  11. package/CapgoNativeMarket.podspec +1 -1
  12. package/PLUGIN_AUTHOR_README.md +51 -0
  13. package/README.md +5 -15
  14. package/android/build.gradle +7 -7
  15. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  16. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  17. package/android/gradlew +13 -9
  18. package/android/gradlew.bat +12 -10
  19. package/android/src/main/java/com/getcapacitor/community/nativemarket/NativeMarket.java +70 -73
  20. package/bun.lock +820 -0
  21. package/dist/docs.json +10 -10
  22. package/dist/plugin.cjs.js.map +1 -1
  23. package/dist/plugin.js.map +1 -1
  24. package/ios/Plugin/Plugin.swift +10 -2
  25. package/ios/Plugin.xcodeproj/project.pbxproj +4 -12
  26. package/ios/Plugin.xcworkspace/contents.xcworkspacedata +10 -0
  27. package/ios/Podfile +1 -1
  28. package/java_code_style.xml +24 -0
  29. package/package.json +44 -46
  30. package/renovate.json +20 -0
  31. package/rollup.config.mjs +22 -0
  32. package/src/definitions.ts +58 -0
  33. package/src/index.ts +10 -0
  34. package/src/web.ts +28 -0
  35. package/tsconfig.json +19 -0
  36. package/android/android.iml +0 -109
  37. package/android/src/main/res/layout/bridge_layout_main.xml +0 -15
  38. package/android/src/main/res/values/colors.xml +0 -3
  39. package/android/src/main/res/values/strings.xml +0 -3
  40. package/android/src/main/res/values/styles.xml +0 -3
  41. package/ios/Plugin/Plugin.h +0 -10
  42. package/ios/Plugin/Plugin.m +0 -12
@@ -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.0'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
6
6
  }
7
7
 
8
8
  buildscript {
@@ -11,7 +11,7 @@ buildscript {
11
11
  mavenCentral()
12
12
  }
13
13
  dependencies {
14
- classpath 'com.android.tools.build:gradle:8.2.1'
14
+ classpath 'com.android.tools.build:gradle:8.7.2'
15
15
  }
16
16
  }
17
17
 
@@ -19,10 +19,10 @@ apply plugin: 'com.android.library'
19
19
 
20
20
  android {
21
21
  namespace "com.getcapacitor.community.nativemarket.nativemarket"
22
- compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
22
+ compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
23
23
  defaultConfig {
24
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
25
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
24
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
25
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
26
26
  versionCode 1
27
27
  versionName "1.0"
28
28
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -1,6 +1,6 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
4
4
  networkTimeout=10000
5
5
  validateDistributionUrl=true
6
6
  zipStoreBase=GRADLE_USER_HOME
package/android/gradlew CHANGED
@@ -15,6 +15,8 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
  #
18
+ # SPDX-License-Identifier: Apache-2.0
19
+ #
18
20
 
19
21
  ##############################################################################
20
22
  #
@@ -55,7 +57,7 @@
55
57
  # Darwin, MinGW, and NonStop.
56
58
  #
57
59
  # (3) This script is generated from the Groovy template
58
- # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
60
+ # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59
61
  # within the Gradle project.
60
62
  #
61
63
  # You can find Gradle at https://github.com/gradle/gradle/.
@@ -83,7 +85,9 @@ done
83
85
  # This is normally unused
84
86
  # shellcheck disable=SC2034
85
87
  APP_BASE_NAME=${0##*/}
86
- APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
88
+ # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89
+ APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90
+ ' "$PWD" ) || exit
87
91
 
88
92
  # Use the maximum available, or set MAX_FD != -1 to use that value.
89
93
  MAX_FD=maximum
@@ -144,7 +148,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144
148
  case $MAX_FD in #(
145
149
  max*)
146
150
  # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147
- # shellcheck disable=SC3045
151
+ # shellcheck disable=SC2039,SC3045
148
152
  MAX_FD=$( ulimit -H -n ) ||
149
153
  warn "Could not query maximum file descriptor limit"
150
154
  esac
@@ -152,7 +156,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
152
156
  '' | soft) :;; #(
153
157
  *)
154
158
  # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155
- # shellcheck disable=SC3045
159
+ # shellcheck disable=SC2039,SC3045
156
160
  ulimit -n "$MAX_FD" ||
157
161
  warn "Could not set maximum file descriptor limit to $MAX_FD"
158
162
  esac
@@ -201,11 +205,11 @@ fi
201
205
  # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
202
206
  DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
203
207
 
204
- # Collect all arguments for the java command;
205
- # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
206
- # shell script including quotes and variable substitutions, so put them in
207
- # double quotes to make sure that they get re-expanded; and
208
- # * put everything else in single quotes, so that it's not re-expanded.
208
+ # Collect all arguments for the java command:
209
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
210
+ # and any embedded shellness will be escaped.
211
+ # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
212
+ # treated as '${Hostname}' itself on the command line.
209
213
 
210
214
  set -- \
211
215
  "-Dorg.gradle.appname=$APP_BASE_NAME" \
@@ -13,6 +13,8 @@
13
13
  @rem See the License for the specific language governing permissions and
14
14
  @rem limitations under the License.
15
15
  @rem
16
+ @rem SPDX-License-Identifier: Apache-2.0
17
+ @rem
16
18
 
17
19
  @if "%DEBUG%"=="" @echo off
18
20
  @rem ##########################################################################
@@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
43
45
  %JAVA_EXE% -version >NUL 2>&1
44
46
  if %ERRORLEVEL% equ 0 goto execute
45
47
 
46
- echo.
47
- echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48
- echo.
49
- echo Please set the JAVA_HOME variable in your environment to match the
50
- echo location of your Java installation.
48
+ echo. 1>&2
49
+ echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50
+ echo. 1>&2
51
+ echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52
+ echo location of your Java installation. 1>&2
51
53
 
52
54
  goto fail
53
55
 
@@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57
59
 
58
60
  if exist "%JAVA_EXE%" goto execute
59
61
 
60
- echo.
61
- echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62
- echo.
63
- echo Please set the JAVA_HOME variable in your environment to match the
64
- echo location of your Java installation.
62
+ echo. 1>&2
63
+ echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64
+ echo. 1>&2
65
+ echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66
+ echo location of your Java installation. 1>&2
65
67
 
66
68
  goto fail
67
69
 
@@ -3,7 +3,6 @@ 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;
7
6
  import com.getcapacitor.Plugin;
8
7
  import com.getcapacitor.PluginCall;
9
8
  import com.getcapacitor.PluginMethod;
@@ -15,117 +14,115 @@ public class NativeMarket extends Plugin {
15
14
  @PluginMethod
16
15
  public void openStoreListing(PluginCall call) {
17
16
  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 {
17
+ String appId = call.getString("appId");
18
+ if (appId == null || appId.isEmpty()) {
31
19
  call.reject("appId is missing");
20
+ return;
32
21
  }
22
+
23
+ Context context = this.bridge.getActivity().getApplicationContext();
24
+ Intent intent = new Intent(
25
+ Intent.ACTION_VIEW,
26
+ Uri.parse("market://details?id=" + appId)
27
+ );
28
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
29
+ context.startActivity(intent);
30
+
31
+ call.resolve();
33
32
  } catch (Exception ex) {
34
- call.error(ex.getLocalizedMessage());
33
+ call.reject(ex.getLocalizedMessage());
35
34
  }
36
35
  }
37
36
 
38
37
  @PluginMethod
39
38
  public void openDevPage(PluginCall call) {
40
39
  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 {
40
+ String devId = call.getString("devId");
41
+ if (devId == null || devId.isEmpty()) {
54
42
  call.reject("devId is missing");
43
+ return;
55
44
  }
45
+
46
+ Context context = this.getContext();
47
+ Intent intent = new Intent(Intent.ACTION_VIEW);
48
+ intent.setData(
49
+ Uri.parse("https://play.google.com/store/apps/dev?id=" + devId)
50
+ );
51
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
52
+ context.startActivity(intent);
53
+
54
+ call.resolve();
56
55
  } catch (Exception ex) {
57
- call.error(ex.getLocalizedMessage());
56
+ call.reject(ex.getLocalizedMessage());
58
57
  }
59
58
  }
60
59
 
61
60
  @PluginMethod
62
61
  public void openCollection(PluginCall call) {
63
62
  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 {
63
+ String name = call.getString("name");
64
+ if (name == null || name.isEmpty()) {
77
65
  call.reject("name is missing");
66
+ return;
78
67
  }
68
+
69
+ Context context = this.getContext();
70
+ Intent intent = new Intent(Intent.ACTION_VIEW);
71
+ intent.setData(
72
+ Uri.parse("https://play.google.com/store/apps/collection/" + name)
73
+ );
74
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
75
+ context.startActivity(intent);
76
+
77
+ call.resolve();
79
78
  } catch (Exception ex) {
80
- call.error(ex.getLocalizedMessage());
79
+ call.reject(ex.getLocalizedMessage());
81
80
  }
82
81
  }
83
82
 
84
83
  @PluginMethod
85
84
  public void openEditorChoicePage(PluginCall call) {
86
85
  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 {
86
+ String editorChoice = call.getString("editorChoice");
87
+ if (editorChoice == null || editorChoice.isEmpty()) {
102
88
  call.reject("editorChoice is missing");
89
+ return;
103
90
  }
91
+
92
+ Context context = this.getContext();
93
+ Intent intent = new Intent(Intent.ACTION_VIEW);
94
+ intent.setData(
95
+ Uri.parse("https://play.google.com/store/apps/topic?id=" + editorChoice)
96
+ );
97
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
98
+ context.startActivity(intent);
99
+
100
+ call.resolve();
104
101
  } catch (Exception ex) {
105
- call.error(ex.getLocalizedMessage());
102
+ call.reject(ex.getLocalizedMessage());
106
103
  }
107
104
  }
108
105
 
109
106
  @PluginMethod
110
107
  public void search(PluginCall call) {
111
108
  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 {
109
+ String terms = call.getString("terms");
110
+ if (terms == null || terms.isEmpty()) {
125
111
  call.reject("terms is missing");
112
+ return;
126
113
  }
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();
127
124
  } catch (Exception ex) {
128
- call.error(ex.getLocalizedMessage());
125
+ call.reject(ex.getLocalizedMessage());
129
126
  }
130
127
  }
131
128
  }