community-cordova-plugin-wifi 1.0.4 → 1.0.6

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.
@@ -4,11 +4,10 @@
4
4
  <option name="autoReloadType" value="SELECTIVE" />
5
5
  </component>
6
6
  <component name="ChangeListManager">
7
- <list default="true" id="5a269414-5baa-4c38-b2f3-50c21d305b88" name="Changes" comment="fixed progress bar in Ping">
7
+ <list default="true" id="5a269414-5baa-4c38-b2f3-50c21d305b88" name="Changes" comment="* add export to all interfaces">
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/WifiPlugin.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/android/WifiPlugin.java" afterDir="false" />
12
11
  </list>
13
12
  <option name="SHOW_DIALOG" value="false" />
14
13
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -98,7 +97,8 @@
98
97
  <workItem from="1722058180072" duration="23000" />
99
98
  <workItem from="1722059814051" duration="697000" />
100
99
  <workItem from="1722061550247" duration="21000" />
101
- <workItem from="1723267322946" duration="2826000" />
100
+ <workItem from="1723267322946" duration="7018000" />
101
+ <workItem from="1723350101711" duration="89000" />
102
102
  </task>
103
103
  <task id="LOCAL-00001" summary="update plugin">
104
104
  <option name="closed" value="true" />
@@ -172,7 +172,23 @@
172
172
  <option name="project" value="LOCAL" />
173
173
  <updated>1711187013726</updated>
174
174
  </task>
175
- <option name="localTasksCounter" value="10" />
175
+ <task id="LOCAL-00010" summary="* isConnectedToTheInternet - Support SDK&gt;29&#10;* added exceptions handling when not connected to the internet">
176
+ <option name="closed" value="true" />
177
+ <created>1723275809818</created>
178
+ <option name="number" value="00010" />
179
+ <option name="presentableId" value="LOCAL-00010" />
180
+ <option name="project" value="LOCAL" />
181
+ <updated>1723275809818</updated>
182
+ </task>
183
+ <task id="LOCAL-00011" summary="* add export to all interfaces">
184
+ <option name="closed" value="true" />
185
+ <created>1723350160378</created>
186
+ <option name="number" value="00011" />
187
+ <option name="presentableId" value="LOCAL-00011" />
188
+ <option name="project" value="LOCAL" />
189
+ <updated>1723350160378</updated>
190
+ </task>
191
+ <option name="localTasksCounter" value="12" />
176
192
  <servers />
177
193
  </component>
178
194
  <component name="TypeScriptGeneratedFilesManager">
@@ -192,6 +208,8 @@
192
208
  <component name="VcsManagerConfiguration">
193
209
  <MESSAGE value="update plugin" />
194
210
  <MESSAGE value="fixed progress bar in Ping" />
195
- <option name="LAST_COMMIT_MESSAGE" value="fixed progress bar in Ping" />
211
+ <MESSAGE value="* isConnectedToTheInternet - Support SDK&gt;29&#10;* added exceptions handling when not connected to the internet" />
212
+ <MESSAGE value="* add export to all interfaces" />
213
+ <option name="LAST_COMMIT_MESSAGE" value="* add export to all interfaces" />
196
214
  </component>
197
215
  </project>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "community-cordova-plugin-wifi",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "types": "./types/index.d.ts",
5
5
  "readme": "README.md",
6
6
  "repository": "EYALIN/community-cordova-plugin-wifi/tree/master",
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.4">
5
+ version="1.0.6">
6
6
  <name>Cordova Plugin Wifi</name>
7
7
  <description></description>
8
8
  <license>MIT</license>
@@ -18,6 +18,7 @@ import org.apache.cordova.PluginResult;
18
18
  import org.json.JSONArray;
19
19
  import org.json.JSONException;
20
20
  import org.json.JSONObject;
21
+ import android.util.Log;
21
22
 
22
23
  import java.io.IOException;
23
24
  import java.util.ArrayList;
@@ -123,28 +124,44 @@ public class IpInfoUtils {
123
124
  }
124
125
  }
125
126
 
126
- private static void fillLocationInfo(JSONObject ipInfoObject, LocationManager locationManager, CordovaInterface cordova) throws IOException, JSONException {
127
- Location location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
128
- if (location != null) {
129
- ipInfoObject.put("latitude", location.getLatitude());
130
- ipInfoObject.put("longitude", location.getLongitude());
131
- List<Address> addresses = new ArrayList<>();
132
- if (isNetworkAvailable(cordova.getActivity())) {
133
- Geocoder geocoder = new Geocoder(cordova.getActivity(), Locale.getDefault());
134
- addresses = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
135
- }
127
+ private static void fillLocationInfo(JSONObject ipInfoObject, LocationManager locationManager, CordovaInterface cordova) throws JSONException {
128
+ Log.d(TAG, "fillLocationInfo begin");
129
+ Location location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
130
+ if (location != null) {
131
+ Log.d(TAG, "fillLocationInfo location is exists");
132
+ ipInfoObject.put("latitude", location.getLatitude());
133
+ ipInfoObject.put("longitude", location.getLongitude());
134
+ Log.d(TAG, "fillLocationInfo finish lat and long");
135
+
136
+ List<Address> addresses = new ArrayList<>();
137
+ if (isNetworkAvailable(cordova.getActivity())) {
138
+ try {
139
+ Log.d(TAG, "Geocoder begin");
140
+ Geocoder geocoder = new Geocoder(cordova.getActivity(), Locale.getDefault());
141
+ Log.d(TAG, "Geocoder success");
142
+ addresses = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
143
+ Log.d(TAG, "addresses success");
144
+ } catch (IOException e) {
145
+ Log.e(TAG, "Geocoder failed due to network or I/O issues", e);
146
+ } catch (IllegalArgumentException e) {
147
+ Log.e(TAG, "Geocoder failed due to illegal arguments", e);
148
+ } catch (Exception e) {
149
+ Log.e(TAG, "Geocoder failed due to an unexpected error", e);
150
+ }
151
+ }
152
+
153
+ if (!addresses.isEmpty()) {
154
+ Address address = addresses.get(0);
155
+ ipInfoObject.put("city", address.getLocality());
156
+ ipInfoObject.put("street", address.getThoroughfare());
157
+ ipInfoObject.put("country", address.getCountryName());
158
+ ipInfoObject.put("region", address.getSubAdminArea());
159
+ ipInfoObject.put("zipcode", address.getPostalCode());
160
+ ipInfoObject.put("state", address.getAdminArea());
161
+ }
162
+ }
163
+ }
136
164
 
137
- if (!addresses.isEmpty()) {
138
- Address address = addresses.get(0);
139
- ipInfoObject.put("city", address.getLocality());
140
- ipInfoObject.put("street", address.getThoroughfare());
141
- ipInfoObject.put("country", address.getCountryName());
142
- ipInfoObject.put("region", address.getSubAdminArea());
143
- ipInfoObject.put("zipcode", address.getPostalCode());
144
- ipInfoObject.put("state", address.getAdminArea());
145
- }
146
- }
147
- }
148
165
 
149
166
  public static boolean isNetworkAvailable(Context context) {
150
167
  ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- interface WifiNetwork {
1
+ export interface WifiNetwork {
2
2
  SSID: string;
3
3
  BSSID: string;
4
4
  capabilities: string;
@@ -9,7 +9,7 @@ interface WifiNetwork {
9
9
  distance: string;
10
10
  hasPassword: boolean;
11
11
  }
12
- interface NetworkDetails {
12
+ export interface NetworkDetails {
13
13
  type: string;
14
14
  state: string;
15
15
  isConnected: boolean;
@@ -17,7 +17,7 @@ interface NetworkDetails {
17
17
  canConnectToRouter?: boolean;
18
18
  isConnectedToWifi?: boolean;
19
19
  }
20
- interface ConnectedDeviceInfo {
20
+ export interface ConnectedDeviceInfo {
21
21
  ipAddress: string;
22
22
  deviceName: string;
23
23
  localHost: boolean;
@@ -28,7 +28,7 @@ interface ConnectedDeviceInfo {
28
28
  siteLocalAddress: boolean;
29
29
  }
30
30
 
31
- interface WifiDetails {
31
+ export interface WifiDetails {
32
32
  iswifienabled: boolean;
33
33
  issupportwifi: boolean;
34
34
  ssid: string;
@@ -48,7 +48,7 @@ interface WifiDetails {
48
48
  }
49
49
 
50
50
 
51
- interface PingResponse {
51
+ export interface PingResponse {
52
52
  line?: string;
53
53
  fullResponse?: string;
54
54
  progress?: number;
@@ -56,7 +56,7 @@ interface PingResponse {
56
56
  linesRead?: number;
57
57
  }
58
58
 
59
- interface IpInfo {
59
+ export interface IpInfo {
60
60
  type: string;
61
61
  signal: number;
62
62
  speed: number;