@cronapp/intent-activity 1.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/cronapp.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "postUpdate": {
3
+ "ionic": {
4
+ "includes": [
5
+ {
6
+ "file": "index.html",
7
+ "script": "node_modules/@cronapp/intent-activity/dist/js/intent.activity.cronapi.js",
8
+ "type": "script"
9
+ }
10
+ ],
11
+ "cordova": [
12
+ {
13
+ "name": "com-darryncampbell-cordova-plugin-intent",
14
+ "version": "2.2.0"
15
+ }
16
+ ]
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "startActivity": "Start Activity",
3
+ "startActivityDescription": "Function to start an activity through an intent",
4
+ "packageExists": "Does the package exist?",
5
+ "packageExistsDescription": "Function to check if the package exists to be used with the intent",
6
+ "actionTitle": "Action",
7
+ "packageTitle": "Package",
8
+ "urlTitle": "Url",
9
+ "requestCodeTitle": "Request Code",
10
+ "extrasTitle": "Extra Parameters",
11
+ "yes": "Yes",
12
+ "no": "No",
13
+ "waitActivity": "Wait for Activity Return"
14
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "startActivity": "Iniciar Atividade",
3
+ "startActivityDescription": "Função para iniciar uma atividade através de uma intenção (intent)",
4
+ "packageExists": "Existe o pacote?",
5
+ "packageExistsDescription": "Função para verficar se Existe o pacote para ser utilizado com a intenção (intent)",
6
+ "actionTitle": "Ação",
7
+ "packageTitle": "Pacote",
8
+ "urlTitle": "Url",
9
+ "requestCodeTitle": "Codigo do Request",
10
+ "extrasTitle": "Parâmetros Extras",
11
+ "yes": "Sim",
12
+ "no": "Não",
13
+ "waitActivity": "Aguardar Retorno da Atividade"
14
+ }
@@ -0,0 +1,70 @@
1
+ (function () {
2
+ 'use strict';
3
+
4
+ this.cronapi = this.cronapi || {};
5
+
6
+ /**
7
+ * @categoryName Intent
8
+ */
9
+ this.cronapi.intent = this.cronapi.intent || {};
10
+
11
+ /**
12
+ * @type function
13
+ * @name {{startActivity}}
14
+ * @nameTags startActivity|Iniciar atividade| Intent| Intenção| Iniciar intenção| Atividade| Activity
15
+ * @platform M
16
+ * @returns {ObjectType.Object}
17
+ * @description {{startActivityDescription}}
18
+ *
19
+ */
20
+ this.cronapi.intent.startActivity = async function(/** @type {ObjectType.STRING} @description {{actionTitle}} */ action, /** @type {ObjectType.STRING} @description {{packageTitle}} */ pack, /** @type {ObjectType.STRING} @description {{urlTitle}} */ url, /** @type {ObjectType.LONG} @description {{requestCodeTitle}} */ requestCode, /** @type {ObjectType.BOOLEAN} @description {{waitActivity}} @blockType util_dropdown @keys true|false @values {{yes}}|{{no}} */ waitActivity, /** @type {ObjectType.OBJECT} @description {{extrasTitle}} */ extras) {
21
+ let rawJson = {
22
+ action: action,
23
+ package: pack,
24
+ url: url,
25
+ requestCode: requestCode,
26
+ extras: extras
27
+ };
28
+
29
+ for (let name in rawJson) {
30
+ if (!rawJson[name]) delete rawJson[name];
31
+ }
32
+
33
+ let callFunction = eval(waitActivity) ? "startActivityForResult" : "startActivity";
34
+
35
+ return new Promise((resolve, reject) => {
36
+ try {
37
+ window.plugins.intentShim[callFunction](
38
+ rawJson,
39
+ (r) => resolve(r),
40
+ (e) => reject(e)
41
+ );
42
+ }
43
+ catch (e) {
44
+ reject(e);
45
+ }
46
+ });
47
+ };
48
+
49
+ /**
50
+ * @type function
51
+ * @name {{packageExists}}
52
+ * @nameTags packageExists|Existe pacote| Intent| Intenção
53
+ * @platform M
54
+ * @returns {ObjectType.BOOLEAN}
55
+ * @description {{packageExistsDescription}}
56
+ *
57
+ */
58
+ this.cronapi.intent.packageExists = async function(/** @type {ObjectType.STRING} @description {{packageTitle}} */ pack) {
59
+
60
+ return new Promise((resolve, reject) => {
61
+ try {
62
+ window.plugins.intentShim.packageExists(pack, (exists) => resolve(exists) );
63
+ }
64
+ catch (e) {
65
+ reject(e);
66
+ }
67
+ });
68
+ };
69
+
70
+ }).bind(window)();
package/gulpfile.js ADDED
@@ -0,0 +1,14 @@
1
+ var gulp = require("gulp");
2
+
3
+ // Minify causa problema na leitura das tags cronapi, usar minify será feito futuramente como melhoria
4
+ gulp.task("copy-js", function() {
5
+ return gulp.src("js/**").pipe(gulp.dest("dist/js/"));
6
+ });
7
+
8
+ gulp.task("i18n", function() {
9
+ return gulp.src("i18n/**").pipe(gulp.dest("dist/i18n/"));
10
+ });
11
+
12
+ gulp.task('build', gulp.series('copy-js', 'i18n'));
13
+
14
+ gulp.task('default', gulp.series('build'));
@@ -0,0 +1,14 @@
1
+ {
2
+ "startActivity": "Start Activity",
3
+ "startActivityDescription": "Function to start an activity through an intent",
4
+ "packageExists": "Does the package exist?",
5
+ "packageExistsDescription": "Function to check if the package exists to be used with the intent",
6
+ "actionTitle": "Action",
7
+ "packageTitle": "Package",
8
+ "urlTitle": "Url",
9
+ "requestCodeTitle": "Request Code",
10
+ "extrasTitle": "Extra Parameters",
11
+ "yes": "Yes",
12
+ "no": "No",
13
+ "waitActivity": "Wait for Activity Return"
14
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "startActivity": "Iniciar Atividade",
3
+ "startActivityDescription": "Função para iniciar uma atividade através de uma intenção (intent)",
4
+ "packageExists": "Existe o pacote?",
5
+ "packageExistsDescription": "Função para verficar se Existe o pacote para ser utilizado com a intenção (intent)",
6
+ "actionTitle": "Ação",
7
+ "packageTitle": "Pacote",
8
+ "urlTitle": "Url",
9
+ "requestCodeTitle": "Codigo do Request",
10
+ "extrasTitle": "Parâmetros Extras",
11
+ "yes": "Sim",
12
+ "no": "Não",
13
+ "waitActivity": "Aguardar Retorno da Atividade"
14
+ }
@@ -0,0 +1,70 @@
1
+ (function () {
2
+ 'use strict';
3
+
4
+ this.cronapi = this.cronapi || {};
5
+
6
+ /**
7
+ * @categoryName Intent
8
+ */
9
+ this.cronapi.intent = this.cronapi.intent || {};
10
+
11
+ /**
12
+ * @type function
13
+ * @name {{startActivity}}
14
+ * @nameTags startActivity|Iniciar atividade| Intent| Intenção| Iniciar intenção| Atividade| Activity
15
+ * @platform M
16
+ * @returns {ObjectType.Object}
17
+ * @description {{startActivityDescription}}
18
+ *
19
+ */
20
+ this.cronapi.intent.startActivity = async function(/** @type {ObjectType.STRING} @description {{actionTitle}} */ action, /** @type {ObjectType.STRING} @description {{packageTitle}} */ pack, /** @type {ObjectType.STRING} @description {{urlTitle}} */ url, /** @type {ObjectType.LONG} @description {{requestCodeTitle}} */ requestCode, /** @type {ObjectType.BOOLEAN} @description {{waitActivity}} @blockType util_dropdown @keys true|false @values {{yes}}|{{no}} */ waitActivity, /** @type {ObjectType.OBJECT} @description {{extrasTitle}} */ extras) {
21
+ let rawJson = {
22
+ action: action,
23
+ package: pack,
24
+ url: url,
25
+ requestCode: requestCode,
26
+ extras: extras
27
+ };
28
+
29
+ for (let name in rawJson) {
30
+ if (!rawJson[name]) delete rawJson[name];
31
+ }
32
+
33
+ let callFunction = eval(waitActivity) ? "startActivityForResult" : "startActivity";
34
+
35
+ return new Promise((resolve, reject) => {
36
+ try {
37
+ window.plugins.intentShim[callFunction](
38
+ rawJson,
39
+ (r) => resolve(r),
40
+ (e) => reject(e)
41
+ );
42
+ }
43
+ catch (e) {
44
+ reject(e);
45
+ }
46
+ });
47
+ };
48
+
49
+ /**
50
+ * @type function
51
+ * @name {{packageExists}}
52
+ * @nameTags packageExists|Existe pacote| Intent| Intenção
53
+ * @platform M
54
+ * @returns {ObjectType.BOOLEAN}
55
+ * @description {{packageExistsDescription}}
56
+ *
57
+ */
58
+ this.cronapi.intent.packageExists = async function(/** @type {ObjectType.STRING} @description {{packageTitle}} */ pack) {
59
+
60
+ return new Promise((resolve, reject) => {
61
+ try {
62
+ window.plugins.intentShim.packageExists(pack, (exists) => resolve(exists) );
63
+ }
64
+ catch (e) {
65
+ reject(e);
66
+ }
67
+ });
68
+ };
69
+
70
+ }).bind(window)();