Esempio n. 1
0
        /// <summary>
        /// Trys to send a telemetry report which does not contain any information of the user.
        /// This method is called after the user agreed to the Privacy Policy. This process cannot be deactivated.
        /// </summary>
        /// <returns>Whether or not the request was successfully send</returns>
        public static async Task <bool> SendFirstStartTelemetry()
        {
            if (BridgeInformation.demoMode || sentFirstStartTelemetry)
            {
                return(false);
            }

            //It is probably not the best idea to use 'verifed: true' in the content of a request as verification.
            //However, it's just a very basic protection so that not everyone can just open the URL in the Browser and maniplate the collected statistics.
            string response = await InternetRequests.SendJsonPostRequest(firstTimeTelemetryURL, "{ \"verifed\": true }");

            sentFirstStartTelemetry = response != "null";
            return(sentFirstStartTelemetry);
        }
Esempio n. 2
0
        /// <summary>
        /// Trys to send a telemetry report which contains the user's country and state. In order to obtain this information, this application uses a service from Cloudflare.
        /// This method is called after the user started the application and when telemetry is activated.
        /// For more information you can read the summary of the Privacy Policy: https://clemenskoprolin.com/lightparty/legal/
        /// </summary>
        /// <returns>Whether or not the report was successfully send</returns>
        public static async Task <bool> SendTelemetryReport()
        {
            if (BridgeInformation.demoMode || !(bool)useTelemetry || sentTelemetryReport)
            {
                return(false);
            }

            string[] userLocation = await GetUserLocation();

            //Creates a json string from the location data.
            JsonObject jsonObject = new JsonObject();

            jsonObject["state"]   = JsonValue.CreateStringValue(userLocation[0]);
            jsonObject["country"] = JsonValue.CreateStringValue(userLocation[1]);

            string jsonString = jsonObject.Stringify();
            string response   = await InternetRequests.SendJsonPostRequest(telemetryReportURL, jsonString);

            sentTelemetryReport = response != "null";
            return(sentTelemetryReport);
        }