dpa99c / phonegap-launch-navigator

Phonegap/Cordova plugin which launches native route navigation apps for Android, iOS and Windows
369 stars 129 forks source link

Fix enum naming collision #262

Closed blhylton closed 3 years ago

blhylton commented 3 years ago

PR Type

What kind of change does this PR introduce?

PR Checklist

For bug fixes / features, please check if your PR fulfills the following requirements:

What is the purpose of this PR?

Resolves #258

Does this PR introduce a breaking change?

What testing has been done on the changes in the PR?

Allows apps using this plugin with newer XCode versions to compile and function correctly

What testing has been done on existing functionality?

No changes to functionality; Purely a refactor.

Other information

j3gb3rt commented 3 years ago

@dpa99c I have seen the issue fixed by this PR on both xcode 12.0.1 and xcode 12.3. Manually applying this patch fixed it for us. Would love to get this via an update instead of having to use the patch as a workaround. I know you do this in your free time. The plugin is awesome! Keep it up 👍

j3gb3rt commented 3 years ago

@blhylton Actually I installed this commit directly with npm and found there are a few instances that didn't get updated with the new enums. Lines 182, 197, and 206 of src/ios/lib/LN_Reachability.m. I've updated them below

if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0)
    {
        /*
         If the target host is reachable and no connection is required then we'll assume (for now) that you're on Wi-Fi...
         */
        returnValue = LN_ReachableViaWiFi;
    }

    if ((((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) ||
        (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0))
    {
        /*
         ... and the connection is on-demand (or on-traffic) if the calling application is using the CFSocketStream or higher APIs...
         */

        if ((flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0)
        {
            /*
             ... and no [user] intervention is needed...
             */
            returnValue = LN_ReachableViaWiFi;
        }
    }

    if ((flags & kSCNetworkReachabilityFlagsIsWWAN) == kSCNetworkReachabilityFlagsIsWWAN)
    {
        /*
         ... but WWAN connections are OK if the calling application is using the CFNetwork APIs.
         */
        returnValue = LN_ReachableViaWWAN;
    }
blhylton commented 3 years ago

@j3gb3rt Good catch. I've updated the PR.

j3gb3rt commented 3 years ago

@dpa99c Just bumping this. Everything seems to be good here and it's just a small refactor. Using a custom branch of this right now (so no rush from me), but might help others