@capgo/capacitor-wifi 8.0.4 → 8.0.5
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.
|
@@ -44,7 +44,7 @@ import java.util.List;
|
|
|
44
44
|
)
|
|
45
45
|
public class CapacitorWifiPlugin extends Plugin {
|
|
46
46
|
|
|
47
|
-
private final String pluginVersion = "8.0.
|
|
47
|
+
private final String pluginVersion = "8.0.5";
|
|
48
48
|
|
|
49
49
|
private WifiManager wifiManager;
|
|
50
50
|
private ConnectivityManager connectivityManager;
|
|
@@ -6,7 +6,7 @@ import CoreLocation
|
|
|
6
6
|
|
|
7
7
|
@objc(CapacitorWifiPlugin)
|
|
8
8
|
public class CapacitorWifiPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
9
|
-
private let pluginVersion: String = "8.0.
|
|
9
|
+
private let pluginVersion: String = "8.0.5"
|
|
10
10
|
public let identifier = "CapacitorWifiPlugin"
|
|
11
11
|
public let jsName = "CapacitorWifi"
|
|
12
12
|
public let pluginMethods: [CAPPluginMethod] = [
|
|
@@ -175,53 +175,23 @@ public class CapacitorWifiPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
175
175
|
// MARK: - Helper Methods
|
|
176
176
|
|
|
177
177
|
private func getCurrentSSID() -> String? {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
|
178
|
+
var currentSSID: String?
|
|
179
|
+
NEHotspotNetwork.fetchCurrent { network in
|
|
180
|
+
currentSSID = network?.ssid
|
|
198
181
|
}
|
|
182
|
+
return currentSSID
|
|
199
183
|
}
|
|
200
184
|
|
|
201
185
|
private func getLocationPermissionStatus() -> String {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
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
|
-
}
|
|
186
|
+
switch CLLocationManager.authorizationStatus() {
|
|
187
|
+
case .authorizedAlways, .authorizedWhenInUse:
|
|
188
|
+
return "granted"
|
|
189
|
+
case .denied, .restricted:
|
|
190
|
+
return "denied"
|
|
191
|
+
case .notDetermined:
|
|
192
|
+
return "prompt"
|
|
193
|
+
@unknown default:
|
|
194
|
+
return "prompt"
|
|
225
195
|
}
|
|
226
196
|
}
|
|
227
197
|
}
|