Add contact preferences announcement

Persist contact options and announce them on chat connection and reconnection. Prepare the audio-only call contract; enforcement and audio-only media remain unimplemented.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Paul Schneider 2026-11-16 01:10:47 +00:00
commit 9c4cce6840
Signed by: notazof
GPG key ID: AD4B9B545FBD7D12
11 changed files with 150 additions and 5 deletions

View file

@ -5,6 +5,34 @@ namespace PostIt.Tests;
[Trait("Category", "non-reg")]
public class SettingsLoadTests
{
[Fact]
public void Contact_options_survive_save_and_load_and_legacy_settings_keep_defaults()
{
var path = Path.Combine(Path.GetTempPath(), $"postit-contact-{Guid.NewGuid():N}.json");
try
{
File.WriteAllText(path, "{}");
var settings = new PostIt.ViewModels.Settings(path);
settings.Load();
Assert.True(settings.AllowAudioCalls);
Assert.True(settings.AllowVideoCalls);
Assert.True(settings.AllowPrivateMessages);
settings.AllowAudioCalls = false;
settings.AllowPrivateMessages = false;
Assert.True(settings.IsDirty);
settings.Save();
var restored = new PostIt.ViewModels.Settings(path);
restored.Load();
Assert.False(restored.AllowAudioCalls);
Assert.True(restored.AllowVideoCalls);
Assert.False(restored.AllowPrivateMessages);
Assert.False(restored.IsDirty);
}
finally { File.Delete(path); }
}
/// <summary>
/// On the dev machine, the user-level settings file
/// (~/.config/PostIt/postit-settings.json) does not exist, so Load()