@capgo/capacitor-wifi 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.
@@ -0,0 +1,129 @@
1
+ 'use strict';
2
+
3
+ var core = require('@capacitor/core');
4
+
5
+ /**
6
+ * Network security types
7
+ *
8
+ * @since 7.0.0
9
+ */
10
+ exports.NetworkSecurityType = void 0;
11
+ (function (NetworkSecurityType) {
12
+ /**
13
+ * Open network with no security
14
+ *
15
+ * @since 7.0.0
16
+ */
17
+ NetworkSecurityType[NetworkSecurityType["OPEN"] = 0] = "OPEN";
18
+ /**
19
+ * WEP security
20
+ *
21
+ * @since 7.0.0
22
+ */
23
+ NetworkSecurityType[NetworkSecurityType["WEP"] = 1] = "WEP";
24
+ /**
25
+ * WPA/WPA2 Personal (PSK)
26
+ *
27
+ * @since 7.0.0
28
+ */
29
+ NetworkSecurityType[NetworkSecurityType["WPA2_PSK"] = 2] = "WPA2_PSK";
30
+ /**
31
+ * WPA/WPA2/WPA3 Enterprise (EAP)
32
+ *
33
+ * @since 7.0.0
34
+ */
35
+ NetworkSecurityType[NetworkSecurityType["EAP"] = 3] = "EAP";
36
+ /**
37
+ * WPA3 Personal (SAE)
38
+ *
39
+ * @since 7.0.0
40
+ */
41
+ NetworkSecurityType[NetworkSecurityType["SAE"] = 4] = "SAE";
42
+ /**
43
+ * WPA3 Enterprise
44
+ *
45
+ * @since 7.0.0
46
+ */
47
+ NetworkSecurityType[NetworkSecurityType["WPA3_ENTERPRISE"] = 5] = "WPA3_ENTERPRISE";
48
+ /**
49
+ * WPA3 Enterprise 192-bit mode
50
+ *
51
+ * @since 7.0.0
52
+ */
53
+ NetworkSecurityType[NetworkSecurityType["WPA3_ENTERPRISE_192_BIT"] = 6] = "WPA3_ENTERPRISE_192_BIT";
54
+ /**
55
+ * Passpoint network
56
+ *
57
+ * @since 7.0.0
58
+ */
59
+ NetworkSecurityType[NetworkSecurityType["PASSPOINT"] = 7] = "PASSPOINT";
60
+ /**
61
+ * Enhanced Open (OWE)
62
+ *
63
+ * @since 7.0.0
64
+ */
65
+ NetworkSecurityType[NetworkSecurityType["OWE"] = 8] = "OWE";
66
+ /**
67
+ * WAPI PSK
68
+ *
69
+ * @since 7.0.0
70
+ */
71
+ NetworkSecurityType[NetworkSecurityType["WAPI_PSK"] = 9] = "WAPI_PSK";
72
+ /**
73
+ * WAPI Certificate
74
+ *
75
+ * @since 7.0.0
76
+ */
77
+ NetworkSecurityType[NetworkSecurityType["WAPI_CERT"] = 10] = "WAPI_CERT";
78
+ })(exports.NetworkSecurityType || (exports.NetworkSecurityType = {}));
79
+
80
+ const CapacitorWifi = core.registerPlugin('CapacitorWifi', {
81
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapacitorWifiWeb()),
82
+ });
83
+
84
+ class CapacitorWifiWeb extends core.WebPlugin {
85
+ async addNetwork(_options) {
86
+ throw this.unimplemented('Not implemented on web.');
87
+ }
88
+ async connect(_options) {
89
+ throw this.unimplemented('Not implemented on web.');
90
+ }
91
+ async disconnect(_options) {
92
+ throw this.unimplemented('Not implemented on web.');
93
+ }
94
+ async getAvailableNetworks() {
95
+ throw this.unimplemented('Not implemented on web.');
96
+ }
97
+ async getIpAddress() {
98
+ throw this.unimplemented('Not implemented on web.');
99
+ }
100
+ async getRssi() {
101
+ throw this.unimplemented('Not implemented on web.');
102
+ }
103
+ async getSsid() {
104
+ throw this.unimplemented('Not implemented on web.');
105
+ }
106
+ async isEnabled() {
107
+ throw this.unimplemented('Not implemented on web.');
108
+ }
109
+ async startScan() {
110
+ throw this.unimplemented('Not implemented on web.');
111
+ }
112
+ async checkPermissions() {
113
+ throw this.unimplemented('Not implemented on web.');
114
+ }
115
+ async requestPermissions(_options) {
116
+ throw this.unimplemented('Not implemented on web.');
117
+ }
118
+ async getPluginVersion() {
119
+ return { version: '1.0.0' };
120
+ }
121
+ }
122
+
123
+ var web = /*#__PURE__*/Object.freeze({
124
+ __proto__: null,
125
+ CapacitorWifiWeb: CapacitorWifiWeb
126
+ });
127
+
128
+ exports.CapacitorWifi = CapacitorWifi;
129
+ //# sourceMappingURL=plugin.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * Network security types\n *\n * @since 7.0.0\n */\nexport var NetworkSecurityType;\n(function (NetworkSecurityType) {\n /**\n * Open network with no security\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"OPEN\"] = 0] = \"OPEN\";\n /**\n * WEP security\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WEP\"] = 1] = \"WEP\";\n /**\n * WPA/WPA2 Personal (PSK)\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WPA2_PSK\"] = 2] = \"WPA2_PSK\";\n /**\n * WPA/WPA2/WPA3 Enterprise (EAP)\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"EAP\"] = 3] = \"EAP\";\n /**\n * WPA3 Personal (SAE)\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"SAE\"] = 4] = \"SAE\";\n /**\n * WPA3 Enterprise\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WPA3_ENTERPRISE\"] = 5] = \"WPA3_ENTERPRISE\";\n /**\n * WPA3 Enterprise 192-bit mode\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WPA3_ENTERPRISE_192_BIT\"] = 6] = \"WPA3_ENTERPRISE_192_BIT\";\n /**\n * Passpoint network\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"PASSPOINT\"] = 7] = \"PASSPOINT\";\n /**\n * Enhanced Open (OWE)\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"OWE\"] = 8] = \"OWE\";\n /**\n * WAPI PSK\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WAPI_PSK\"] = 9] = \"WAPI_PSK\";\n /**\n * WAPI Certificate\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WAPI_CERT\"] = 10] = \"WAPI_CERT\";\n})(NetworkSecurityType || (NetworkSecurityType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst CapacitorWifi = registerPlugin('CapacitorWifi', {\n web: () => import('./web').then((m) => new m.CapacitorWifiWeb()),\n});\nexport * from './definitions';\nexport { CapacitorWifi };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorWifiWeb extends WebPlugin {\n async addNetwork(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async connect(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async disconnect(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async getAvailableNetworks() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getIpAddress() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getRssi() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getSsid() {\n throw this.unimplemented('Not implemented on web.');\n }\n async isEnabled() {\n throw this.unimplemented('Not implemented on web.');\n }\n async startScan() {\n throw this.unimplemented('Not implemented on web.');\n }\n async checkPermissions() {\n throw this.unimplemented('Not implemented on web.');\n }\n async requestPermissions(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async getPluginVersion() {\n return { version: '1.0.0' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["NetworkSecurityType","registerPlugin","WebPlugin"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACWA;AACX,CAAC,UAAU,mBAAmB,EAAE;AAChC;AACA;AACA;AACA;AACA;AACA,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM;AACjE;AACA;AACA;AACA;AACA;AACA,IAAI,mBAAmB,CAAC,mBAAmB,CAAC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B,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE;AACnC,IAAI;AACJ;;;;;;;;;"}
package/dist/plugin.js ADDED
@@ -0,0 +1,132 @@
1
+ var capacitorCapgoWifi = (function (exports, core) {
2
+ 'use strict';
3
+
4
+ /**
5
+ * Network security types
6
+ *
7
+ * @since 7.0.0
8
+ */
9
+ exports.NetworkSecurityType = void 0;
10
+ (function (NetworkSecurityType) {
11
+ /**
12
+ * Open network with no security
13
+ *
14
+ * @since 7.0.0
15
+ */
16
+ NetworkSecurityType[NetworkSecurityType["OPEN"] = 0] = "OPEN";
17
+ /**
18
+ * WEP security
19
+ *
20
+ * @since 7.0.0
21
+ */
22
+ NetworkSecurityType[NetworkSecurityType["WEP"] = 1] = "WEP";
23
+ /**
24
+ * WPA/WPA2 Personal (PSK)
25
+ *
26
+ * @since 7.0.0
27
+ */
28
+ NetworkSecurityType[NetworkSecurityType["WPA2_PSK"] = 2] = "WPA2_PSK";
29
+ /**
30
+ * WPA/WPA2/WPA3 Enterprise (EAP)
31
+ *
32
+ * @since 7.0.0
33
+ */
34
+ NetworkSecurityType[NetworkSecurityType["EAP"] = 3] = "EAP";
35
+ /**
36
+ * WPA3 Personal (SAE)
37
+ *
38
+ * @since 7.0.0
39
+ */
40
+ NetworkSecurityType[NetworkSecurityType["SAE"] = 4] = "SAE";
41
+ /**
42
+ * WPA3 Enterprise
43
+ *
44
+ * @since 7.0.0
45
+ */
46
+ NetworkSecurityType[NetworkSecurityType["WPA3_ENTERPRISE"] = 5] = "WPA3_ENTERPRISE";
47
+ /**
48
+ * WPA3 Enterprise 192-bit mode
49
+ *
50
+ * @since 7.0.0
51
+ */
52
+ NetworkSecurityType[NetworkSecurityType["WPA3_ENTERPRISE_192_BIT"] = 6] = "WPA3_ENTERPRISE_192_BIT";
53
+ /**
54
+ * Passpoint network
55
+ *
56
+ * @since 7.0.0
57
+ */
58
+ NetworkSecurityType[NetworkSecurityType["PASSPOINT"] = 7] = "PASSPOINT";
59
+ /**
60
+ * Enhanced Open (OWE)
61
+ *
62
+ * @since 7.0.0
63
+ */
64
+ NetworkSecurityType[NetworkSecurityType["OWE"] = 8] = "OWE";
65
+ /**
66
+ * WAPI PSK
67
+ *
68
+ * @since 7.0.0
69
+ */
70
+ NetworkSecurityType[NetworkSecurityType["WAPI_PSK"] = 9] = "WAPI_PSK";
71
+ /**
72
+ * WAPI Certificate
73
+ *
74
+ * @since 7.0.0
75
+ */
76
+ NetworkSecurityType[NetworkSecurityType["WAPI_CERT"] = 10] = "WAPI_CERT";
77
+ })(exports.NetworkSecurityType || (exports.NetworkSecurityType = {}));
78
+
79
+ const CapacitorWifi = core.registerPlugin('CapacitorWifi', {
80
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapacitorWifiWeb()),
81
+ });
82
+
83
+ class CapacitorWifiWeb extends core.WebPlugin {
84
+ async addNetwork(_options) {
85
+ throw this.unimplemented('Not implemented on web.');
86
+ }
87
+ async connect(_options) {
88
+ throw this.unimplemented('Not implemented on web.');
89
+ }
90
+ async disconnect(_options) {
91
+ throw this.unimplemented('Not implemented on web.');
92
+ }
93
+ async getAvailableNetworks() {
94
+ throw this.unimplemented('Not implemented on web.');
95
+ }
96
+ async getIpAddress() {
97
+ throw this.unimplemented('Not implemented on web.');
98
+ }
99
+ async getRssi() {
100
+ throw this.unimplemented('Not implemented on web.');
101
+ }
102
+ async getSsid() {
103
+ throw this.unimplemented('Not implemented on web.');
104
+ }
105
+ async isEnabled() {
106
+ throw this.unimplemented('Not implemented on web.');
107
+ }
108
+ async startScan() {
109
+ throw this.unimplemented('Not implemented on web.');
110
+ }
111
+ async checkPermissions() {
112
+ throw this.unimplemented('Not implemented on web.');
113
+ }
114
+ async requestPermissions(_options) {
115
+ throw this.unimplemented('Not implemented on web.');
116
+ }
117
+ async getPluginVersion() {
118
+ return { version: '1.0.0' };
119
+ }
120
+ }
121
+
122
+ var web = /*#__PURE__*/Object.freeze({
123
+ __proto__: null,
124
+ CapacitorWifiWeb: CapacitorWifiWeb
125
+ });
126
+
127
+ exports.CapacitorWifi = CapacitorWifi;
128
+
129
+ return exports;
130
+
131
+ })({}, capacitorExports);
132
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * Network security types\n *\n * @since 7.0.0\n */\nexport var NetworkSecurityType;\n(function (NetworkSecurityType) {\n /**\n * Open network with no security\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"OPEN\"] = 0] = \"OPEN\";\n /**\n * WEP security\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WEP\"] = 1] = \"WEP\";\n /**\n * WPA/WPA2 Personal (PSK)\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WPA2_PSK\"] = 2] = \"WPA2_PSK\";\n /**\n * WPA/WPA2/WPA3 Enterprise (EAP)\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"EAP\"] = 3] = \"EAP\";\n /**\n * WPA3 Personal (SAE)\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"SAE\"] = 4] = \"SAE\";\n /**\n * WPA3 Enterprise\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WPA3_ENTERPRISE\"] = 5] = \"WPA3_ENTERPRISE\";\n /**\n * WPA3 Enterprise 192-bit mode\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WPA3_ENTERPRISE_192_BIT\"] = 6] = \"WPA3_ENTERPRISE_192_BIT\";\n /**\n * Passpoint network\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"PASSPOINT\"] = 7] = \"PASSPOINT\";\n /**\n * Enhanced Open (OWE)\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"OWE\"] = 8] = \"OWE\";\n /**\n * WAPI PSK\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WAPI_PSK\"] = 9] = \"WAPI_PSK\";\n /**\n * WAPI Certificate\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WAPI_CERT\"] = 10] = \"WAPI_CERT\";\n})(NetworkSecurityType || (NetworkSecurityType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst CapacitorWifi = registerPlugin('CapacitorWifi', {\n web: () => import('./web').then((m) => new m.CapacitorWifiWeb()),\n});\nexport * from './definitions';\nexport { CapacitorWifi };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorWifiWeb extends WebPlugin {\n async addNetwork(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async connect(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async disconnect(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async getAvailableNetworks() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getIpAddress() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getRssi() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getSsid() {\n throw this.unimplemented('Not implemented on web.');\n }\n async isEnabled() {\n throw this.unimplemented('Not implemented on web.');\n }\n async startScan() {\n throw this.unimplemented('Not implemented on web.');\n }\n async checkPermissions() {\n throw this.unimplemented('Not implemented on web.');\n }\n async requestPermissions(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async getPluginVersion() {\n return { version: '1.0.0' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["NetworkSecurityType","registerPlugin","WebPlugin"],"mappings":";;;IAAA;IACA;IACA;IACA;IACA;AACWA;IACX,CAAC,UAAU,mBAAmB,EAAE;IAChC;IACA;IACA;IACA;IACA;IACA,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,MAAM,CAAC,GAAG,CAAC,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AAM,kBAAkB,CAAC,QAAQ,EAAE;IACvC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE;IACnC,IAAI;IACJ;;;;;;;;;;;;;;;"}
@@ -0,0 +1,227 @@
1
+ import Foundation
2
+ import Capacitor
3
+ import NetworkExtension
4
+ import SystemConfiguration.CaptiveNetwork
5
+ import CoreLocation
6
+
7
+ @objc(CapacitorWifiPlugin)
8
+ public class CapacitorWifiPlugin: CAPPlugin, CAPBridgedPlugin {
9
+ private let pluginVersion: String = "7.0.0"
10
+ public let identifier = "CapacitorWifiPlugin"
11
+ public let jsName = "CapacitorWifi"
12
+ public let pluginMethods: [CAPPluginMethod] = [
13
+ CAPPluginMethod(name: "addNetwork", returnType: CAPPluginReturnPromise),
14
+ CAPPluginMethod(name: "connect", returnType: CAPPluginReturnPromise),
15
+ CAPPluginMethod(name: "disconnect", returnType: CAPPluginReturnPromise),
16
+ CAPPluginMethod(name: "getAvailableNetworks", returnType: CAPPluginReturnPromise),
17
+ CAPPluginMethod(name: "getIpAddress", returnType: CAPPluginReturnPromise),
18
+ CAPPluginMethod(name: "getRssi", returnType: CAPPluginReturnPromise),
19
+ CAPPluginMethod(name: "getSsid", returnType: CAPPluginReturnPromise),
20
+ CAPPluginMethod(name: "isEnabled", returnType: CAPPluginReturnPromise),
21
+ CAPPluginMethod(name: "startScan", returnType: CAPPluginReturnPromise),
22
+ CAPPluginMethod(name: "checkPermissions", returnType: CAPPluginReturnPromise),
23
+ CAPPluginMethod(name: "requestPermissions", returnType: CAPPluginReturnPromise),
24
+ CAPPluginMethod(name: "getPluginVersion", returnType: CAPPluginReturnPromise)
25
+ ]
26
+
27
+ private var hotspotManager: NEHotspotConfigurationManager?
28
+
29
+ override public func load() {
30
+ hotspotManager = NEHotspotConfigurationManager.shared
31
+ }
32
+
33
+ @objc func addNetwork(_ call: CAPPluginCall) {
34
+ guard let ssid = call.getString("ssid") else {
35
+ call.reject("SSID is required")
36
+ return
37
+ }
38
+
39
+ let password = call.getString("password")
40
+
41
+ let configuration: NEHotspotConfiguration
42
+ if let password = password, !password.isEmpty {
43
+ configuration = NEHotspotConfiguration(ssid: ssid, passphrase: password, isWEP: false)
44
+ } else {
45
+ configuration = NEHotspotConfiguration(ssid: ssid)
46
+ }
47
+
48
+ configuration.joinOnce = false
49
+
50
+ hotspotManager?.apply(configuration) { error in
51
+ if let error = error {
52
+ call.reject("Failed to add network: \(error.localizedDescription)", nil, error)
53
+ } else {
54
+ call.resolve()
55
+ }
56
+ }
57
+ }
58
+
59
+ @objc func connect(_ call: CAPPluginCall) {
60
+ guard let ssid = call.getString("ssid") else {
61
+ call.reject("SSID is required")
62
+ return
63
+ }
64
+
65
+ let password = call.getString("password")
66
+
67
+ let configuration: NEHotspotConfiguration
68
+ if let password = password, !password.isEmpty {
69
+ configuration = NEHotspotConfiguration(ssid: ssid, passphrase: password, isWEP: false)
70
+ } else {
71
+ configuration = NEHotspotConfiguration(ssid: ssid)
72
+ }
73
+
74
+ configuration.joinOnce = false
75
+
76
+ hotspotManager?.apply(configuration) { error in
77
+ if let error = error {
78
+ call.reject("Failed to connect: \(error.localizedDescription)", nil, error)
79
+ } else {
80
+ call.resolve()
81
+ }
82
+ }
83
+ }
84
+
85
+ @objc func disconnect(_ call: CAPPluginCall) {
86
+ let ssid = call.getString("ssid")
87
+
88
+ if let ssid = ssid {
89
+ hotspotManager?.removeConfiguration(forSSID: ssid)
90
+ } else {
91
+ // Disconnect from current network by getting current SSID
92
+ if let currentSSID = getCurrentSSID() {
93
+ hotspotManager?.removeConfiguration(forSSID: currentSSID)
94
+ }
95
+ }
96
+
97
+ call.resolve()
98
+ }
99
+
100
+ @objc func getAvailableNetworks(_ call: CAPPluginCall) {
101
+ call.reject("Not supported on iOS")
102
+ }
103
+
104
+ @objc func getIpAddress(_ call: CAPPluginCall) {
105
+ var address: String?
106
+ var ifaddr: UnsafeMutablePointer<ifaddrs>?
107
+
108
+ guard getifaddrs(&ifaddr) == 0, let firstAddr = ifaddr else {
109
+ call.reject("Failed to get IP address")
110
+ return
111
+ }
112
+
113
+ defer { freeifaddrs(ifaddr) }
114
+
115
+ for ptr in sequence(first: firstAddr, next: { $0.pointee.ifa_next }) {
116
+ let interface = ptr.pointee
117
+ let addrFamily = interface.ifa_addr.pointee.sa_family
118
+
119
+ if addrFamily == UInt8(AF_INET) || addrFamily == UInt8(AF_INET6) {
120
+ let name = String(cString: interface.ifa_name)
121
+ if name == "en0" {
122
+ var hostname = [CChar](repeating: 0, count: Int(NI_MAXHOST))
123
+ getnameinfo(interface.ifa_addr, socklen_t(interface.ifa_addr.pointee.sa_len),
124
+ &hostname, socklen_t(hostname.count),
125
+ nil, socklen_t(0), NI_NUMERICHOST)
126
+ address = String(cString: hostname)
127
+ break
128
+ }
129
+ }
130
+ }
131
+
132
+ if let address = address {
133
+ call.resolve(["ipAddress": address])
134
+ } else {
135
+ call.reject("No IP address found")
136
+ }
137
+ }
138
+
139
+ @objc func getRssi(_ call: CAPPluginCall) {
140
+ call.reject("Not supported on iOS")
141
+ }
142
+
143
+ @objc func getSsid(_ call: CAPPluginCall) {
144
+ if let ssid = getCurrentSSID() {
145
+ call.resolve(["ssid": ssid])
146
+ } else {
147
+ call.reject("Failed to get SSID")
148
+ }
149
+ }
150
+
151
+ @objc func isEnabled(_ call: CAPPluginCall) {
152
+ call.reject("Not supported on iOS")
153
+ }
154
+
155
+ @objc func startScan(_ call: CAPPluginCall) {
156
+ call.reject("Not supported on iOS")
157
+ }
158
+
159
+ @objc override public func checkPermissions(_ call: CAPPluginCall) {
160
+ let status = getLocationPermissionStatus()
161
+ call.resolve(["location": status])
162
+ }
163
+
164
+ @objc override public func requestPermissions(_ call: CAPPluginCall) {
165
+ // On iOS, location permission is automatically requested when accessing WiFi info
166
+ // For iOS 13+, location permission is required to access SSID
167
+ let status = getLocationPermissionStatus()
168
+ call.resolve(["location": status])
169
+ }
170
+
171
+ @objc func getPluginVersion(_ call: CAPPluginCall) {
172
+ call.resolve(["version": self.pluginVersion])
173
+ }
174
+
175
+ // MARK: - Helper Methods
176
+
177
+ private func getCurrentSSID() -> String? {
178
+ if #available(iOS 14.0, *) {
179
+ var currentSSID: String?
180
+ NEHotspotNetwork.fetchCurrent { network in
181
+ currentSSID = network?.ssid
182
+ }
183
+ return currentSSID
184
+ } else {
185
+ guard let interfaces = CNCopySupportedInterfaces() as? [String] else {
186
+ return nil
187
+ }
188
+
189
+ for interface in interfaces {
190
+ guard let interfaceInfo = CNCopyCurrentNetworkInfo(interface as CFString) as NSDictionary? else {
191
+ continue
192
+ }
193
+
194
+ return interfaceInfo[kCNNetworkInfoKeySSID as String] as? String
195
+ }
196
+
197
+ return nil
198
+ }
199
+ }
200
+
201
+ private func getLocationPermissionStatus() -> String {
202
+ if #available(iOS 14.0, *) {
203
+ switch CLLocationManager.authorizationStatus() {
204
+ case .authorizedAlways, .authorizedWhenInUse:
205
+ return "granted"
206
+ case .denied, .restricted:
207
+ return "denied"
208
+ case .notDetermined:
209
+ return "prompt"
210
+ @unknown default:
211
+ return "prompt"
212
+ }
213
+ } else {
214
+ let status = CLLocationManager.authorizationStatus()
215
+ switch status {
216
+ case .authorizedAlways, .authorizedWhenInUse:
217
+ return "granted"
218
+ case .denied, .restricted:
219
+ return "denied"
220
+ case .notDetermined:
221
+ return "prompt"
222
+ @unknown default:
223
+ return "prompt"
224
+ }
225
+ }
226
+ }
227
+ }
@@ -0,0 +1,10 @@
1
+ import XCTest
2
+ @testable import CapacitorWifiPlugin
3
+
4
+ class CapacitorWifiPluginTests: XCTestCase {
5
+
6
+ func testExample() throws {
7
+ // This is an example of a functional test case.
8
+ XCTAssertTrue(true)
9
+ }
10
+ }
package/package.json ADDED
@@ -0,0 +1,86 @@
1
+ {
2
+ "name": "@capgo/capacitor-wifi",
3
+ "version": "7.0.0",
4
+ "description": "Manage WiFi connectivity for your Capacitor app",
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
+ "CapgoCapacitorWifi.podspec"
17
+ ],
18
+ "author": "Martin Donadieu <martin@capgo.app>",
19
+ "license": "MIT",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/Cap-go/capacitor-wifi.git"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/Cap-go/capacitor-wifi/issues"
26
+ },
27
+ "keywords": [
28
+ "capacitor",
29
+ "wifi",
30
+ "network",
31
+ "connectivity",
32
+ "plugin",
33
+ "native"
34
+ ],
35
+ "scripts": {
36
+ "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
37
+ "verify:ios": "xcodebuild -scheme CapgoCapacitorWifi -destination generic/platform=iOS",
38
+ "verify:android": "cd android && ./gradlew clean build test && cd ..",
39
+ "verify:web": "npm run build",
40
+ "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
41
+ "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
42
+ "eslint": "eslint . --ext ts",
43
+ "prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
44
+ "swiftlint": "node-swiftlint",
45
+ "docgen": "docgen --api CapacitorWifiPlugin --output-readme README.md --output-json dist/docs.json",
46
+ "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
47
+ "clean": "rimraf ./dist",
48
+ "watch": "tsc --watch",
49
+ "prepublishOnly": "npm run build"
50
+ },
51
+ "devDependencies": {
52
+ "@capacitor/android": "^7.0.0",
53
+ "@capacitor/cli": "^7.0.0",
54
+ "@capacitor/core": "^7.0.0",
55
+ "@capacitor/docgen": "^0.3.0",
56
+ "@capacitor/ios": "^7.0.0",
57
+ "@ionic/eslint-config": "^0.4.0",
58
+ "@ionic/prettier-config": "^4.0.0",
59
+ "@ionic/swiftlint-config": "^2.0.0",
60
+ "@rollup/plugin-node-resolve": "^16.0.3",
61
+ "@types/node": "^22.13.1",
62
+ "eslint": "^8.57.0",
63
+ "prettier": "^3.4.2",
64
+ "prettier-plugin-java": "^2.6.7",
65
+ "rimraf": "^6.0.1",
66
+ "rollup": "^4.34.6",
67
+ "swiftlint": "^2.0.0",
68
+ "typescript": "^5.7.3"
69
+ },
70
+ "peerDependencies": {
71
+ "@capacitor/core": ">=7.0.0"
72
+ },
73
+ "eslintConfig": {
74
+ "extends": "@ionic/eslint-config/recommended"
75
+ },
76
+ "prettier": "@ionic/prettier-config",
77
+ "swiftlint": "@ionic/swiftlint-config",
78
+ "capacitor": {
79
+ "ios": {
80
+ "src": "ios"
81
+ },
82
+ "android": {
83
+ "src": "android"
84
+ }
85
+ }
86
+ }