@capgo/native-market 1.1.35 → 7.0.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 +9 -2
- package/android/build.gradle +9 -7
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/gradle.properties +0 -1
- package/android/gradlew +2 -2
- package/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java +8 -6
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/getcapacitor/community/nativemarket/NativeMarket.java +111 -97
- package/android/src/test/java/com/getcapacitor/ExampleUnitTest.java +4 -4
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +4 -4
- package/dist/esm/web.d.ts +2 -2
- package/dist/esm/web.js +6 -6
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +6 -6
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +6 -6
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/Plugin.swift +12 -12
- package/ios/PluginTests/PluginTests.swift +8 -8
- package/package.json +22 -23
package/README.md
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
# Capacitor Native Market Plugin
|
|
2
2
|
|
|
3
|
-
<a href="https://capgo.app/"
|
|
3
|
+
<a href="https://capgo.app/">
|
|
4
|
+
<img
|
|
5
|
+
src="https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png"
|
|
6
|
+
alt="Capgo - Instant updates for capacitor"
|
|
7
|
+
/>
|
|
8
|
+
</a>
|
|
4
9
|
|
|
5
10
|
<div align="center">
|
|
6
|
-
<h2
|
|
11
|
+
<h2>
|
|
12
|
+
<a href="https://capgo.app/">Check out: Capgo — Instant updates for capacitor</a>
|
|
13
|
+
</h2>
|
|
7
14
|
</div>
|
|
8
15
|
|
|
9
16
|
Capacitor community plugin for native market for Play Store/App Store.
|
package/android/build.gradle
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
ext {
|
|
2
|
-
junitVersion =
|
|
3
|
-
|
|
4
|
-
|
|
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'
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
buildscript {
|
|
@@ -10,17 +11,18 @@ buildscript {
|
|
|
10
11
|
mavenCentral()
|
|
11
12
|
}
|
|
12
13
|
dependencies {
|
|
13
|
-
classpath 'com.android.tools.build:gradle:
|
|
14
|
+
classpath 'com.android.tools.build:gradle:8.0.0'
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
apply plugin: 'com.android.library'
|
|
18
19
|
|
|
19
20
|
android {
|
|
20
|
-
|
|
21
|
+
namespace "com.getcapacitor.community.nativemarket.nativemarket"
|
|
22
|
+
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
|
|
21
23
|
defaultConfig {
|
|
22
24
|
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
|
|
23
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
25
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
|
|
24
26
|
versionCode 1
|
|
25
27
|
versionName "1.0"
|
|
26
28
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
@@ -45,7 +47,7 @@ repositories {
|
|
|
45
47
|
|
|
46
48
|
|
|
47
49
|
dependencies {
|
|
48
|
-
implementation
|
|
50
|
+
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
49
51
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
50
52
|
implementation project(':capacitor-android')
|
|
51
53
|
testImplementation "junit:junit:$junitVersion"
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
distributionBase=GRADLE_USER_HOME
|
|
2
2
|
distributionPath=wrapper/dists
|
|
3
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-
|
|
3
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
|
|
4
4
|
networkTimeout=10000
|
|
5
5
|
zipStoreBase=GRADLE_USER_HOME
|
|
6
6
|
zipStorePath=wrapper/dists
|
package/android/gradlew
CHANGED
|
@@ -144,7 +144,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|
|
144
144
|
case $MAX_FD in #(
|
|
145
145
|
max*)
|
|
146
146
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
|
147
|
-
# shellcheck disable=SC3045
|
|
147
|
+
# shellcheck disable=SC3045
|
|
148
148
|
MAX_FD=$( ulimit -H -n ) ||
|
|
149
149
|
warn "Could not query maximum file descriptor limit"
|
|
150
150
|
esac
|
|
@@ -152,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|
|
152
152
|
'' | soft) :;; #(
|
|
153
153
|
*)
|
|
154
154
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
|
155
|
-
# shellcheck disable=SC3045
|
|
155
|
+
# shellcheck disable=SC3045
|
|
156
156
|
ulimit -n "$MAX_FD" ||
|
|
157
157
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
|
158
158
|
esac
|
|
@@ -16,11 +16,13 @@ import org.junit.runner.RunWith;
|
|
|
16
16
|
@RunWith(AndroidJUnit4.class)
|
|
17
17
|
public class ExampleInstrumentedTest {
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
@Test
|
|
20
|
+
public void useAppContext() throws Exception {
|
|
21
|
+
// Context of the app under test.
|
|
22
|
+
Context appContext = InstrumentationRegistry
|
|
23
|
+
.getInstrumentation()
|
|
24
|
+
.getTargetContext();
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
assertEquals("com.getcapacitor.android", appContext.getPackageName());
|
|
27
|
+
}
|
|
26
28
|
}
|
|
@@ -12,106 +12,120 @@ import com.getcapacitor.annotation.CapacitorPlugin;
|
|
|
12
12
|
@CapacitorPlugin(name = "NativeMarket")
|
|
13
13
|
public class NativeMarket extends Plugin {
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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());
|
|
33
35
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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());
|
|
54
58
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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());
|
|
75
81
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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());
|
|
96
106
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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());
|
|
116
129
|
}
|
|
130
|
+
}
|
|
117
131
|
}
|
|
@@ -11,8 +11,8 @@ import org.junit.Test;
|
|
|
11
11
|
*/
|
|
12
12
|
public class ExampleUnitTest {
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
@Test
|
|
15
|
+
public void addition_isCorrect() throws Exception {
|
|
16
|
+
assertEquals(4, 2 + 2);
|
|
17
|
+
}
|
|
18
18
|
}
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { registerPlugin } from
|
|
2
|
-
const NativeMarket = registerPlugin(
|
|
3
|
-
web: () => import(
|
|
1
|
+
import { registerPlugin } from "@capacitor/core";
|
|
2
|
+
const NativeMarket = registerPlugin("NativeMarket", {
|
|
3
|
+
web: () => import("./web").then((m) => new m.NativeMarketWeb()),
|
|
4
4
|
});
|
|
5
|
-
export * from
|
|
5
|
+
export * from "./definitions";
|
|
6
6
|
export { NativeMarket };
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WebPlugin } from
|
|
2
|
-
import type { NativeMarketPlugin } from
|
|
1
|
+
import { WebPlugin } from "@capacitor/core";
|
|
2
|
+
import type { NativeMarketPlugin } from "./definitions";
|
|
3
3
|
export declare class NativeMarketWeb extends WebPlugin implements NativeMarketPlugin {
|
|
4
4
|
openStoreListing(_options: {
|
|
5
5
|
appId: string;
|
package/dist/esm/web.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { WebPlugin } from
|
|
1
|
+
import { WebPlugin } from "@capacitor/core";
|
|
2
2
|
export class NativeMarketWeb extends WebPlugin {
|
|
3
3
|
openStoreListing(_options) {
|
|
4
|
-
throw new Error(
|
|
4
|
+
throw new Error("Method not implemented.");
|
|
5
5
|
}
|
|
6
6
|
openDevPage(_options) {
|
|
7
|
-
throw new Error(
|
|
7
|
+
throw new Error("Method not implemented.");
|
|
8
8
|
}
|
|
9
9
|
openCollection(_options) {
|
|
10
|
-
throw new Error(
|
|
10
|
+
throw new Error("Method not implemented.");
|
|
11
11
|
}
|
|
12
12
|
openEditorChoicePage(_options) {
|
|
13
|
-
throw new Error(
|
|
13
|
+
throw new Error("Method not implemented.");
|
|
14
14
|
}
|
|
15
15
|
search(_options) {
|
|
16
|
-
throw new Error(
|
|
16
|
+
throw new Error("Method not implemented.");
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
//# sourceMappingURL=web.js.map
|
package/dist/esm/web.js.map
CHANGED
|
@@ -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,
|
|
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"}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
var core = require('@capacitor/core');
|
|
4
4
|
|
|
5
|
-
const NativeMarket = core.registerPlugin(
|
|
5
|
+
const NativeMarket = core.registerPlugin("NativeMarket", {
|
|
6
6
|
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.NativeMarketWeb()),
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
class NativeMarketWeb extends core.WebPlugin {
|
|
10
10
|
openStoreListing(_options) {
|
|
11
|
-
throw new Error(
|
|
11
|
+
throw new Error("Method not implemented.");
|
|
12
12
|
}
|
|
13
13
|
openDevPage(_options) {
|
|
14
|
-
throw new Error(
|
|
14
|
+
throw new Error("Method not implemented.");
|
|
15
15
|
}
|
|
16
16
|
openCollection(_options) {
|
|
17
|
-
throw new Error(
|
|
17
|
+
throw new Error("Method not implemented.");
|
|
18
18
|
}
|
|
19
19
|
openEditorChoicePage(_options) {
|
|
20
|
-
throw new Error(
|
|
20
|
+
throw new Error("Method not implemented.");
|
|
21
21
|
}
|
|
22
22
|
search(_options) {
|
|
23
|
-
throw new Error(
|
|
23
|
+
throw new Error("Method not implemented.");
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from
|
|
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;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
var capacitorCapacitorUpdater = (function (exports, core) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
const NativeMarket = core.registerPlugin(
|
|
4
|
+
const NativeMarket = core.registerPlugin("NativeMarket", {
|
|
5
5
|
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.NativeMarketWeb()),
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
class NativeMarketWeb extends core.WebPlugin {
|
|
9
9
|
openStoreListing(_options) {
|
|
10
|
-
throw new Error(
|
|
10
|
+
throw new Error("Method not implemented.");
|
|
11
11
|
}
|
|
12
12
|
openDevPage(_options) {
|
|
13
|
-
throw new Error(
|
|
13
|
+
throw new Error("Method not implemented.");
|
|
14
14
|
}
|
|
15
15
|
openCollection(_options) {
|
|
16
|
-
throw new Error(
|
|
16
|
+
throw new Error("Method not implemented.");
|
|
17
17
|
}
|
|
18
18
|
openEditorChoicePage(_options) {
|
|
19
|
-
throw new Error(
|
|
19
|
+
throw new Error("Method not implemented.");
|
|
20
20
|
}
|
|
21
21
|
search(_options) {
|
|
22
|
-
throw new Error(
|
|
22
|
+
throw new Error("Method not implemented.");
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from
|
|
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;;;;;;;;;;;;;;;"}
|
package/ios/Plugin/Plugin.swift
CHANGED
|
@@ -5,7 +5,7 @@ struct APIResult: Codable {
|
|
|
5
5
|
struct App: Codable {
|
|
6
6
|
let trackId: Int
|
|
7
7
|
|
|
8
|
-
enum CodingKeys
|
|
8
|
+
enum CodingKeys: String, CodingKey {
|
|
9
9
|
case trackId
|
|
10
10
|
}
|
|
11
11
|
}
|
|
@@ -13,7 +13,7 @@ struct APIResult: Codable {
|
|
|
13
13
|
let resultCount: Int
|
|
14
14
|
let apps: [App]
|
|
15
15
|
|
|
16
|
-
enum CodingKeys
|
|
16
|
+
enum CodingKeys: String, CodingKey {
|
|
17
17
|
case resultCount
|
|
18
18
|
case apps = "results"
|
|
19
19
|
}
|
|
@@ -25,7 +25,7 @@ struct APIResult: Codable {
|
|
|
25
25
|
*/
|
|
26
26
|
@objc(NativeMarket)
|
|
27
27
|
public class NativeMarket: CAPPlugin {
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
@objc func openStoreListing(_ call: CAPPluginCall) {
|
|
30
30
|
guard let appId = call.getString("appId") else {
|
|
31
31
|
call.reject("appId is missing")
|
|
@@ -39,11 +39,11 @@ public class NativeMarket: CAPPlugin {
|
|
|
39
39
|
let apps = try! decoder.decode(APIResult.self, from: data).apps
|
|
40
40
|
let urlStore = "itms-apps://itunes.apple.com/app/id\(apps[0].trackId)"
|
|
41
41
|
let appUrl = URL(string: urlStore)
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
DispatchQueue.main.async {
|
|
44
44
|
if UIApplication.shared.canOpenURL(appUrl!) {
|
|
45
45
|
if #available(iOS 10.0, *) {
|
|
46
|
-
UIApplication.shared.open(appUrl!, options: [:]) { (
|
|
46
|
+
UIApplication.shared.open(appUrl!, options: [:]) { (_) in
|
|
47
47
|
call.resolve()
|
|
48
48
|
}
|
|
49
49
|
} else {
|
|
@@ -57,29 +57,29 @@ public class NativeMarket: CAPPlugin {
|
|
|
57
57
|
call.reject("trackId cannot be found from appId")
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
@objc func openDevPage(_ call: CAPPluginCall) {
|
|
62
62
|
call.resolve() // TODO: Implement
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
@objc func openCollection(_ call: CAPPluginCall) {
|
|
66
66
|
call.resolve() // TODO: Implement
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
|
|
69
69
|
@objc func openEditorChoicePage(_ call: CAPPluginCall) {
|
|
70
70
|
call.resolve() // TODO: Implement
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
@objc func search(_ call: CAPPluginCall) {
|
|
74
74
|
if call.hasOption("terms") {
|
|
75
75
|
let terms = call.getString("terms")
|
|
76
|
-
|
|
76
|
+
|
|
77
77
|
let url = "itms-apps://itunes.apple.com/search?term=" + terms!
|
|
78
78
|
let appUrl = URL(string: url)
|
|
79
|
-
|
|
79
|
+
|
|
80
80
|
if UIApplication.shared.canOpenURL(appUrl!) {
|
|
81
81
|
if #available(iOS 10.0, *) {
|
|
82
|
-
UIApplication.shared.open(appUrl!, options: [:]) { (
|
|
82
|
+
UIApplication.shared.open(appUrl!, options: [:]) { (_) in
|
|
83
83
|
call.resolve()
|
|
84
84
|
}
|
|
85
85
|
} else {
|
|
@@ -3,33 +3,33 @@ import Capacitor
|
|
|
3
3
|
@testable import Plugin
|
|
4
4
|
|
|
5
5
|
class PluginTests: XCTestCase {
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
override func setUp() {
|
|
8
8
|
super.setUp()
|
|
9
9
|
// Put setup code here. This method is called before the invocation of each test method in the class.
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
override func tearDown() {
|
|
13
13
|
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
|
14
14
|
super.tearDown()
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
func testEcho() {
|
|
18
18
|
// This is an example of a functional test case for a plugin.
|
|
19
19
|
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
let value = "Hello, World!"
|
|
22
22
|
let plugin = MyPlugin()
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
let call = CAPPluginCall(callbackId: "test", options: [
|
|
25
25
|
"value": value
|
|
26
|
-
], success: { (result,
|
|
26
|
+
], success: { (result, _) in
|
|
27
27
|
let resultValue = result!.data["value"] as? String
|
|
28
28
|
XCTAssertEqual(value, resultValue)
|
|
29
|
-
}, error: { (
|
|
29
|
+
}, error: { (_) in
|
|
30
30
|
XCTFail("Error shouldn't have been called")
|
|
31
31
|
})
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
plugin.echo(call!)
|
|
34
34
|
}
|
|
35
35
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/native-market",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
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,42 +11,41 @@
|
|
|
11
11
|
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
12
12
|
"verify:web": "npm run build",
|
|
13
13
|
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|
|
14
|
-
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- autocorrect --format",
|
|
14
|
+
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --autocorrect --format",
|
|
15
15
|
"eslint": "eslint . --ext ts",
|
|
16
|
-
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
|
|
16
|
+
"prettier": "prettier --config .prettierrc.js \"**/*.{css,html,ts,js,java}\"",
|
|
17
17
|
"swiftlint": "node-swiftlint",
|
|
18
18
|
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
|
|
19
19
|
"clean": "rimraf ./dist",
|
|
20
20
|
"watch": "tsc --watch",
|
|
21
21
|
"docgen": "docgen --api NativeMarketPlugin --output-readme README.md --output-json dist/docs.json",
|
|
22
|
-
"prepublishOnly": "npm run build"
|
|
23
|
-
"prepare": "husky install"
|
|
22
|
+
"prepublishOnly": "npm run build"
|
|
24
23
|
},
|
|
25
24
|
"author": "Martin Donadieu <martindonadieu@gmail.com>",
|
|
26
25
|
"license": "MIT",
|
|
27
26
|
"dependencies": {
|
|
28
|
-
"@capacitor/core": "^
|
|
27
|
+
"@capacitor/core": "^5.0.3"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
|
-
"@capacitor/android": "^
|
|
32
|
-
"@capacitor/cli": "^
|
|
33
|
-
"@capacitor/core": "^
|
|
34
|
-
"@capacitor/docgen": "^0.2.
|
|
35
|
-
"@capacitor/ios": "^
|
|
30
|
+
"@capacitor/android": "^5.0.3",
|
|
31
|
+
"@capacitor/cli": "^5.0.3",
|
|
32
|
+
"@capacitor/core": "^5.0.3",
|
|
33
|
+
"@capacitor/docgen": "^0.2.1",
|
|
34
|
+
"@capacitor/ios": "^5.0.3",
|
|
36
35
|
"@ionic/eslint-config": "^0.3.0",
|
|
37
|
-
"@ionic/prettier-config": "^
|
|
36
|
+
"@ionic/prettier-config": "^3.0.0",
|
|
38
37
|
"@ionic/swiftlint-config": "^1.1.2",
|
|
39
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
40
|
-
"@typescript-eslint/parser": "^5.
|
|
41
|
-
"eslint": "^8.
|
|
42
|
-
"eslint-plugin-import": "^2.
|
|
43
|
-
"husky": "^8.0.
|
|
44
|
-
"prettier": "^2.
|
|
45
|
-
"prettier-plugin-java": "^2.
|
|
46
|
-
"rimraf": "^
|
|
47
|
-
"rollup": "^3.
|
|
48
|
-
"swiftlint": "^1.0.
|
|
49
|
-
"typescript": "^
|
|
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",
|
|
42
|
+
"husky": "^8.0.3",
|
|
43
|
+
"prettier": "^2.8.8",
|
|
44
|
+
"prettier-plugin-java": "^2.1.0",
|
|
45
|
+
"rimraf": "^5.0.1",
|
|
46
|
+
"rollup": "^3.23.0",
|
|
47
|
+
"swiftlint": "^1.0.2",
|
|
48
|
+
"typescript": "^5.0.4"
|
|
50
49
|
},
|
|
51
50
|
"files": [
|
|
52
51
|
"dist/",
|