<commit_before>using Plugin.Connectivity.Abstractions;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;


namespace Plugin.Connectivity
{
	/// <summary>
	/// Implementation for Connectivity
	/// </summary>
	public class ConnectivityImplementation : BaseConnectivity
	{
		/// <summary>
		/// Default constructor
		/// </summary>
		public ConnectivityImplementation()
		{
			UpdateConnected(false);
			Reachability.ReachabilityChanged += ReachabilityChanged;
		}

		void ReachabilityChanged(object sender, EventArgs e)
		{
			UpdateConnected();
		}


		private bool isConnected;
		private NetworkStatus previousInternetStatus = NetworkStatus.NotReachable;
		private void UpdateConnected(bool triggerChange = true)
		{
			var remoteHostStatus = Reachability.RemoteHostStatus();<commit_msg>Fix iOS lock & Fix connectivity changed disconnected<commit_after>using Plugin.Connectivity.Abstractions;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;


namespace Plugin.Connectivity
{
	/// <summary>
	/// Implementation for Connectivity
	/// </summary>
	public class ConnectivityImplementation : BaseConnectivity
	{
		/// <summary>
		/// Default constructor
		/// </summary>
		public ConnectivityImplementation()
		{
			//start an update on the background.
			Task.Run(() => { UpdateConnected(false);});
			Reachability.ReachabilityChanged += ReachabilityChanged;
		}

		async void ReachabilityChanged(object sender, EventArgs e)
		{
			//Add in artifical delay so the connection status has time to change
			//else it will return true no matter what.
			await Task.Delay(100);
			UpdateConnected();
		}


		private bool isConnected;
		private NetworkStatus previousInternetStatus = NetworkStatus.NotReachable;
		private void UpdateConnected(bool triggerChange = true)
		{
			var remoteHostStatus = Reachability.RemoteHostStatus();
{'fraction_non_alphanumeric': 0.09433962264150944, 'fraction_numerical': 0.001451378809869376, 'mean_word_length': 4.5, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3108811', 'n_tokens_mistral': 628, 'n_tokens_neox': 566, 'n_words': 149}