Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ public string? Visibility {
}
}

public string? CurrentVisibilityNote { get; private set; }

bool Local => _onLocalPath?.Invoke() == true;

public string SavedNote => Local
Expand Down Expand Up @@ -209,10 +207,8 @@ public async Task OnEnterAsync(CancellationToken ct) {
try {
var config = await AppConfig.LoadProfileConfig(_config, ct).ConfigureAwait(true);
var profileName = _resolveProfileName?.Invoke() ?? config.ActiveProfile;
if (config.Profiles.GetValueOrDefault(profileName ?? ProfileConfig.DefaultName) is { } profile) {
NoteCurrentVisibility(profile.DefaultVisibility);
if (config.Profiles.GetValueOrDefault(profileName ?? ProfileConfig.DefaultName) is { } profile)
UseProviderApiKey = profile.UseProviderApiKey;
}
} catch (Exception ex) {
Message = $"Could not read your settings: {ex.Message}. Go back and try again.";
return;
Expand Down Expand Up @@ -313,17 +309,10 @@ await ConfigMutator.MutateAsync(_config, c => {
}

Message = null;
NoteCurrentVisibility(visibility);

return true;
}

void NoteCurrentVisibility(string? value) {
var current = VisibilityOptions.FirstOrDefault(o => o.Value == value);
CurrentVisibilityNote = current is null ? null : $"Current setting: {current.Label}.";
this.RaisePropertyChanged(nameof(CurrentVisibilityNote));
}

async Task InstallSelectedAsync() {
Busy = true;
try {
Expand Down
2 changes: 0 additions & 2 deletions src/Capacitor.App/Views/Onboarding/HarnessesPaneView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
<StackPanel Spacing="8">
<TextBlock Classes="onboardingMicro" Text="WHO CAN READ NEW SESSIONS" />
<TextBlock Classes="onboardingDetail" Text="Choose a privacy setting before continuing, even if you connect your harnesses later." />
<TextBlock Classes="onboardingNote" Text="{Binding CurrentVisibilityNote}"
IsVisible="{Binding CurrentVisibilityNote, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" />
<TextBlock Classes="onboardingDetail">
<Run Text="Applies to sessions recorded on " /><Run Text="{Binding MachineName}" FontFamily="{StaticResource OnboardingMonoFont}"
Foreground="{StaticResource OnboardingTextBrush}" /><Run Text=". Sessions can still be shared or hidden individually." />
Expand Down
6 changes: 2 additions & 4 deletions test/Capacitor.App.Tests.Unit/HarnessesStepViewModelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,10 @@ public async Task Next_saves_who_can_read_and_the_provider_key_answer_to_the_pro
};
await File.WriteAllTextAsync(ConfigPath, JsonSerializer.Serialize(existing, ProfileConfigJsonContext.Default.ProfileConfig));

var (visibility, useKey, note) = await AvaloniaSession.DispatchAsync(async () => {
var (visibility, useKey) = await AvaloniaSession.DispatchAsync(async () => {
var h = new Harness(Config.Root) { ProviderKeys = new HashSet<string> { "ANTHROPIC_API_KEY" } };
await h.Vm.OnEnterAsync(CancellationToken.None);
await Assert.That(h.Vm.Visibility).IsNull();
await Assert.That(h.Vm.CurrentVisibilityNote).Contains("People I share a project with");
await Assert.That(h.Vm.CanContinue).IsFalse();
await Assert.That(h.Vm.UseProviderApiKey).IsTrue();
h.Vm.Visibility = "private";
Expand All @@ -278,12 +277,11 @@ public async Task Next_saves_who_can_read_and_the_provider_key_answer_to_the_pro
await h.Vm.CanLeaveAsync(WizardNavigation.Next, CancellationToken.None);

var profile = ConfigMutator.LoadPure(ConfigPath).Profiles["acme"];
return (profile.DefaultVisibility, profile.UseProviderApiKey, h.Vm.CurrentVisibilityNote);
return (profile.DefaultVisibility, profile.UseProviderApiKey);
});

await Assert.That(visibility).IsEqualTo("private");
await Assert.That(useKey).IsTrue();
await Assert.That(note).IsEqualTo("Current setting: Only me.");
}

/// The question is only asked when a key is exported and the harness that would use it records.
Expand Down
Loading