wifidirectplugin 0.0.1
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/Package.swift +28 -0
- package/README.md +37 -0
- package/Wifidirectplugin.podspec +17 -0
- package/android/build.gradle +58 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/ht/plugins/wifidirect/WifiDirect.java +11 -0
- package/android/src/main/java/com/ht/plugins/wifidirect/WifiDirectPlugin.java +107 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +31 -0
- package/dist/esm/definitions.d.ts +7 -0
- package/dist/esm/definitions.js +2 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +9 -0
- package/dist/esm/web.js +8 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +22 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +25 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Sources/WifiDirectPlugin/WifiDirect.swift +8 -0
- package/ios/Sources/WifiDirectPlugin/WifiDirectPlugin.swift +23 -0
- package/ios/Tests/WifiDirectPluginTests/WifiDirectPluginTests.swift +15 -0
- package/package.json +80 -0
package/Package.swift
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// swift-tools-version: 5.9
|
|
2
|
+
import PackageDescription
|
|
3
|
+
|
|
4
|
+
let package = Package(
|
|
5
|
+
name: "Wifidirectplugin",
|
|
6
|
+
platforms: [.iOS(.v14)],
|
|
7
|
+
products: [
|
|
8
|
+
.library(
|
|
9
|
+
name: "Wifidirectplugin",
|
|
10
|
+
targets: ["WifiDirectPlugin"])
|
|
11
|
+
],
|
|
12
|
+
dependencies: [
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0")
|
|
14
|
+
],
|
|
15
|
+
targets: [
|
|
16
|
+
.target(
|
|
17
|
+
name: "WifiDirectPlugin",
|
|
18
|
+
dependencies: [
|
|
19
|
+
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
|
20
|
+
.product(name: "Cordova", package: "capacitor-swift-pm")
|
|
21
|
+
],
|
|
22
|
+
path: "ios/Sources/WifiDirectPlugin"),
|
|
23
|
+
.testTarget(
|
|
24
|
+
name: "WifiDirectPluginTests",
|
|
25
|
+
dependencies: ["WifiDirectPlugin"],
|
|
26
|
+
path: "ios/Tests/WifiDirectPluginTests")
|
|
27
|
+
]
|
|
28
|
+
)
|
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# wifidirectplugin
|
|
2
|
+
|
|
3
|
+
HT-Installer Wifi Direct Plugin
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install wifidirectplugin
|
|
9
|
+
npx cap sync
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## API
|
|
13
|
+
|
|
14
|
+
<docgen-index>
|
|
15
|
+
|
|
16
|
+
* [`echo(...)`](#echo)
|
|
17
|
+
|
|
18
|
+
</docgen-index>
|
|
19
|
+
|
|
20
|
+
<docgen-api>
|
|
21
|
+
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
22
|
+
|
|
23
|
+
### echo(...)
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
echo(options: { value: string; }) => Promise<{ value: string; }>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
| Param | Type |
|
|
30
|
+
| ------------- | ------------------------------- |
|
|
31
|
+
| **`options`** | <code>{ value: string; }</code> |
|
|
32
|
+
|
|
33
|
+
**Returns:** <code>Promise<{ value: string; }></code>
|
|
34
|
+
|
|
35
|
+
--------------------
|
|
36
|
+
|
|
37
|
+
</docgen-api>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = 'Wifidirectplugin'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.license = package['license']
|
|
10
|
+
s.homepage = package['repository']['url']
|
|
11
|
+
s.author = package['author']
|
|
12
|
+
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
|
+
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
+
s.ios.deployment_target = '14.0'
|
|
15
|
+
s.dependency 'Capacitor'
|
|
16
|
+
s.swift_version = '5.1'
|
|
17
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
ext {
|
|
2
|
+
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
|
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
|
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
buildscript {
|
|
9
|
+
repositories {
|
|
10
|
+
google()
|
|
11
|
+
mavenCentral()
|
|
12
|
+
}
|
|
13
|
+
dependencies {
|
|
14
|
+
classpath 'com.android.tools.build:gradle:8.7.2'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
apply plugin: 'com.android.library'
|
|
19
|
+
|
|
20
|
+
android {
|
|
21
|
+
namespace "com.ht.plugins.wifidirect"
|
|
22
|
+
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
|
|
23
|
+
defaultConfig {
|
|
24
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
|
|
25
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
|
|
26
|
+
versionCode 1
|
|
27
|
+
versionName "1.0"
|
|
28
|
+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
29
|
+
}
|
|
30
|
+
buildTypes {
|
|
31
|
+
release {
|
|
32
|
+
minifyEnabled false
|
|
33
|
+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
lintOptions {
|
|
37
|
+
abortOnError false
|
|
38
|
+
}
|
|
39
|
+
compileOptions {
|
|
40
|
+
sourceCompatibility JavaVersion.VERSION_21
|
|
41
|
+
targetCompatibility JavaVersion.VERSION_21
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
repositories {
|
|
46
|
+
google()
|
|
47
|
+
mavenCentral()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
dependencies {
|
|
52
|
+
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
53
|
+
implementation project(':capacitor-android')
|
|
54
|
+
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
55
|
+
testImplementation "junit:junit:$junitVersion"
|
|
56
|
+
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
57
|
+
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
58
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
package com.ht.plugins.wifidirect;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.content.IntentFilter;
|
|
5
|
+
import android.content.BroadcastReceiver;
|
|
6
|
+
import android.net.wifi.p2p.WifiP2pDevice;
|
|
7
|
+
import android.net.wifi.p2p.WifiP2pManager;
|
|
8
|
+
import android.net.wifi.p2p.WifiP2pConfig;
|
|
9
|
+
import android.net.wifi.p2p.WifiP2pDeviceList;
|
|
10
|
+
|
|
11
|
+
import com.getcapacitor.JSObject;
|
|
12
|
+
import com.getcapacitor.Logger;
|
|
13
|
+
import com.getcapacitor.Plugin;
|
|
14
|
+
import com.getcapacitor.PluginCall;
|
|
15
|
+
import com.getcapacitor.PluginMethod;
|
|
16
|
+
import com.getcapacitor.annotation.CapacitorPlugin;
|
|
17
|
+
|
|
18
|
+
@CapacitorPlugin(name = "WifiDirect")
|
|
19
|
+
public class WifiDirectPlugin extends Plugin {
|
|
20
|
+
|
|
21
|
+
private WifiP2pManager manager;
|
|
22
|
+
private WifiP2pManager.Channel channel;
|
|
23
|
+
|
|
24
|
+
private BroadcastReceiver receiver;
|
|
25
|
+
private IntentFilter intentFilter;
|
|
26
|
+
|
|
27
|
+
@Override
|
|
28
|
+
public void load() {
|
|
29
|
+
// WifiP2pManager 초기화
|
|
30
|
+
Logger.info("WifiDirectPlugin loaded");
|
|
31
|
+
manager = (WifiP2pManager) getContext().getSystemService(Context.WIFI_P2P_SERVICE);
|
|
32
|
+
channel = manager.initialize(getContext(), getActivity().getMainLooper(), null);
|
|
33
|
+
|
|
34
|
+
intentFilter = new IntentFilter();
|
|
35
|
+
intentFilter.addAction(WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION);
|
|
36
|
+
|
|
37
|
+
intentFilter.addAction(WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION);
|
|
38
|
+
intentFilter.addAction(WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION);
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@PluginMethod
|
|
43
|
+
public void discoverAndConnect(PluginCall call) {
|
|
44
|
+
receiver = new BroadcastReceiver() {
|
|
45
|
+
@Override
|
|
46
|
+
public void onReceive(Context context, android.content.Intent intent) {
|
|
47
|
+
String action = intent.getAction();
|
|
48
|
+
if (WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION.equals(action)) {
|
|
49
|
+
manager.requestPeers(channel, new WifiP2pManager.PeerListListener() {
|
|
50
|
+
@Override
|
|
51
|
+
public void onPeersAvailable(WifiP2pDeviceList peerList) {
|
|
52
|
+
WifiP2pDevice targetDevice = null;
|
|
53
|
+
for (WifiP2pDevice device : peerList.getDeviceList()) {
|
|
54
|
+
if (device.deviceName != null && device.deviceName.startsWith("DIRECT-LINKVUE")) {
|
|
55
|
+
targetDevice = device;
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (targetDevice != null) {
|
|
60
|
+
connectToDevice(targetDevice, call);
|
|
61
|
+
} else {
|
|
62
|
+
call.reject("No Direct-LINKVUE device found");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
getContext().registerReceiver(receiver, intentFilter);
|
|
71
|
+
|
|
72
|
+
manager.discoverPeers(channel, new WifiP2pManager.ActionListener() {
|
|
73
|
+
@Override
|
|
74
|
+
public void onSuccess() {
|
|
75
|
+
JSObject ret = new JSObject();
|
|
76
|
+
ret.put("message", "Discovery started");
|
|
77
|
+
call.resolve(ret);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@Override
|
|
81
|
+
public void onFailure(int reason) {
|
|
82
|
+
call.reject("Peer discovery failed, reason: " + reason);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
private void connectToDevice(WifiP2pDevice device, PluginCall call) {
|
|
88
|
+
WifiP2pConfig config = new WifiP2pConfig();
|
|
89
|
+
config.deviceAddress = device.deviceAddress;
|
|
90
|
+
|
|
91
|
+
manager.connect(channel, config, new WifiP2pManager.ActionListener() {
|
|
92
|
+
@Override
|
|
93
|
+
public void onSuccess() {
|
|
94
|
+
JSObject ret = new JSObject();
|
|
95
|
+
ret.put("message", "Connecting to " + device.deviceName);
|
|
96
|
+
call.resolve(ret);
|
|
97
|
+
getContext().unregisterReceiver(receiver); // 연결 시도 후 리시버 해제
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@Override
|
|
101
|
+
public void onFailure(int reason) {
|
|
102
|
+
call.reject("Connection failed with reason: " + reason);
|
|
103
|
+
getContext().unregisterReceiver(receiver);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
File without changes
|
package/dist/docs.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"api": {
|
|
3
|
+
"name": "WifiDirectPlugin",
|
|
4
|
+
"slug": "wifidirectplugin",
|
|
5
|
+
"docs": "",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"methods": [
|
|
8
|
+
{
|
|
9
|
+
"name": "echo",
|
|
10
|
+
"signature": "(options: { value: string; }) => Promise<{ value: string; }>",
|
|
11
|
+
"parameters": [
|
|
12
|
+
{
|
|
13
|
+
"name": "options",
|
|
14
|
+
"docs": "",
|
|
15
|
+
"type": "{ value: string; }"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"returns": "Promise<{ value: string; }>",
|
|
19
|
+
"tags": [],
|
|
20
|
+
"docs": "",
|
|
21
|
+
"complexTypes": [],
|
|
22
|
+
"slug": "echo"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"properties": []
|
|
26
|
+
},
|
|
27
|
+
"interfaces": [],
|
|
28
|
+
"enums": [],
|
|
29
|
+
"typeAliases": [],
|
|
30
|
+
"pluginConfigs": []
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface WifiDirectPlugin {\n echo(options: { value: string }): Promise<{ value: string }>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,UAAU,GAAG,cAAc,CAAmB,YAAY,EAAE;IAChE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;CAC9D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { WifiDirectPlugin } from './definitions';\n\nconst WifiDirect = registerPlugin<WifiDirectPlugin>('WifiDirect', {\n web: () => import('./web').then((m) => new m.WifiDirectWeb()),\n});\n\nexport * from './definitions';\nexport { WifiDirect };\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { WifiDirectPlugin } from './definitions';
|
|
3
|
+
export declare class WifiDirectWeb extends WebPlugin implements WifiDirectPlugin {
|
|
4
|
+
echo(options: {
|
|
5
|
+
value: string;
|
|
6
|
+
}): Promise<{
|
|
7
|
+
value: string;
|
|
8
|
+
}>;
|
|
9
|
+
}
|
package/dist/esm/web.js
ADDED
|
@@ -0,0 +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,aAAc,SAAQ,SAAS;IAC1C,KAAK,CAAC,IAAI,CAAC,OAA0B;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { WifiDirectPlugin } from './definitions';\n\nexport class WifiDirectWeb extends WebPlugin implements WifiDirectPlugin {\n async echo(options: { value: string }): Promise<{ value: string }> {\n console.log('ECHO', options);\n return options;\n }\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@capacitor/core');
|
|
4
|
+
|
|
5
|
+
const WifiDirect = core.registerPlugin('WifiDirect', {
|
|
6
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.WifiDirectWeb()),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
class WifiDirectWeb extends core.WebPlugin {
|
|
10
|
+
async echo(options) {
|
|
11
|
+
console.log('ECHO', options);
|
|
12
|
+
return options;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
17
|
+
__proto__: null,
|
|
18
|
+
WifiDirectWeb: WifiDirectWeb
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
exports.WifiDirect = WifiDirect;
|
|
22
|
+
//# 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 WifiDirect = registerPlugin('WifiDirect', {\n web: () => import('./web').then((m) => new m.WifiDirectWeb()),\n});\nexport * from './definitions';\nexport { WifiDirect };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class WifiDirectWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,UAAU,GAAGA,mBAAc,CAAC,YAAY,EAAE;AAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;AACjE,CAAC;;ACFM,MAAM,aAAa,SAASC,cAAS,CAAC;AAC7C,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;AACpC,QAAQ,OAAO,OAAO;AACtB,IAAI;AACJ;;;;;;;;;"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var capacitorWifiDirect = (function (exports, core) {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const WifiDirect = core.registerPlugin('WifiDirect', {
|
|
5
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.WifiDirectWeb()),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
class WifiDirectWeb extends core.WebPlugin {
|
|
9
|
+
async echo(options) {
|
|
10
|
+
console.log('ECHO', options);
|
|
11
|
+
return options;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
16
|
+
__proto__: null,
|
|
17
|
+
WifiDirectWeb: WifiDirectWeb
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
exports.WifiDirect = WifiDirect;
|
|
21
|
+
|
|
22
|
+
return exports;
|
|
23
|
+
|
|
24
|
+
})({}, capacitorExports);
|
|
25
|
+
//# 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 WifiDirect = registerPlugin('WifiDirect', {\n web: () => import('./web').then((m) => new m.WifiDirectWeb()),\n});\nexport * from './definitions';\nexport { WifiDirect };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class WifiDirectWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,UAAU,GAAGA,mBAAc,CAAC,YAAY,EAAE;IAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;IACjE,CAAC;;ICFM,MAAM,aAAa,SAASC,cAAS,CAAC;IAC7C,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IACpC,QAAQ,OAAO,OAAO;IACtB,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Please read the Capacitor iOS Plugin Development Guide
|
|
6
|
+
* here: https://capacitorjs.com/docs/plugins/ios
|
|
7
|
+
*/
|
|
8
|
+
@objc(WifiDirectPlugin)
|
|
9
|
+
public class WifiDirectPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
10
|
+
public let identifier = "WifiDirectPlugin"
|
|
11
|
+
public let jsName = "WifiDirect"
|
|
12
|
+
public let pluginMethods: [CAPPluginMethod] = [
|
|
13
|
+
CAPPluginMethod(name: "echo", returnType: CAPPluginReturnPromise)
|
|
14
|
+
]
|
|
15
|
+
private let implementation = WifiDirect()
|
|
16
|
+
|
|
17
|
+
@objc func echo(_ call: CAPPluginCall) {
|
|
18
|
+
let value = call.getString("value") ?? ""
|
|
19
|
+
call.resolve([
|
|
20
|
+
"value": implementation.echo(value)
|
|
21
|
+
])
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import XCTest
|
|
2
|
+
@testable import WifiDirectPlugin
|
|
3
|
+
|
|
4
|
+
class WifiDirectTests: XCTestCase {
|
|
5
|
+
func testEcho() {
|
|
6
|
+
// This is an example of a functional test case for a plugin.
|
|
7
|
+
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
|
8
|
+
|
|
9
|
+
let implementation = WifiDirect()
|
|
10
|
+
let value = "Hello, World!"
|
|
11
|
+
let result = implementation.echo(value)
|
|
12
|
+
|
|
13
|
+
XCTAssertEqual(value, result)
|
|
14
|
+
}
|
|
15
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wifidirectplugin",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "HT-Installer Wifi Direct Plugin",
|
|
5
|
+
"main": "dist/plugin.cjs.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"types": "dist/esm/index.d.ts",
|
|
8
|
+
"unpkg": "dist/plugin.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"android/src/main/",
|
|
11
|
+
"android/build.gradle",
|
|
12
|
+
"dist/",
|
|
13
|
+
"ios/Sources",
|
|
14
|
+
"ios/Tests",
|
|
15
|
+
"Package.swift",
|
|
16
|
+
"Wifidirectplugin.podspec"
|
|
17
|
+
],
|
|
18
|
+
"author": "sglee99",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/ht-installer/wifi-direct.git"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/ht-installer/wifi-direct/issues"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"capacitor",
|
|
29
|
+
"plugin",
|
|
30
|
+
"native"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
34
|
+
"verify:ios": "xcodebuild -scheme Wifidirectplugin -destination generic/platform=iOS",
|
|
35
|
+
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
36
|
+
"verify:web": "npm run build",
|
|
37
|
+
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|
|
38
|
+
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
|
|
39
|
+
"eslint": "eslint . --ext ts",
|
|
40
|
+
"prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
|
|
41
|
+
"swiftlint": "node-swiftlint",
|
|
42
|
+
"docgen": "docgen --api WifiDirectPlugin --output-readme README.md --output-json dist/docs.json",
|
|
43
|
+
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
|
|
44
|
+
"clean": "rimraf ./dist",
|
|
45
|
+
"watch": "tsc --watch",
|
|
46
|
+
"prepublishOnly": "npm run build"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@capacitor/android": "^7.0.0",
|
|
50
|
+
"@capacitor/core": "^7.0.0",
|
|
51
|
+
"@capacitor/docgen": "^0.3.0",
|
|
52
|
+
"@capacitor/ios": "^7.0.0",
|
|
53
|
+
"@ionic/eslint-config": "^0.4.0",
|
|
54
|
+
"@ionic/prettier-config": "^4.0.0",
|
|
55
|
+
"@ionic/swiftlint-config": "^2.0.0",
|
|
56
|
+
"eslint": "^8.57.0",
|
|
57
|
+
"prettier": "^3.4.2",
|
|
58
|
+
"prettier-plugin-java": "^2.6.6",
|
|
59
|
+
"rimraf": "^6.0.1",
|
|
60
|
+
"rollup": "^4.30.1",
|
|
61
|
+
"swiftlint": "^2.0.0",
|
|
62
|
+
"typescript": "~4.1.5"
|
|
63
|
+
},
|
|
64
|
+
"peerDependencies": {
|
|
65
|
+
"@capacitor/core": ">=7.0.0"
|
|
66
|
+
},
|
|
67
|
+
"prettier": "@ionic/prettier-config",
|
|
68
|
+
"swiftlint": "@ionic/swiftlint-config",
|
|
69
|
+
"eslintConfig": {
|
|
70
|
+
"extends": "@ionic/eslint-config/recommended"
|
|
71
|
+
},
|
|
72
|
+
"capacitor": {
|
|
73
|
+
"ios": {
|
|
74
|
+
"path": "ios"
|
|
75
|
+
},
|
|
76
|
+
"android": {
|
|
77
|
+
"path": "android"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|