Skip to content
16 changes: 11 additions & 5 deletions src/HearThis/Communication/AndroidLink.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// --------------------------------------------------------------------------------------------
#region // Copyright (c) 2014-2025, SIL Global.
// <copyright from='2014' to='2025' company='SIL Global'>
// Copyright (c) 2014-2025, SIL Global.
#region // Copyright (c) 2014-2026, SIL Global.
// <copyright from='2014' to='2026' company='SIL Global'>
// Copyright (c) 2014-2026, SIL Global.
//
// Distributable under the terms of the MIT License (https://sil.mit-license.org/)
// </copyright>
#endregion
// --------------------------------------------------------------------------------------------
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Text;
Expand Down Expand Up @@ -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;
}

Expand Down
24 changes: 12 additions & 12 deletions src/HearThis/Communication/AndroidSynchronization.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
// --------------------------------------------------------------------------------------------
#region // Copyright (c) 2016-2025, SIL Global.
// <copyright from='2016' to='2025' company='SIL Global'>
// Copyright (c) 2016-2025, SIL Global.
#region // Copyright (c) 2016-2026, SIL Global.
// <copyright from='2016' to='2026' company='SIL Global'>
// Copyright (c) 2016-2026, SIL Global.
//
// Distributable under the terms of the MIT License (https://sil.mit-license.org/)
// </copyright>
#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
{
Expand Down Expand Up @@ -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."));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
23 changes: 12 additions & 11 deletions src/HearThis/Script/Project.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
// --------------------------------------------------------------------------------------------
#region // Copyright (c) 2011-2025, SIL Global.
// <copyright from='2011' to='2025' company='SIL Global'>
// Copyright (c) 2011-2025, SIL Global.
#region // Copyright (c) 2011-2026, SIL Global.
// <copyright from='2011' to='2026' company='SIL Global'>
// Copyright (c) 2011-2026, SIL Global.
//
// Distributable under the terms of the MIT License (https://sil.mit-license.org/)
// </copyright>
#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
{
Expand Down
17 changes: 9 additions & 8 deletions src/HearThis/UI/AndroidSyncDialog.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
// --------------------------------------------------------------------------------------------
#region // Copyright (c) 2015-2025, SIL Global.
// <copyright from='2015' to='2025' company='SIL Global'>
// Copyright (c) 2015-2025, SIL Global.
#region // Copyright (c) 2015-2026, SIL Global.
// <copyright from='2015' to='2026' company='SIL Global'>
// Copyright (c) 2015-2026, SIL Global.
//
// Distributable under the terms of the MIT License (https://sil.mit-license.org/)
// </copyright>
#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;
using System.Text;
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
{
Expand Down