com-easystep2-datawedge-plugin-intent-capacitor 4.3.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/android/build.gradle +55 -0
- package/android/src/main/AndroidManifest.xml +7 -0
- package/android/src/main/java/com/easystep2/datawedge/plugin/intent/IntentShimPlugin.java +96 -0
- package/com-easystep2-datawedge-plugin-intent-capacitor-4.3.2.tgz +0 -0
- package/esm/definitions.d.ts +62 -0
- package/esm/definitions.js +12 -0
- package/esm/definitions.js.map +1 -0
- package/esm/index.d.ts +14 -0
- package/esm/index.js +18 -0
- package/esm/index.js.map +1 -0
- package/esm/web.d.ts +46 -0
- package/esm/web.js +87 -0
- package/esm/web.js.map +1 -0
- package/package.json +31 -0
- package/plugin.cjs.js +32 -0
- package/plugin.cjs.js.map +1 -0
- package/plugin.js +35 -0
- package/plugin.js.map +1 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
ext {
|
|
2
|
+
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
|
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
|
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
buildscript {
|
|
9
|
+
repositories {
|
|
10
|
+
google()
|
|
11
|
+
mavenCentral()
|
|
12
|
+
}
|
|
13
|
+
dependencies {
|
|
14
|
+
classpath 'com.android.tools.build:gradle:7.2.1'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
apply plugin: 'com.android.library'
|
|
19
|
+
|
|
20
|
+
android {
|
|
21
|
+
namespace "com.easystep2.datawedge.plugin.intent"
|
|
22
|
+
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
|
|
23
|
+
defaultConfig {
|
|
24
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
|
|
25
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
|
|
26
|
+
versionCode 1
|
|
27
|
+
versionName "1.0"
|
|
28
|
+
}
|
|
29
|
+
buildTypes {
|
|
30
|
+
release {
|
|
31
|
+
minifyEnabled false
|
|
32
|
+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
lintOptions {
|
|
36
|
+
abortOnError false
|
|
37
|
+
}
|
|
38
|
+
compileOptions {
|
|
39
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
40
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
repositories {
|
|
45
|
+
mavenCentral()
|
|
46
|
+
google()
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
dependencies {
|
|
50
|
+
implementation project(':capacitor-android')
|
|
51
|
+
}
|
|
52
|
+
testImplementation "junit:junit:$junitVersion"
|
|
53
|
+
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
54
|
+
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
55
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
package com.easystep2.datawedge.plugin.intent;
|
|
2
|
+
|
|
3
|
+
import android.app.Activity;
|
|
4
|
+
import android.content.BroadcastReceiver;
|
|
5
|
+
import android.content.Context;
|
|
6
|
+
import android.content.Intent;
|
|
7
|
+
import android.content.IntentFilter;
|
|
8
|
+
import android.content.pm.PackageManager;
|
|
9
|
+
import android.net.Uri;
|
|
10
|
+
import android.os.Bundle;
|
|
11
|
+
import android.util.Log;
|
|
12
|
+
|
|
13
|
+
import com.getcapacitor.JSObject;
|
|
14
|
+
import com.getcapacitor.Plugin;
|
|
15
|
+
import com.getcapacitor.PluginCall;
|
|
16
|
+
import com.getcapacitor.PluginMethod;
|
|
17
|
+
import com.getcapacitor.annotation.CapacitorPlugin;
|
|
18
|
+
|
|
19
|
+
import org.json.JSONException;
|
|
20
|
+
import org.json.JSONObject;
|
|
21
|
+
|
|
22
|
+
import java.util.ArrayList;
|
|
23
|
+
import java.util.HashMap;
|
|
24
|
+
import java.util.Iterator;
|
|
25
|
+
import java.util.Map;
|
|
26
|
+
|
|
27
|
+
@CapacitorPlugin(name = "IntentShim")
|
|
28
|
+
public class IntentShimPlugin extends Plugin {
|
|
29
|
+
private static final String TAG = "IntentShim";
|
|
30
|
+
private BroadcastReceiver broadcastReceiver = null;
|
|
31
|
+
private boolean debugEnabled = false;
|
|
32
|
+
|
|
33
|
+
@PluginMethod
|
|
34
|
+
public void echo(PluginCall call) {
|
|
35
|
+
String value = call.getString("value");
|
|
36
|
+
JSObject ret = new JSObject();
|
|
37
|
+
ret.put("value", value);
|
|
38
|
+
call.resolve(ret);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@PluginMethod
|
|
42
|
+
public void registerBroadcastReceiver(PluginCall call) {
|
|
43
|
+
// Implementation for registering a broadcast receiver
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@PluginMethod
|
|
47
|
+
public void unregisterBroadcastReceiver(PluginCall call) {
|
|
48
|
+
// Implementation for unregistering a broadcast receiver
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@PluginMethod
|
|
52
|
+
public void sendBroadcast(PluginCall call) {
|
|
53
|
+
// Implementation for sending a broadcast
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@PluginMethod
|
|
57
|
+
public void startActivity(PluginCall call) {
|
|
58
|
+
// Implementation for starting an activity
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@PluginMethod
|
|
62
|
+
public void getIntent(PluginCall call) {
|
|
63
|
+
// Implementation for getting the current intent
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@PluginMethod
|
|
67
|
+
public void startActivityForResult(PluginCall call) {
|
|
68
|
+
// Implementation for starting an activity for result
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@PluginMethod
|
|
72
|
+
public void sendResult(PluginCall call) {
|
|
73
|
+
// Implementation for sending a result back to the calling activity
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@PluginMethod
|
|
77
|
+
public void onIntent(PluginCall call) {
|
|
78
|
+
// Implementation for registering an intent listener
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@PluginMethod
|
|
82
|
+
public void packageExists(PluginCall call) {
|
|
83
|
+
// Implementation for checking if a package exists
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@PluginMethod
|
|
87
|
+
public void setDebugMode(PluginCall call) {
|
|
88
|
+
// Implementation for enabling or disabling debug mode
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
private void log(String message) {
|
|
92
|
+
if (debugEnabled) {
|
|
93
|
+
Log.d(TAG, message);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export interface IntentShimPlugin {
|
|
2
|
+
registerBroadcastReceiver(options: {
|
|
3
|
+
filterActions: string[];
|
|
4
|
+
}): Promise<void>;
|
|
5
|
+
unregisterBroadcastReceiver(): Promise<void>;
|
|
6
|
+
sendBroadcast(options: {
|
|
7
|
+
action: string;
|
|
8
|
+
extras?: any;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
startActivity(options: {
|
|
11
|
+
action: string;
|
|
12
|
+
url?: string;
|
|
13
|
+
type?: string;
|
|
14
|
+
extras?: any;
|
|
15
|
+
}): Promise<void>;
|
|
16
|
+
getIntent(): Promise<{
|
|
17
|
+
action: string;
|
|
18
|
+
data: string;
|
|
19
|
+
type: string;
|
|
20
|
+
extras: any;
|
|
21
|
+
}>;
|
|
22
|
+
startActivityForResult(options: {
|
|
23
|
+
action: string;
|
|
24
|
+
url?: string;
|
|
25
|
+
type?: string;
|
|
26
|
+
extras?: any;
|
|
27
|
+
requestCode: number;
|
|
28
|
+
}): Promise<void>;
|
|
29
|
+
sendResult(options: {
|
|
30
|
+
extras?: any;
|
|
31
|
+
resultCode?: number;
|
|
32
|
+
}): Promise<void>;
|
|
33
|
+
onIntent(callback: (intent: {
|
|
34
|
+
action: string;
|
|
35
|
+
data: string;
|
|
36
|
+
type: string;
|
|
37
|
+
extras: any;
|
|
38
|
+
}) => void): void;
|
|
39
|
+
packageExists(packageName: string): Promise<{
|
|
40
|
+
exists: boolean;
|
|
41
|
+
}>;
|
|
42
|
+
setDebugMode(options: {
|
|
43
|
+
enabled: boolean;
|
|
44
|
+
}): Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
export interface IntentResult {
|
|
47
|
+
action: string;
|
|
48
|
+
data: string;
|
|
49
|
+
type: string;
|
|
50
|
+
extras: any;
|
|
51
|
+
requestCode?: number;
|
|
52
|
+
}
|
|
53
|
+
export declare const ACTION_SEND = "android.intent.action.SEND";
|
|
54
|
+
export declare const ACTION_VIEW = "android.intent.action.VIEW";
|
|
55
|
+
export declare const EXTRA_TEXT = "android.intent.extra.TEXT";
|
|
56
|
+
export declare const EXTRA_SUBJECT = "android.intent.extra.SUBJECT";
|
|
57
|
+
export declare const EXTRA_STREAM = "android.intent.extra.STREAM";
|
|
58
|
+
export declare const EXTRA_EMAIL = "android.intent.extra.EMAIL";
|
|
59
|
+
export declare const ACTION_CALL = "android.intent.action.CALL";
|
|
60
|
+
export declare const ACTION_SENDTO = "android.intent.action.SENDTO";
|
|
61
|
+
export declare const ACTION_GET_CONTENT = "android.intent.action.GET_CONTENT";
|
|
62
|
+
export declare const ACTION_PICK = "android.intent.action.PICK";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Constants that match the Android implementation
|
|
2
|
+
export const ACTION_SEND = 'android.intent.action.SEND';
|
|
3
|
+
export const ACTION_VIEW = 'android.intent.action.VIEW';
|
|
4
|
+
export const EXTRA_TEXT = 'android.intent.extra.TEXT';
|
|
5
|
+
export const EXTRA_SUBJECT = 'android.intent.extra.SUBJECT';
|
|
6
|
+
export const EXTRA_STREAM = 'android.intent.extra.STREAM';
|
|
7
|
+
export const EXTRA_EMAIL = 'android.intent.extra.EMAIL';
|
|
8
|
+
export const ACTION_CALL = 'android.intent.action.CALL';
|
|
9
|
+
export const ACTION_SENDTO = 'android.intent.action.SENDTO';
|
|
10
|
+
export const ACTION_GET_CONTENT = 'android.intent.action.GET_CONTENT';
|
|
11
|
+
export const ACTION_PICK = 'android.intent.action.PICK';
|
|
12
|
+
//# sourceMappingURL=definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/capacitor/definitions.ts"],"names":[],"mappings":"AAuBA,kDAAkD;AAClD,MAAM,CAAC,MAAM,WAAW,GAAG,4BAA4B,CAAC;AACxD,MAAM,CAAC,MAAM,WAAW,GAAG,4BAA4B,CAAC;AACxD,MAAM,CAAC,MAAM,UAAU,GAAG,2BAA2B,CAAC;AACtD,MAAM,CAAC,MAAM,aAAa,GAAG,8BAA8B,CAAC;AAC5D,MAAM,CAAC,MAAM,YAAY,GAAG,6BAA6B,CAAC;AAC1D,MAAM,CAAC,MAAM,WAAW,GAAG,4BAA4B,CAAC;AACxD,MAAM,CAAC,MAAM,WAAW,GAAG,4BAA4B,CAAC;AACxD,MAAM,CAAC,MAAM,aAAa,GAAG,8BAA8B,CAAC;AAC5D,MAAM,CAAC,MAAM,kBAAkB,GAAG,mCAAmC,CAAC;AACtE,MAAM,CAAC,MAAM,WAAW,GAAG,4BAA4B,CAAC","sourcesContent":["export interface IntentShimPlugin {\n // Core Intent functionality\n registerBroadcastReceiver(options: { filterActions: string[] }): Promise<void>;\n unregisterBroadcastReceiver(): Promise<void>;\n sendBroadcast(options: { action: string; extras?: any }): Promise<void>;\n startActivity(options: { action: string; url?: string; type?: string; extras?: any }): Promise<void>;\n getIntent(): Promise<{ action: string; data: string; type: string; extras: any }>;\n startActivityForResult(options: { action: string; url?: string; type?: string; extras?: any; requestCode: number }): Promise<void>;\n sendResult(options: { extras?: any; resultCode?: number }): Promise<void>;\n onIntent(callback: (intent: { action: string; data: string; type: string; extras: any }) => void): void;\n packageExists(packageName: string): Promise<{ exists: boolean }>;\n setDebugMode(options: { enabled: boolean }): Promise<void>;\n}\n\n// Intent response type\nexport interface IntentResult {\n action: string;\n data: string;\n type: string;\n extras: any;\n requestCode?: number;\n}\n\n// Constants that match the Android implementation\nexport const ACTION_SEND = 'android.intent.action.SEND';\nexport const ACTION_VIEW = 'android.intent.action.VIEW';\nexport const EXTRA_TEXT = 'android.intent.extra.TEXT';\nexport const EXTRA_SUBJECT = 'android.intent.extra.SUBJECT';\nexport const EXTRA_STREAM = 'android.intent.extra.STREAM';\nexport const EXTRA_EMAIL = 'android.intent.extra.EMAIL';\nexport const ACTION_CALL = 'android.intent.action.CALL';\nexport const ACTION_SENDTO = 'android.intent.action.SENDTO';\nexport const ACTION_GET_CONTENT = 'android.intent.action.GET_CONTENT';\nexport const ACTION_PICK = 'android.intent.action.PICK';\n"]}
|
package/esm/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IntentShimPlugin } from './definitions';
|
|
2
|
+
declare const IntentShim: IntentShimPlugin;
|
|
3
|
+
export declare const ACTION_SEND = "android.intent.action.SEND";
|
|
4
|
+
export declare const ACTION_VIEW = "android.intent.action.VIEW";
|
|
5
|
+
export declare const EXTRA_TEXT = "android.intent.extra.TEXT";
|
|
6
|
+
export declare const EXTRA_SUBJECT = "android.intent.extra.SUBJECT";
|
|
7
|
+
export declare const EXTRA_STREAM = "android.intent.extra.STREAM";
|
|
8
|
+
export declare const EXTRA_EMAIL = "android.intent.extra.EMAIL";
|
|
9
|
+
export declare const ACTION_CALL = "android.intent.action.CALL";
|
|
10
|
+
export declare const ACTION_SENDTO = "android.intent.action.SENDTO";
|
|
11
|
+
export declare const ACTION_GET_CONTENT = "android.intent.action.GET_CONTENT";
|
|
12
|
+
export declare const ACTION_PICK = "android.intent.action.PICK";
|
|
13
|
+
export * from './definitions';
|
|
14
|
+
export { IntentShim };
|
package/esm/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { registerPlugin } from '@capacitor/core';
|
|
2
|
+
// Register the plugin
|
|
3
|
+
const IntentShim = registerPlugin('IntentShim');
|
|
4
|
+
// Export constants for direct usage in client code, matching the Cordova plugin's API
|
|
5
|
+
export const ACTION_SEND = 'android.intent.action.SEND';
|
|
6
|
+
export const ACTION_VIEW = 'android.intent.action.VIEW';
|
|
7
|
+
export const EXTRA_TEXT = 'android.intent.extra.TEXT';
|
|
8
|
+
export const EXTRA_SUBJECT = 'android.intent.extra.SUBJECT';
|
|
9
|
+
export const EXTRA_STREAM = 'android.intent.extra.STREAM';
|
|
10
|
+
export const EXTRA_EMAIL = 'android.intent.extra.EMAIL';
|
|
11
|
+
export const ACTION_CALL = 'android.intent.action.CALL';
|
|
12
|
+
export const ACTION_SENDTO = 'android.intent.action.SENDTO';
|
|
13
|
+
export const ACTION_GET_CONTENT = 'android.intent.action.GET_CONTENT';
|
|
14
|
+
export const ACTION_PICK = 'android.intent.action.PICK';
|
|
15
|
+
// Export the plugin interface and implementation
|
|
16
|
+
export * from './definitions';
|
|
17
|
+
export { IntentShim };
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/capacitor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,sBAAsB;AACtB,MAAM,UAAU,GAAG,cAAc,CAAmB,YAAY,CAAC,CAAC;AAElE,sFAAsF;AACtF,MAAM,CAAC,MAAM,WAAW,GAAG,4BAA4B,CAAC;AACxD,MAAM,CAAC,MAAM,WAAW,GAAG,4BAA4B,CAAC;AACxD,MAAM,CAAC,MAAM,UAAU,GAAG,2BAA2B,CAAC;AACtD,MAAM,CAAC,MAAM,aAAa,GAAG,8BAA8B,CAAC;AAC5D,MAAM,CAAC,MAAM,YAAY,GAAG,6BAA6B,CAAC;AAC1D,MAAM,CAAC,MAAM,WAAW,GAAG,4BAA4B,CAAC;AACxD,MAAM,CAAC,MAAM,WAAW,GAAG,4BAA4B,CAAC;AACxD,MAAM,CAAC,MAAM,aAAa,GAAG,8BAA8B,CAAC;AAC5D,MAAM,CAAC,MAAM,kBAAkB,GAAG,mCAAmC,CAAC;AACtE,MAAM,CAAC,MAAM,WAAW,GAAG,4BAA4B,CAAC;AAExD,iDAAiD;AACjD,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\nimport type { IntentShimPlugin } from './definitions';\n\n// Register the plugin\nconst IntentShim = registerPlugin<IntentShimPlugin>('IntentShim');\n\n// Export constants for direct usage in client code, matching the Cordova plugin's API\nexport const ACTION_SEND = 'android.intent.action.SEND';\nexport const ACTION_VIEW = 'android.intent.action.VIEW';\nexport const EXTRA_TEXT = 'android.intent.extra.TEXT';\nexport const EXTRA_SUBJECT = 'android.intent.extra.SUBJECT';\nexport const EXTRA_STREAM = 'android.intent.extra.STREAM';\nexport const EXTRA_EMAIL = 'android.intent.extra.EMAIL';\nexport const ACTION_CALL = 'android.intent.action.CALL';\nexport const ACTION_SENDTO = 'android.intent.action.SENDTO';\nexport const ACTION_GET_CONTENT = 'android.intent.action.GET_CONTENT';\nexport const ACTION_PICK = 'android.intent.action.PICK';\n\n// Export the plugin interface and implementation\nexport * from './definitions';\nexport { IntentShim };\n"]}
|
package/esm/web.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { IntentShimPlugin, IntentResult } from './definitions';
|
|
3
|
+
export declare class IntentShimWeb extends WebPlugin implements IntentShimPlugin {
|
|
4
|
+
private intentListeners;
|
|
5
|
+
private debug;
|
|
6
|
+
constructor();
|
|
7
|
+
registerBroadcastReceiver(options: {
|
|
8
|
+
filterActions: string[];
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
unregisterBroadcastReceiver(): Promise<void>;
|
|
11
|
+
sendBroadcast(options: {
|
|
12
|
+
action: string;
|
|
13
|
+
extras?: any;
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
startActivity(options: {
|
|
16
|
+
action: string;
|
|
17
|
+
url?: string;
|
|
18
|
+
type?: string;
|
|
19
|
+
extras?: any;
|
|
20
|
+
}): Promise<void>;
|
|
21
|
+
getIntent(): Promise<{
|
|
22
|
+
action: string;
|
|
23
|
+
data: string;
|
|
24
|
+
type: string;
|
|
25
|
+
extras: any;
|
|
26
|
+
}>;
|
|
27
|
+
startActivityForResult(options: {
|
|
28
|
+
action: string;
|
|
29
|
+
url?: string;
|
|
30
|
+
type?: string;
|
|
31
|
+
extras?: any;
|
|
32
|
+
requestCode: number;
|
|
33
|
+
}): Promise<void>;
|
|
34
|
+
sendResult(options: {
|
|
35
|
+
extras?: any;
|
|
36
|
+
resultCode?: number;
|
|
37
|
+
}): Promise<void>;
|
|
38
|
+
onIntent(callback: (intent: IntentResult) => void): void;
|
|
39
|
+
packageExists(packageName: string): Promise<{
|
|
40
|
+
exists: boolean;
|
|
41
|
+
}>;
|
|
42
|
+
setDebugMode(options: {
|
|
43
|
+
enabled: boolean;
|
|
44
|
+
}): Promise<void>;
|
|
45
|
+
private log;
|
|
46
|
+
}
|
package/esm/web.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { WebPlugin } from '@capacitor/core';
|
|
11
|
+
export class IntentShimWeb extends WebPlugin {
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
this.intentListeners = [];
|
|
15
|
+
this.debug = false;
|
|
16
|
+
this.log('IntentShim Web: Initialized');
|
|
17
|
+
}
|
|
18
|
+
registerBroadcastReceiver(options) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
this.log(`IntentShim Web: registerBroadcastReceiver with filters ${JSON.stringify(options.filterActions)}`);
|
|
21
|
+
throw this.unavailable('Not available in web environment');
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
unregisterBroadcastReceiver() {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
this.log('IntentShim Web: unregisterBroadcastReceiver');
|
|
27
|
+
throw this.unavailable('Not available in web environment');
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
sendBroadcast(options) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
this.log(`IntentShim Web: sendBroadcast ${options.action}`);
|
|
33
|
+
throw this.unavailable('Not available in web environment');
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
startActivity(options) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
this.log(`IntentShim Web: startActivity ${options.action}`);
|
|
39
|
+
// For web, we can at least try to open URLs
|
|
40
|
+
if (options.url && options.action === 'android.intent.action.VIEW') {
|
|
41
|
+
window.open(options.url, '_blank');
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
throw this.unavailable('Full intent functionality not available in web environment');
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
getIntent() {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
this.log('IntentShim Web: getIntent');
|
|
50
|
+
throw this.unavailable('Not available in web environment');
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
startActivityForResult(options) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
this.log(`IntentShim Web: startActivityForResult ${options.action}`);
|
|
56
|
+
throw this.unavailable('Not available in web environment');
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
sendResult(options) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
this.log(`IntentShim Web: sendResult with resultCode ${options.resultCode || 'none'} and extras ${JSON.stringify(options.extras || {})}`);
|
|
62
|
+
throw this.unavailable('Not available in web environment');
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
onIntent(callback) {
|
|
66
|
+
this.log('IntentShim Web: onIntent listener registered');
|
|
67
|
+
this.intentListeners.push(callback);
|
|
68
|
+
}
|
|
69
|
+
packageExists(packageName) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
this.log(`IntentShim Web: packageExists ${packageName}`);
|
|
72
|
+
return { exists: false };
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
setDebugMode(options) {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
this.debug = options.enabled;
|
|
78
|
+
this.log(`IntentShim Web: Debug mode ${options.enabled ? 'enabled' : 'disabled'}`);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
log(message) {
|
|
82
|
+
if (this.debug) {
|
|
83
|
+
console.log(message);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//#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AC;YACb,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACzB,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { IntentShimPlugin, IntentResult } from './definitions';\n\nexport class IntentShimWeb extends WebPlugin implements IntentShimPlugin {\n private intentListeners: ((intent: IntentResult) => void)[] = [];\n private debug: boolean = false;\n\n constructor() {\n super();\n this.log('IntentShim Web: Initialized');\n }\n\n async registerBroadcastReceiver(options: { filterActions: string[] }): Promise<void> {\n this.log(`IntentShim Web: registerBroadcastReceiver with filters ${JSON.stringify(options.filterActions)}`);\n throw this.unavailable('Not available in web environment');\n }\n\n async unregisterBroadcastReceiver(): Promise<void> {\n this.log('IntentShim Web: unregisterBroadcastReceiver');\n throw this.unavailable('Not available in web environment');\n }\n\n async sendBroadcast(options: { action: string; extras?: any }): Promise<void> {\n this.log(`IntentShim Web: sendBroadcast ${options.action}`);\n throw this.unavailable('Not available in web environment');\n }\n\n async startActivity(options: { action: string; url?: string; type?: string; extras?: any }): Promise<void> {\n this.log(`IntentShim Web: startActivity ${options.action}`);\n // For web, we can at least try to open URLs\n if (options.url && options.action === 'android.intent.action.VIEW') {\n window.open(options.url, '_blank');\n return;\n }\n throw this.unavailable('Full intent functionality not available in web environment');\n }\n\n async getIntent(): Promise<{ action: string; data: string; type: string; extras: any }> {\n this.log('IntentShim Web: getIntent');\n throw this.unavailable('Not available in web environment');\n }\n\n async startActivityForResult(options: {\n action: string; url?: string; type?: string; extras?: any; requestCode: number\n }): Promise<void> {\n this.log(`IntentShim Web: startActivityForResult ${options.action}`);\n throw this.unavailable('Not available in web environment');\n }\n\n async sendResult(options: { extras?: any; resultCode?: number }): Promise<void> {\n this.log(`IntentShim Web: sendResult with resultCode ${options.resultCode || 'none'} and extras ${JSON.stringify(options.extras || {})}`);\n throw this.unavailable('Not available in web environment');\n }\n\n onIntent(callback: (intent: IntentResult) => void): void {\n this.log('IntentShim Web: onIntent listener registered');\n this.intentListeners.push(callback);\n }\n\n async packageExists(packageName: string): Promise<{ exists: boolean }> {\n this.log(`IntentShim Web: packageExists ${packageName}`);\n return { exists: false };\n }\n\n async setDebugMode(options: { enabled: boolean }): Promise<void> {\n this.debug = options.enabled;\n this.log(`IntentShim Web: Debug mode ${options.enabled ? 'enabled' : 'disabled'}`);\n }\n\n private log(message: string): void {\n if (this.debug) {\n console.log(message);\n }\n }\n}\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "com-easystep2-datawedge-plugin-intent-capacitor",
|
|
3
|
+
"version": "4.3.2",
|
|
4
|
+
"description": "Capacitor plugin for Android Intents",
|
|
5
|
+
"main": "plugin.js",
|
|
6
|
+
"module": "esm/index.js",
|
|
7
|
+
"types": "esm/index.d.ts",
|
|
8
|
+
"author": "Easystep2",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/easystep2/easystep2-datawedge-plugin-intent.git"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"capacitor",
|
|
16
|
+
"plugin",
|
|
17
|
+
"intent",
|
|
18
|
+
"datawedge",
|
|
19
|
+
"zebra",
|
|
20
|
+
"scanner",
|
|
21
|
+
"barcode"
|
|
22
|
+
],
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@capacitor/core": ">=4.0.0"
|
|
25
|
+
},
|
|
26
|
+
"capacitor": {
|
|
27
|
+
"android": {
|
|
28
|
+
"src": "android"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
package/plugin.cjs.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var core = require('@capacitor/core');
|
|
6
|
+
|
|
7
|
+
// Register the plugin
|
|
8
|
+
const IntentShim = core.registerPlugin('IntentShim');
|
|
9
|
+
// Export constants for direct usage in client code, matching the Cordova plugin's API
|
|
10
|
+
const ACTION_SEND = 'android.intent.action.SEND';
|
|
11
|
+
const ACTION_VIEW = 'android.intent.action.VIEW';
|
|
12
|
+
const EXTRA_TEXT = 'android.intent.extra.TEXT';
|
|
13
|
+
const EXTRA_SUBJECT = 'android.intent.extra.SUBJECT';
|
|
14
|
+
const EXTRA_STREAM = 'android.intent.extra.STREAM';
|
|
15
|
+
const EXTRA_EMAIL = 'android.intent.extra.EMAIL';
|
|
16
|
+
const ACTION_CALL = 'android.intent.action.CALL';
|
|
17
|
+
const ACTION_SENDTO = 'android.intent.action.SENDTO';
|
|
18
|
+
const ACTION_GET_CONTENT = 'android.intent.action.GET_CONTENT';
|
|
19
|
+
const ACTION_PICK = 'android.intent.action.PICK';
|
|
20
|
+
|
|
21
|
+
exports.ACTION_CALL = ACTION_CALL;
|
|
22
|
+
exports.ACTION_GET_CONTENT = ACTION_GET_CONTENT;
|
|
23
|
+
exports.ACTION_PICK = ACTION_PICK;
|
|
24
|
+
exports.ACTION_SEND = ACTION_SEND;
|
|
25
|
+
exports.ACTION_SENDTO = ACTION_SENDTO;
|
|
26
|
+
exports.ACTION_VIEW = ACTION_VIEW;
|
|
27
|
+
exports.EXTRA_EMAIL = EXTRA_EMAIL;
|
|
28
|
+
exports.EXTRA_STREAM = EXTRA_STREAM;
|
|
29
|
+
exports.EXTRA_SUBJECT = EXTRA_SUBJECT;
|
|
30
|
+
exports.EXTRA_TEXT = EXTRA_TEXT;
|
|
31
|
+
exports.IntentShim = IntentShim;
|
|
32
|
+
//# sourceMappingURL=plugin.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\n// Register the plugin\nconst IntentShim = registerPlugin('IntentShim');\n// Export constants for direct usage in client code, matching the Cordova plugin's API\nexport const ACTION_SEND = 'android.intent.action.SEND';\nexport const ACTION_VIEW = 'android.intent.action.VIEW';\nexport const EXTRA_TEXT = 'android.intent.extra.TEXT';\nexport const EXTRA_SUBJECT = 'android.intent.extra.SUBJECT';\nexport const EXTRA_STREAM = 'android.intent.extra.STREAM';\nexport const EXTRA_EMAIL = 'android.intent.extra.EMAIL';\nexport const ACTION_CALL = 'android.intent.action.CALL';\nexport const ACTION_SENDTO = 'android.intent.action.SENDTO';\nexport const ACTION_GET_CONTENT = 'android.intent.action.GET_CONTENT';\nexport const ACTION_PICK = 'android.intent.action.PICK';\n// Export the plugin interface and implementation\nexport * from './definitions';\nexport { IntentShim };\n//# sourceMappingURL=index.js.map"],"names":["registerPlugin"],"mappings":";;;;;;AACA;AACK,MAAC,UAAU,GAAGA,mBAAc,CAAC,YAAY,EAAE;AAChD;AACY,MAAC,WAAW,GAAG,6BAA6B;AAC5C,MAAC,WAAW,GAAG,6BAA6B;AAC5C,MAAC,UAAU,GAAG,4BAA4B;AAC1C,MAAC,aAAa,GAAG,+BAA+B;AAChD,MAAC,YAAY,GAAG,8BAA8B;AAC9C,MAAC,WAAW,GAAG,6BAA6B;AAC5C,MAAC,WAAW,GAAG,6BAA6B;AAC5C,MAAC,aAAa,GAAG,+BAA+B;AAChD,MAAC,kBAAkB,GAAG,oCAAoC;AAC1D,MAAC,WAAW,GAAG;;;;;;;;;;;;;;"}
|
package/plugin.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var capacitorIntentShim = (function (exports, core) {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// Register the plugin
|
|
5
|
+
const IntentShim = core.registerPlugin('IntentShim');
|
|
6
|
+
// Export constants for direct usage in client code, matching the Cordova plugin's API
|
|
7
|
+
const ACTION_SEND = 'android.intent.action.SEND';
|
|
8
|
+
const ACTION_VIEW = 'android.intent.action.VIEW';
|
|
9
|
+
const EXTRA_TEXT = 'android.intent.extra.TEXT';
|
|
10
|
+
const EXTRA_SUBJECT = 'android.intent.extra.SUBJECT';
|
|
11
|
+
const EXTRA_STREAM = 'android.intent.extra.STREAM';
|
|
12
|
+
const EXTRA_EMAIL = 'android.intent.extra.EMAIL';
|
|
13
|
+
const ACTION_CALL = 'android.intent.action.CALL';
|
|
14
|
+
const ACTION_SENDTO = 'android.intent.action.SENDTO';
|
|
15
|
+
const ACTION_GET_CONTENT = 'android.intent.action.GET_CONTENT';
|
|
16
|
+
const ACTION_PICK = 'android.intent.action.PICK';
|
|
17
|
+
|
|
18
|
+
exports.ACTION_CALL = ACTION_CALL;
|
|
19
|
+
exports.ACTION_GET_CONTENT = ACTION_GET_CONTENT;
|
|
20
|
+
exports.ACTION_PICK = ACTION_PICK;
|
|
21
|
+
exports.ACTION_SEND = ACTION_SEND;
|
|
22
|
+
exports.ACTION_SENDTO = ACTION_SENDTO;
|
|
23
|
+
exports.ACTION_VIEW = ACTION_VIEW;
|
|
24
|
+
exports.EXTRA_EMAIL = EXTRA_EMAIL;
|
|
25
|
+
exports.EXTRA_STREAM = EXTRA_STREAM;
|
|
26
|
+
exports.EXTRA_SUBJECT = EXTRA_SUBJECT;
|
|
27
|
+
exports.EXTRA_TEXT = EXTRA_TEXT;
|
|
28
|
+
exports.IntentShim = IntentShim;
|
|
29
|
+
|
|
30
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
31
|
+
|
|
32
|
+
return exports;
|
|
33
|
+
|
|
34
|
+
})({}, capacitorExports);
|
|
35
|
+
//# sourceMappingURL=plugin.js.map
|
package/plugin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\n// Register the plugin\nconst IntentShim = registerPlugin('IntentShim');\n// Export constants for direct usage in client code, matching the Cordova plugin's API\nexport const ACTION_SEND = 'android.intent.action.SEND';\nexport const ACTION_VIEW = 'android.intent.action.VIEW';\nexport const EXTRA_TEXT = 'android.intent.extra.TEXT';\nexport const EXTRA_SUBJECT = 'android.intent.extra.SUBJECT';\nexport const EXTRA_STREAM = 'android.intent.extra.STREAM';\nexport const EXTRA_EMAIL = 'android.intent.extra.EMAIL';\nexport const ACTION_CALL = 'android.intent.action.CALL';\nexport const ACTION_SENDTO = 'android.intent.action.SENDTO';\nexport const ACTION_GET_CONTENT = 'android.intent.action.GET_CONTENT';\nexport const ACTION_PICK = 'android.intent.action.PICK';\n// Export the plugin interface and implementation\nexport * from './definitions';\nexport { IntentShim };\n//# sourceMappingURL=index.js.map"],"names":["registerPlugin"],"mappings":";;;CACA;AACK,OAAC,UAAU,GAAGA,mBAAc,CAAC,YAAY,EAAE;CAChD;AACY,OAAC,WAAW,GAAG,6BAA6B;AAC5C,OAAC,WAAW,GAAG,6BAA6B;AAC5C,OAAC,UAAU,GAAG,4BAA4B;AAC1C,OAAC,aAAa,GAAG,+BAA+B;AAChD,OAAC,YAAY,GAAG,8BAA8B;AAC9C,OAAC,WAAW,GAAG,6BAA6B;AAC5C,OAAC,WAAW,GAAG,6BAA6B;AAC5C,OAAC,aAAa,GAAG,+BAA+B;AAChD,OAAC,kBAAkB,GAAG,oCAAoC;AAC1D,OAAC,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;"}
|