@capgo/native-market 1.0.11 → 1.1.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.
- package/CapgoNativeMarket.podspec +1 -1
- package/android/build.gradle +11 -12
- package/android/gradle/wrapper/gradle-wrapper.properties +2 -3
- package/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java +4 -5
- package/android/src/main/java/com/getcapacitor/community/nativemarket/NativeMarket.java +97 -111
- package/android/src/test/java/com/getcapacitor/ExampleUnitTest.java +4 -3
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +1 -1
- 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 +35 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +38 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/Plugin.swift +21 -23
- package/ios/Podfile +1 -1
- package/package.json +26 -6
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
s.author = 'Priyank Patel <priyank.patel@stackspace.ca>'
|
|
9
9
|
s.source = { :git => 'https://github.com/Cap-go/native-market', :tag => s.version.to_s }
|
|
10
10
|
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
11
|
-
s.ios.deployment_target = '
|
|
11
|
+
s.ios.deployment_target = '13.0'
|
|
12
12
|
s.dependency 'Capacitor'
|
|
13
13
|
end
|
package/android/build.gradle
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
ext {
|
|
2
|
-
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.
|
|
3
|
-
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.
|
|
4
|
-
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.
|
|
2
|
+
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
|
|
4
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
buildscript {
|
|
8
8
|
repositories {
|
|
9
9
|
google()
|
|
10
|
-
|
|
10
|
+
mavenCentral()
|
|
11
11
|
}
|
|
12
12
|
dependencies {
|
|
13
|
-
classpath 'com.android.tools.build:gradle:
|
|
13
|
+
classpath 'com.android.tools.build:gradle:7.2.1'
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
apply plugin: 'com.android.library'
|
|
18
18
|
|
|
19
19
|
android {
|
|
20
|
-
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion :
|
|
20
|
+
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
|
|
21
21
|
defaultConfig {
|
|
22
|
-
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion :
|
|
23
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
22
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
|
|
23
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
|
|
24
24
|
versionCode 1
|
|
25
25
|
versionName "1.0"
|
|
26
26
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
@@ -33,20 +33,19 @@ android {
|
|
|
33
33
|
}
|
|
34
34
|
lintOptions {
|
|
35
35
|
abortOnError false
|
|
36
|
+
disable "UnsafeExperimentalUsageError",
|
|
37
|
+
"UnsafeExperimentalUsageWarning"
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
repositories {
|
|
40
42
|
google()
|
|
41
|
-
jcenter()
|
|
42
43
|
mavenCentral()
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
|
|
46
47
|
dependencies {
|
|
47
|
-
|
|
48
|
-
implementation "androidx.appcompat:appcompat:1.2.0"
|
|
49
|
-
|
|
48
|
+
implementation 'com.android.support:appcompat-v7:XX.X.+'
|
|
50
49
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
51
50
|
implementation project(':capacitor-android')
|
|
52
51
|
testImplementation "junit:junit:$junitVersion"
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
#Fri Dec 01 12:41:00 CST 2017
|
|
2
1
|
distributionBase=GRADLE_USER_HOME
|
|
3
2
|
distributionPath=wrapper/dists
|
|
3
|
+
distributionUrl=https://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
|
4
4
|
zipStoreBase=GRADLE_USER_HOME
|
|
5
|
-
zipStorePath=wrapper/dists
|
|
6
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
|
|
5
|
+
zipStorePath=wrapper/dists
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
package com.getcapacitor.android;
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import static org.junit.Assert.*;
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import android.content.Context;
|
|
6
6
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
|
7
|
-
|
|
7
|
+
import androidx.test.platform.app.InstrumentationRegistry;
|
|
8
8
|
import org.junit.Test;
|
|
9
9
|
import org.junit.runner.RunWith;
|
|
10
10
|
|
|
11
|
-
import static org.junit.Assert.*;
|
|
12
|
-
|
|
13
11
|
/**
|
|
14
12
|
* Instrumented test, which will execute on an Android device.
|
|
15
13
|
*
|
|
@@ -17,6 +15,7 @@ import static org.junit.Assert.*;
|
|
|
17
15
|
*/
|
|
18
16
|
@RunWith(AndroidJUnit4.class)
|
|
19
17
|
public class ExampleInstrumentedTest {
|
|
18
|
+
|
|
20
19
|
@Test
|
|
21
20
|
public void useAppContext() throws Exception {
|
|
22
21
|
// Context of the app under test.
|
|
@@ -12,120 +12,106 @@ 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
|
-
|
|
33
|
-
} catch (Exception ex) {
|
|
34
|
-
call.error(ex.getLocalizedMessage());
|
|
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(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appId));
|
|
23
|
+
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
24
|
+
context.startActivity(intent);
|
|
25
|
+
|
|
26
|
+
call.resolve();
|
|
27
|
+
} else {
|
|
28
|
+
call.reject("appId is missing");
|
|
29
|
+
}
|
|
30
|
+
} catch (Exception ex) {
|
|
31
|
+
call.error(ex.getLocalizedMessage());
|
|
32
|
+
}
|
|
35
33
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
} catch (Exception ex) {
|
|
57
|
-
call.error(ex.getLocalizedMessage());
|
|
34
|
+
|
|
35
|
+
@PluginMethod
|
|
36
|
+
public void openDevPage(PluginCall call) {
|
|
37
|
+
try {
|
|
38
|
+
if (call.hasOption("devId")) {
|
|
39
|
+
String devId = call.getString("devId");
|
|
40
|
+
|
|
41
|
+
Context context = this.getContext();
|
|
42
|
+
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
43
|
+
intent.setData(Uri.parse("https://play.google.com/store/apps/dev?id=" + devId));
|
|
44
|
+
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
45
|
+
context.startActivity(intent);
|
|
46
|
+
|
|
47
|
+
call.resolve();
|
|
48
|
+
} else {
|
|
49
|
+
call.reject("devId is missing");
|
|
50
|
+
}
|
|
51
|
+
} catch (Exception ex) {
|
|
52
|
+
call.error(ex.getLocalizedMessage());
|
|
53
|
+
}
|
|
58
54
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
} catch (Exception ex) {
|
|
80
|
-
call.error(ex.getLocalizedMessage());
|
|
55
|
+
|
|
56
|
+
@PluginMethod
|
|
57
|
+
public void openCollection(PluginCall call) {
|
|
58
|
+
try {
|
|
59
|
+
if (call.hasOption("name")) {
|
|
60
|
+
String name = call.getString("name");
|
|
61
|
+
|
|
62
|
+
Context context = this.getContext();
|
|
63
|
+
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
64
|
+
intent.setData(Uri.parse("https://play.google.com/store/apps/collection/" + name));
|
|
65
|
+
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
66
|
+
context.startActivity(intent);
|
|
67
|
+
|
|
68
|
+
call.resolve();
|
|
69
|
+
} else {
|
|
70
|
+
call.reject("name is missing");
|
|
71
|
+
}
|
|
72
|
+
} catch (Exception ex) {
|
|
73
|
+
call.error(ex.getLocalizedMessage());
|
|
74
|
+
}
|
|
81
75
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
call.reject("editorChoice is missing");
|
|
103
|
-
}
|
|
104
|
-
} catch (Exception ex) {
|
|
105
|
-
call.error(ex.getLocalizedMessage());
|
|
76
|
+
|
|
77
|
+
@PluginMethod
|
|
78
|
+
public void openEditorChoicePage(PluginCall call) {
|
|
79
|
+
try {
|
|
80
|
+
if (call.hasOption("editorChoice")) {
|
|
81
|
+
String editorChoice = call.getString("editorChoice");
|
|
82
|
+
|
|
83
|
+
Context context = this.getContext();
|
|
84
|
+
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
85
|
+
intent.setData(Uri.parse("https://play.google.com/store/apps/topic?id=" + editorChoice));
|
|
86
|
+
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
87
|
+
context.startActivity(intent);
|
|
88
|
+
|
|
89
|
+
call.resolve();
|
|
90
|
+
} else {
|
|
91
|
+
call.reject("editorChoice is missing");
|
|
92
|
+
}
|
|
93
|
+
} catch (Exception ex) {
|
|
94
|
+
call.error(ex.getLocalizedMessage());
|
|
95
|
+
}
|
|
106
96
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
} catch (Exception ex) {
|
|
128
|
-
call.error(ex.getLocalizedMessage());
|
|
97
|
+
|
|
98
|
+
@PluginMethod
|
|
99
|
+
public void search(PluginCall call) {
|
|
100
|
+
try {
|
|
101
|
+
if (call.hasOption("terms")) {
|
|
102
|
+
String terms = call.getString("terms");
|
|
103
|
+
|
|
104
|
+
Context context = this.getContext();
|
|
105
|
+
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=" + terms));
|
|
106
|
+
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
107
|
+
context.startActivity(intent);
|
|
108
|
+
|
|
109
|
+
call.resolve();
|
|
110
|
+
} else {
|
|
111
|
+
call.reject("terms is missing");
|
|
112
|
+
}
|
|
113
|
+
} catch (Exception ex) {
|
|
114
|
+
call.error(ex.getLocalizedMessage());
|
|
115
|
+
}
|
|
129
116
|
}
|
|
130
|
-
}
|
|
131
117
|
}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
package com.getcapacitor;
|
|
2
2
|
|
|
3
|
-
import org.junit.Test;
|
|
4
|
-
|
|
5
3
|
import static org.junit.Assert.*;
|
|
6
4
|
|
|
5
|
+
import org.junit.Test;
|
|
6
|
+
|
|
7
7
|
/**
|
|
8
8
|
* Example local unit test, which will execute on the development machine (host).
|
|
9
9
|
*
|
|
10
10
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
|
11
11
|
*/
|
|
12
12
|
public class ExampleUnitTest {
|
|
13
|
+
|
|
13
14
|
@Test
|
|
14
15
|
public void addition_isCorrect() throws Exception {
|
|
15
16
|
assertEquals(4, 2 + 2);
|
|
16
17
|
}
|
|
17
|
-
}
|
|
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/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,YAAY,GAAG,cAAc,CAAqB,cAAc,EAAE;IACtE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;CAChE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WebPlugin } from
|
|
2
|
-
import { 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;
|
|
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,QAA2B;QAC1C,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"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var core = require('@capacitor/core');
|
|
6
|
+
|
|
7
|
+
const NativeMarket = core.registerPlugin('NativeMarket', {
|
|
8
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.NativeMarketWeb()),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
class NativeMarketWeb extends core.WebPlugin {
|
|
12
|
+
openStoreListing(_options) {
|
|
13
|
+
throw new Error('Method not implemented.');
|
|
14
|
+
}
|
|
15
|
+
openDevPage(_options) {
|
|
16
|
+
throw new Error('Method not implemented.');
|
|
17
|
+
}
|
|
18
|
+
openCollection(_options) {
|
|
19
|
+
throw new Error('Method not implemented.');
|
|
20
|
+
}
|
|
21
|
+
openEditorChoicePage(_options) {
|
|
22
|
+
throw new Error('Method not implemented.');
|
|
23
|
+
}
|
|
24
|
+
search(_options) {
|
|
25
|
+
throw new Error('Method not implemented.');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
30
|
+
__proto__: null,
|
|
31
|
+
NativeMarketWeb: NativeMarketWeb
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
exports.NativeMarket = NativeMarket;
|
|
35
|
+
//# sourceMappingURL=plugin.cjs.js.map
|
|
@@ -0,0 +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;;;;;;;;;"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var capacitorCapacitorUpdater = (function (exports, core) {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const NativeMarket = core.registerPlugin('NativeMarket', {
|
|
5
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.NativeMarketWeb()),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
class NativeMarketWeb extends core.WebPlugin {
|
|
9
|
+
openStoreListing(_options) {
|
|
10
|
+
throw new Error('Method not implemented.');
|
|
11
|
+
}
|
|
12
|
+
openDevPage(_options) {
|
|
13
|
+
throw new Error('Method not implemented.');
|
|
14
|
+
}
|
|
15
|
+
openCollection(_options) {
|
|
16
|
+
throw new Error('Method not implemented.');
|
|
17
|
+
}
|
|
18
|
+
openEditorChoicePage(_options) {
|
|
19
|
+
throw new Error('Method not implemented.');
|
|
20
|
+
}
|
|
21
|
+
search(_options) {
|
|
22
|
+
throw new Error('Method not implemented.');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
27
|
+
__proto__: null,
|
|
28
|
+
NativeMarketWeb: NativeMarketWeb
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
exports.NativeMarket = NativeMarket;
|
|
32
|
+
|
|
33
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
34
|
+
|
|
35
|
+
return exports;
|
|
36
|
+
|
|
37
|
+
})({}, capacitorExports);
|
|
38
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +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;;;;;;;;;;;;;;;;;"}
|
package/ios/Plugin/Plugin.swift
CHANGED
|
@@ -27,35 +27,33 @@ struct APIResult: Codable {
|
|
|
27
27
|
public class NativeMarket: CAPPlugin {
|
|
28
28
|
|
|
29
29
|
@objc func openStoreListing(_ call: CAPPluginCall) {
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
}
|
|
58
|
-
|
|
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/ios/Podfile
CHANGED
package/package.json
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/native-market",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.2",
|
|
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",
|
|
7
7
|
"types": "dist/esm/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"
|
|
9
|
+
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
10
|
+
"verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..",
|
|
11
|
+
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
12
|
+
"verify:web": "npm run build",
|
|
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",
|
|
15
|
+
"eslint": "eslint . --ext ts",
|
|
16
|
+
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
|
|
17
|
+
"swiftlint": "node-swiftlint",
|
|
18
|
+
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
|
|
10
19
|
"clean": "rimraf ./dist",
|
|
11
20
|
"watch": "tsc --watch",
|
|
12
21
|
"docgen": "docgen --api NativeMarketPlugin --output-readme README.md --output-json dist/docs.json",
|
|
13
22
|
"prepublishOnly": "npm run build",
|
|
14
|
-
"npm-publish": "np",
|
|
15
23
|
"prepare": "husky install"
|
|
16
24
|
},
|
|
17
25
|
"author": "Martin Donadieu <martindonadieu@gmail.com>",
|
|
@@ -22,15 +30,22 @@
|
|
|
22
30
|
"devDependencies": {
|
|
23
31
|
"@capacitor/android": "^4.4.0",
|
|
24
32
|
"@capacitor/cli": "^4.4.0",
|
|
33
|
+
"@capacitor/core": "^4.4.0",
|
|
25
34
|
"@capacitor/docgen": "^0.2.0",
|
|
26
35
|
"@capacitor/ios": "^4.4.0",
|
|
27
|
-
"@
|
|
36
|
+
"@ionic/eslint-config": "^0.3.0",
|
|
37
|
+
"@ionic/prettier-config": "^2.0.0",
|
|
38
|
+
"@ionic/swiftlint-config": "^1.1.2",
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^5.42.1",
|
|
40
|
+
"@typescript-eslint/parser": "^5.42.1",
|
|
41
|
+
"eslint": "^8.27.0",
|
|
42
|
+
"eslint-plugin-import": "^2.26.0",
|
|
28
43
|
"husky": "^8.0.2",
|
|
29
|
-
"np": "^7.6.2",
|
|
30
44
|
"prettier": "^2.7.1",
|
|
31
45
|
"prettier-plugin-java": "^1.6.2",
|
|
32
|
-
"pretty-quick": "^3.1.3",
|
|
33
46
|
"rimraf": "^3.0.2",
|
|
47
|
+
"rollup": "^2.79.1",
|
|
48
|
+
"swiftlint": "^1.0.1",
|
|
34
49
|
"typescript": "^4.8.4"
|
|
35
50
|
},
|
|
36
51
|
"files": [
|
|
@@ -52,6 +67,11 @@
|
|
|
52
67
|
"src": "android"
|
|
53
68
|
}
|
|
54
69
|
},
|
|
70
|
+
"prettier": "@ionic/prettier-config",
|
|
71
|
+
"swiftlint": "@ionic/swiftlint-config",
|
|
72
|
+
"eslintConfig": {
|
|
73
|
+
"extends": "@ionic/eslint-config/recommended"
|
|
74
|
+
},
|
|
55
75
|
"repository": {
|
|
56
76
|
"type": "git",
|
|
57
77
|
"url": "https://github.com/riderx/native-market"
|