cordova.plugins.diagnostic 7.2.6 → 7.2.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/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/plugin.xml +1 -1
- package/src/ios/Diagnostic_Wifi.m +20 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
**v7.2.8**
|
|
4
|
+
(ios) bugfix: Avoid reporting false-positive Local Network Permission Denied by returning indeterminate result, instead of denied, if NSNetService publish fails with an error, as it can fail for reasons other than permission denied.
|
|
5
|
+
|
|
6
|
+
**v7.2.7**
|
|
7
|
+
(ios) bugfix: Handle DNS PolicyDenied like EPERM for local network permission detection
|
|
8
|
+
|
|
3
9
|
**v7.2.6**
|
|
4
10
|
* (ios) fix: Local Network status check now accepts a configurable timeout, detects permission denials via NWBrowser errors/NSNetService failures, and returns `UNKNOWN` instead of `DENIED_ALWAYS` when the probe times out. This works around an issue where, if the network stack is under load, local network permission may be falsely reported as denied because iOS fails to resolve the Bonjour service within the default timeout period.
|
|
5
11
|
|
package/package.json
CHANGED
package/plugin.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
|
|
3
3
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
4
4
|
id="cordova.plugins.diagnostic"
|
|
5
|
-
version="7.2.
|
|
5
|
+
version="7.2.8">
|
|
6
6
|
|
|
7
7
|
<name>Diagnostic</name>
|
|
8
8
|
<description>Cordova/Phonegap plugin to check the state of Location/WiFi/Camera/Bluetooth device settings.</description>
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
#import <net/if.h> // For IFF_LOOPBACK
|
|
14
14
|
#import <Network/Network.h>
|
|
15
15
|
#import <Network/browser.h>
|
|
16
|
+
#import <dns_sd.h>
|
|
16
17
|
#import <errno.h>
|
|
17
18
|
|
|
18
19
|
// UserDefaults key for caching local network permission
|
|
@@ -300,13 +301,21 @@ static NSTimeInterval const kLocalNetworkDefaultTimeoutSeconds = 2.0;
|
|
|
300
301
|
|
|
301
302
|
- (BOOL)isPermissionDeniedError:(nw_error_t)error
|
|
302
303
|
{
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
304
|
+
if (!error) {
|
|
305
|
+
return NO;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
nw_error_domain_t errorDomain = nw_error_get_error_domain(error);
|
|
309
|
+
int errorCode = (int)nw_error_get_error_code(error);
|
|
310
|
+
if (errorDomain == nw_error_domain_posix && errorCode == EPERM) {
|
|
311
|
+
return YES;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (errorDomain == nw_error_domain_dns && errorCode == kDNSServiceErr_PolicyDenied) {
|
|
315
|
+
return YES;
|
|
316
|
+
}
|
|
306
317
|
|
|
307
|
-
|
|
308
|
-
int errorCode = (int)nw_error_get_error_code(error);
|
|
309
|
-
return (errorDomain == nw_error_domain_posix && errorCode == EPERM);
|
|
318
|
+
return NO;
|
|
310
319
|
}
|
|
311
320
|
|
|
312
321
|
- (void)handleBrowserState:(nw_browser_state_t)newState error:(nw_error_t)error context:(NSString *)context
|
|
@@ -425,6 +434,10 @@ static NSTimeInterval const kLocalNetworkDefaultTimeoutSeconds = 2.0;
|
|
|
425
434
|
NSNumber *errorDomain = errorDict[NSNetServicesErrorDomain];
|
|
426
435
|
NSNumber *errorCode = errorDict[NSNetServicesErrorCode];
|
|
427
436
|
[diagnostic logDebug:[NSString stringWithFormat:@"netService didNotPublish (domain=%@, code=%@)", errorDomain, errorCode]];
|
|
428
|
-
|
|
437
|
+
// NSNetService can fail to publish for many reasons unrelated to permissions (network issues,
|
|
438
|
+
// name collisions, configuration problems, etc.). We cannot reliably determine permission denial
|
|
439
|
+
// from NSNetService error codes alone, so return indeterminate. The browser state handler in
|
|
440
|
+
// handleBrowserState will catch actual permission denials via isPermissionDeniedError.
|
|
441
|
+
[self completeLocalNetworkFlowWithState:LocalNetworkPermissionStateIndeterminate shouldCache:NO];
|
|
429
442
|
}
|
|
430
443
|
@end
|