cordova.plugins.diagnostic 7.2.6 → 7.2.7

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 CHANGED
@@ -1,5 +1,8 @@
1
1
  # CHANGELOG
2
2
 
3
+ **v7.2.7**
4
+ (ios) bugfix: Handle DNS PolicyDenied like EPERM for local network permission detection
5
+
3
6
  **v7.2.6**
4
7
  * (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
8
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "7.2.6",
2
+ "version": "7.2.7",
3
3
  "name": "cordova.plugins.diagnostic",
4
4
  "cordova_name": "Diagnostic",
5
5
  "description": "Cordova/Phonegap plugin to check the state of Location/WiFi/Camera/Bluetooth device settings.",
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.6">
5
+ version="7.2.7">
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
- if (!error) {
304
- return NO;
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
- nw_error_domain_t errorDomain = nw_error_get_error_domain(error);
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