What is Connectivity and how does it solve the captive portal problem?
mainConnectivity is a wrapper for Apple's Reachability. While Reachability only indicates if a network interface is available (e.g., Wi-Fi is on), it cannot detect if that interface actually provides Internet access.
Connectivity solves the captive portal problem (where a device is connected to a Wi-Fi network that requires user registration/login before granting Internet access). It achieves this by replicating the mechanism iOS uses: contacting specific endpoints and checking if the response contains a specific success indicator (like the word Success). If a captive portal intercepts the request and returns a login page instead, Connectivity detects that the expected success indicator is missing and reports a lack of Internet connectivity.