diff --git a/src/HearThis/Communication/AndroidLink.cs b/src/HearThis/Communication/AndroidLink.cs index 67a6da41..957dbff5 100644 --- a/src/HearThis/Communication/AndroidLink.cs +++ b/src/HearThis/Communication/AndroidLink.cs @@ -1,13 +1,14 @@ // -------------------------------------------------------------------------------------------- -#region // Copyright (c) 2014-2025, SIL Global. -// -// Copyright (c) 2014-2025, SIL Global. +#region // Copyright (c) 2014-2026, SIL Global. +// +// Copyright (c) 2014-2026, SIL Global. // // Distributable under the terms of the MIT License (https://sil.mit-license.org/) // #endregion // -------------------------------------------------------------------------------------------- using System; +using System.Diagnostics; using System.IO; using System.Net; using System.Text; @@ -133,10 +134,15 @@ public bool PutFile(string androidPath, byte[] data) return true; } - public bool SendNotification(string message) + public bool SendNotification(string status) { + // Send sync status to Android. + // Note: commenting out the UploadData() call here causes HearThis to never + // finish the sync in progress. This is a convenient way to provoke and measure + // a timeout on the Android. WebClient myClient = new WebClient(); - myClient.UploadData(_address + "/notify?message=" + Uri.EscapeDataString(message), new byte[] {0}); + myClient.UploadData(_address + "/notify?status=" + Uri.EscapeDataString(status), new byte[] {0}); + return true; } diff --git a/src/HearThis/Communication/AndroidSynchronization.cs b/src/HearThis/Communication/AndroidSynchronization.cs index 576c5c8b..408518e2 100644 --- a/src/HearThis/Communication/AndroidSynchronization.cs +++ b/src/HearThis/Communication/AndroidSynchronization.cs @@ -1,25 +1,26 @@ // -------------------------------------------------------------------------------------------- -#region // Copyright (c) 2016-2025, SIL Global. -// -// Copyright (c) 2016-2025, SIL Global. +#region // Copyright (c) 2016-2026, SIL Global. +// +// Copyright (c) 2016-2026, SIL Global. // // Distributable under the terms of the MIT License (https://sil.mit-license.org/) // #endregion // -------------------------------------------------------------------------------------------- +using DesktopAnalytics; +using HearThis.Script; +using HearThis.UI; +using L10NSharp; +using SIL.IO; using System; +using System.Diagnostics; using System.IO; using System.Net; using System.Net.Sockets; using System.Threading.Tasks; using System.Windows.Forms; -using DesktopAnalytics; -using HearThis.Script; -using HearThis.UI; -using L10NSharp; -using SIL.IO; -using static System.String; using static HearThis.Communication.PreferredNetworkInterfaceResolver; +using static System.String; namespace HearThis.Communication { @@ -137,10 +138,9 @@ bool RetryOnTimeout(WebException ex, string path) } else { - // TODO (HT-508): Send a specific notification so HTA knows the sync was + // HT-508: Send a specific notification so HTA knows the sync was // interrupted. - // theirLink.SendNotification("sync_interrupted"); - theirLink.SendNotification("sync_success"); + theirLink.SendNotification("sync_canceled"); dlg.ProgressBox.WriteMessage(LocalizationManager.GetString( "AndroidSynchronization.Progress.Canceled", "Sync was canceled by the user.")); diff --git a/src/HearThis/Communication/PreferredNetworkInterfaceResolver.cs b/src/HearThis/Communication/PreferredNetworkInterfaceResolver.cs index 388f9e1e..1e2702aa 100644 --- a/src/HearThis/Communication/PreferredNetworkInterfaceResolver.cs +++ b/src/HearThis/Communication/PreferredNetworkInterfaceResolver.cs @@ -111,7 +111,7 @@ public IPAddress GetBestActiveInterface(out FailureReason failureReason) // Of these, we care only about Wi-Fi and Ethernet. if (ni.Type == Wireless80211) { - // We always assume that wireless is better than wired, so once we get a + // We always assume that wireless is preferred over wired, so once we get a // Wi-Fi candidate, we ignore any subsequent Ethernet candidates. RememberBestInterface(ref wifiInterface, ni, ip, interfaceIndex); } diff --git a/src/HearThis/Script/Project.cs b/src/HearThis/Script/Project.cs index 09aa188a..1774eb4c 100644 --- a/src/HearThis/Script/Project.cs +++ b/src/HearThis/Script/Project.cs @@ -1,28 +1,29 @@ // -------------------------------------------------------------------------------------------- -#region // Copyright (c) 2011-2025, SIL Global. -// -// Copyright (c) 2011-2025, SIL Global. +#region // Copyright (c) 2011-2026, SIL Global. +// +// Copyright (c) 2011-2026, SIL Global. // // Distributable under the terms of the MIT License (https://sil.mit-license.org/) // #endregion // -------------------------------------------------------------------------------------------- -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; using DesktopAnalytics; using HearThis.Properties; using HearThis.Publishing; using L10NSharp; using SIL.IO; using SIL.Reporting; -using static HearThis.Script.BibleStatsBase; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; using static HearThis.Program; -using static System.String; using static HearThis.SafeSettings; +using static HearThis.Script.BibleStatsBase; +using static System.String; namespace HearThis.Script { diff --git a/src/HearThis/UI/AndroidSyncDialog.cs b/src/HearThis/UI/AndroidSyncDialog.cs index b3a67f48..587a3a36 100644 --- a/src/HearThis/UI/AndroidSyncDialog.cs +++ b/src/HearThis/UI/AndroidSyncDialog.cs @@ -1,14 +1,19 @@ // -------------------------------------------------------------------------------------------- -#region // Copyright (c) 2015-2025, SIL Global. -// -// Copyright (c) 2015-2025, SIL Global. +#region // Copyright (c) 2015-2026, SIL Global. +// +// Copyright (c) 2015-2026, SIL Global. // // Distributable under the terms of the MIT License (https://sil.mit-license.org/) // #endregion // -------------------------------------------------------------------------------------------- +using L10NSharp; +using SIL.Reporting; +using SIL.Windows.Forms.Extensions; +using SIL.Windows.Forms.Progress; using System; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Net; using System.Net.Sockets; @@ -16,14 +21,10 @@ using System.Text.RegularExpressions; using System.Threading; using System.Windows.Forms; -using L10NSharp; -using SIL.Reporting; -using SIL.Windows.Forms.Extensions; -using SIL.Windows.Forms.Progress; using ZXing; +using static SIL.Windows.Forms.Extensions.ControlExtensions.ErrorHandlingAction; using static System.String; using static System.Windows.Forms.MessageBoxButtons; -using static SIL.Windows.Forms.Extensions.ControlExtensions.ErrorHandlingAction; namespace HearThis.UI {