Update 0.1.6 - Fix UI settings & Delay Detection

This commit is contained in:
2025-09-13 20:08:24 +02:00
parent 04a8ee3186
commit a0957715a5
5 changed files with 168 additions and 7 deletions

View File

@@ -218,14 +218,42 @@ public class SettingsUi : WindowMediatorSubscriberBase
{
_configService.Current.EnableAutoDetectDiscovery = enableDiscovery;
_configService.Save();
// notify services of toggle
Mediator.Publish(new NearbyDetectionToggled(enableDiscovery));
// if Nearby is turned OFF, force Allow Pair Requests OFF as well
if (!enableDiscovery && _configService.Current.AllowAutoDetectPairRequests)
{
_configService.Current.AllowAutoDetectPairRequests = false;
_configService.Save();
Mediator.Publish(new AllowPairRequestsToggled(false));
}
}
bool allowRequests = _configService.Current.AllowAutoDetectPairRequests;
if (ImGui.Checkbox("Allow pair requests", ref allowRequests))
// Allow Pair Requests is disabled when Nearby is OFF
using (ImRaii.Disabled(!enableDiscovery))
{
_configService.Current.AllowAutoDetectPairRequests = allowRequests;
_configService.Save();
bool allowRequests = _configService.Current.AllowAutoDetectPairRequests;
if (ImGui.Checkbox("Allow pair requests", ref allowRequests))
{
_configService.Current.AllowAutoDetectPairRequests = allowRequests;
_configService.Save();
// notify services of toggle
Mediator.Publish(new AllowPairRequestsToggled(allowRequests));
// user-facing info toast
Mediator.Publish(new NotificationMessage(
"Nearby Detection",
allowRequests ? "Pair requests enabled: others can invite you." : "Pair requests disabled: others cannot invite you.",
NotificationType.Info,
default));
}
}
if (enableDiscovery)
// Radius only available when both Nearby and Allow Pair Requests are ON
if (enableDiscovery && _configService.Current.AllowAutoDetectPairRequests)
{
ImGui.Indent();
int maxMeters = _configService.Current.AutoDetectMaxDistanceMeters;