community-cordova-plugin-wifi 1.0.6 → 1.0.8
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/.idea/workspace.xml +57 -26
- package/package.json +1 -1
- package/plugin.xml +1 -2
- package/src/android/WifiPlugin.java +2 -4
- package/src/android/PingTask.java +0 -56
package/.idea/workspace.xml
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
|
9
9
|
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
|
|
10
10
|
<change beforePath="$PROJECT_DIR$/plugin.xml" beforeDir="false" afterPath="$PROJECT_DIR$/plugin.xml" afterDir="false" />
|
|
11
|
+
<change beforePath="$PROJECT_DIR$/src/android/PingTask.java" beforeDir="false" />
|
|
12
|
+
<change beforePath="$PROJECT_DIR$/src/android/WifiPlugin.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/android/WifiPlugin.java" afterDir="false" />
|
|
11
13
|
</list>
|
|
12
14
|
<option name="SHOW_DIALOG" value="false" />
|
|
13
15
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
@@ -23,14 +25,12 @@
|
|
|
23
25
|
"assignee": "EYALIN"
|
|
24
26
|
}
|
|
25
27
|
}</component>
|
|
26
|
-
<component name="GithubPullRequestsUISettings"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
</option>
|
|
33
|
-
</component>
|
|
28
|
+
<component name="GithubPullRequestsUISettings"><![CDATA[{
|
|
29
|
+
"selectedUrlAndAccountId": {
|
|
30
|
+
"url": "https://github.com/EYALIN/community-cordova-plugin-cpu.git",
|
|
31
|
+
"accountId": "554cb47e-af38-4ebf-8263-4816fa246779"
|
|
32
|
+
}
|
|
33
|
+
}]]></component>
|
|
34
34
|
<component name="MarkdownSettingsMigration">
|
|
35
35
|
<option name="stateVersion" value="1" />
|
|
36
36
|
</component>
|
|
@@ -43,23 +43,24 @@
|
|
|
43
43
|
<option name="hideEmptyMiddlePackages" value="true" />
|
|
44
44
|
<option name="showLibraryContents" value="true" />
|
|
45
45
|
</component>
|
|
46
|
-
<component name="PropertiesComponent"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
46
|
+
<component name="PropertiesComponent"><![CDATA[{
|
|
47
|
+
"keyToString": {
|
|
48
|
+
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
|
49
|
+
"RunOnceActivity.ShowReadmeOnStart": "true",
|
|
50
|
+
"RunOnceActivity.git.unshallow": "true",
|
|
51
|
+
"WebServerToolWindowFactoryState": "false",
|
|
52
|
+
"git-widget-placeholder": "main",
|
|
53
|
+
"last_opened_file_path": "/Volumes/Development/Git/forked/community-cordova-plugin-wifi/src/android",
|
|
54
|
+
"node.js.detected.package.eslint": "true",
|
|
55
|
+
"node.js.detected.package.tslint": "true",
|
|
56
|
+
"node.js.selected.package.eslint": "(autodetect)",
|
|
57
|
+
"node.js.selected.package.tslint": "(autodetect)",
|
|
58
|
+
"nodejs_package_manager_path": "npm",
|
|
59
|
+
"settings.editor.selected.configurable": "preferences.lookFeel",
|
|
60
|
+
"ts.external.directory.path": "/Applications/WebStorm.app/Contents/plugins/javascript-plugin/jsLanguageServicesImpl/external",
|
|
61
|
+
"vue.rearranger.settings.migration": "true"
|
|
61
62
|
}
|
|
62
|
-
}
|
|
63
|
+
}]]></component>
|
|
63
64
|
<component name="RecentsManager">
|
|
64
65
|
<key name="CopyFile.RECENT_KEYS">
|
|
65
66
|
<recent name="$PROJECT_DIR$/src/android" />
|
|
@@ -69,6 +70,13 @@
|
|
|
69
70
|
<recent name="$PROJECT_DIR$/src" />
|
|
70
71
|
</key>
|
|
71
72
|
</component>
|
|
73
|
+
<component name="SharedIndexes">
|
|
74
|
+
<attachedChunks>
|
|
75
|
+
<set>
|
|
76
|
+
<option value="bundled-js-predefined-d6986cc7102b-f27c65a3e318-JavaScript-WS-251.23774.424" />
|
|
77
|
+
</set>
|
|
78
|
+
</attachedChunks>
|
|
79
|
+
</component>
|
|
72
80
|
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
|
73
81
|
<component name="TaskManager">
|
|
74
82
|
<task active="true" id="Default" summary="Default task">
|
|
@@ -98,7 +106,12 @@
|
|
|
98
106
|
<workItem from="1722059814051" duration="697000" />
|
|
99
107
|
<workItem from="1722061550247" duration="21000" />
|
|
100
108
|
<workItem from="1723267322946" duration="7018000" />
|
|
101
|
-
<workItem from="1723350101711" duration="
|
|
109
|
+
<workItem from="1723350101711" duration="1324000" />
|
|
110
|
+
<workItem from="1724268174858" duration="4603000" />
|
|
111
|
+
<workItem from="1725518446319" duration="57000" />
|
|
112
|
+
<workItem from="1725611591287" duration="21000" />
|
|
113
|
+
<workItem from="1731667624026" duration="1162000" />
|
|
114
|
+
<workItem from="1751262475820" duration="786000" />
|
|
102
115
|
</task>
|
|
103
116
|
<task id="LOCAL-00001" summary="update plugin">
|
|
104
117
|
<option name="closed" value="true" />
|
|
@@ -188,7 +201,23 @@
|
|
|
188
201
|
<option name="project" value="LOCAL" />
|
|
189
202
|
<updated>1723350160378</updated>
|
|
190
203
|
</task>
|
|
191
|
-
<
|
|
204
|
+
<task id="LOCAL-00012" summary="* add export to all interfaces">
|
|
205
|
+
<option name="closed" value="true" />
|
|
206
|
+
<created>1723350242605</created>
|
|
207
|
+
<option name="number" value="00012" />
|
|
208
|
+
<option name="presentableId" value="LOCAL-00012" />
|
|
209
|
+
<option name="project" value="LOCAL" />
|
|
210
|
+
<updated>1723350242605</updated>
|
|
211
|
+
</task>
|
|
212
|
+
<task id="LOCAL-00013" summary="* add export to all interfaces">
|
|
213
|
+
<option name="closed" value="true" />
|
|
214
|
+
<created>1731669745130</created>
|
|
215
|
+
<option name="number" value="00013" />
|
|
216
|
+
<option name="presentableId" value="LOCAL-00013" />
|
|
217
|
+
<option name="project" value="LOCAL" />
|
|
218
|
+
<updated>1731669745130</updated>
|
|
219
|
+
</task>
|
|
220
|
+
<option name="localTasksCounter" value="14" />
|
|
192
221
|
<servers />
|
|
193
222
|
</component>
|
|
194
223
|
<component name="TypeScriptGeneratedFilesManager">
|
|
@@ -206,6 +235,8 @@
|
|
|
206
235
|
</option>
|
|
207
236
|
</component>
|
|
208
237
|
<component name="VcsManagerConfiguration">
|
|
238
|
+
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
|
|
239
|
+
<option name="CHECK_NEW_TODO" value="false" />
|
|
209
240
|
<MESSAGE value="update plugin" />
|
|
210
241
|
<MESSAGE value="fixed progress bar in Ping" />
|
|
211
242
|
<MESSAGE value="* isConnectedToTheInternet - Support SDK>29 * added exceptions handling when not connected to the internet" />
|
package/package.json
CHANGED
package/plugin.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
|
4
4
|
id="community-cordova-plugin-wifi"
|
|
5
|
-
version="1.0.
|
|
5
|
+
version="1.0.8">
|
|
6
6
|
<name>Cordova Plugin Wifi</name>
|
|
7
7
|
<description></description>
|
|
8
8
|
<license>MIT</license>
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
|
|
38
38
|
<source-file src="src/android/WifiPlugin.java" target-dir="src/android" />
|
|
39
39
|
<source-file src="src/android/IpInfoUtils.java" target-dir="src/android" />
|
|
40
|
-
<source-file src="src/android/PingTask.java" target-dir="src/android" />
|
|
41
40
|
<source-file src="src/android/WifiDetailsUtils.java" target-dir="src/android" />
|
|
42
41
|
<source-file src="src/android/WifiUtils.java" target-dir="src/android" />
|
|
43
42
|
</platform>
|
|
@@ -39,7 +39,7 @@ public class WifiPlugin extends CordovaPlugin {
|
|
|
39
39
|
String address = args.getString(0);
|
|
40
40
|
int count = args.getInt(1);
|
|
41
41
|
int timeout = args.getInt(2);
|
|
42
|
-
|
|
42
|
+
// PingTask.ping(address, count, timeout, callbackContext, cordova);
|
|
43
43
|
return true;
|
|
44
44
|
} else if ("getIpInfo".equals(action)) {
|
|
45
45
|
IpInfoUtils.getIpInfo(cordova, callbackContext);
|
|
@@ -126,9 +126,7 @@ public class WifiPlugin extends CordovaPlugin {
|
|
|
126
126
|
NetworkCapabilities networkCapabilities = connectivityManager.getNetworkCapabilities(network);
|
|
127
127
|
if (networkCapabilities != null) {
|
|
128
128
|
boolean isConnected = networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) &&
|
|
129
|
-
networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED)
|
|
130
|
-
networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED) &&
|
|
131
|
-
networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_SUSPENDED);
|
|
129
|
+
networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED);
|
|
132
130
|
|
|
133
131
|
if (isConnected) {
|
|
134
132
|
boolean isWiFi = networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI);
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
package wifiplugin;
|
|
2
|
-
|
|
3
|
-
import org.apache.cordova.CallbackContext;
|
|
4
|
-
import org.apache.cordova.PluginResult;
|
|
5
|
-
import java.io.BufferedReader;
|
|
6
|
-
import java.io.InputStreamReader;
|
|
7
|
-
import org.json.JSONObject;
|
|
8
|
-
import org.apache.cordova.CordovaInterface;
|
|
9
|
-
|
|
10
|
-
public class PingTask {
|
|
11
|
-
|
|
12
|
-
public static void ping(String address, int count, int timeout, CallbackContext callbackContext, CordovaInterface cordova) {
|
|
13
|
-
cordova.getThreadPool().execute(() -> {
|
|
14
|
-
try {
|
|
15
|
-
String command = "/system/bin/ping -c " + count + " -W " + timeout + " " + address;
|
|
16
|
-
Process process = Runtime.getRuntime().exec(command);
|
|
17
|
-
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
|
18
|
-
|
|
19
|
-
int linesRead = 0;
|
|
20
|
-
String line;
|
|
21
|
-
String fullResponse = "";
|
|
22
|
-
while ((line = reader.readLine()) != null) {
|
|
23
|
-
int progress = (int) (((double) linesRead / count) * 100);
|
|
24
|
-
linesRead++;
|
|
25
|
-
JSONObject progressUpdate = new JSONObject();
|
|
26
|
-
// Ensure progress does not exceed 100
|
|
27
|
-
progress = Math.min(progress, 100); // Cap progress at 100
|
|
28
|
-
progressUpdate.put("line", line);
|
|
29
|
-
if (fullResponse != null && !fullResponse.isEmpty()) {
|
|
30
|
-
fullResponse = fullResponse + "\n" + line;
|
|
31
|
-
} else {
|
|
32
|
-
fullResponse = line;
|
|
33
|
-
}
|
|
34
|
-
progressUpdate.put("line", line);
|
|
35
|
-
progressUpdate.put("fullResponse", fullResponse);
|
|
36
|
-
progressUpdate.put("progress", progress);
|
|
37
|
-
PluginResult progressResult = new PluginResult(PluginResult.Status.OK, progressUpdate);
|
|
38
|
-
progressResult.setKeepCallback(true);
|
|
39
|
-
callbackContext.sendPluginResult(progressResult);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
process.waitFor();
|
|
43
|
-
JSONObject finalResult = new JSONObject();
|
|
44
|
-
finalResult.put("line", "");
|
|
45
|
-
finalResult.put("fullResponse", fullResponse);
|
|
46
|
-
finalResult.put("progress", 100);
|
|
47
|
-
finalResult.put("status", "completed");
|
|
48
|
-
finalResult.put("linesRead", linesRead);
|
|
49
|
-
PluginResult result = new PluginResult(PluginResult.Status.OK, finalResult);
|
|
50
|
-
callbackContext.sendPluginResult(result);
|
|
51
|
-
} catch (Exception e) {
|
|
52
|
-
callbackContext.error("Error during ping: " + e.getMessage());
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|