Skip to content
Open
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
1 change: 1 addition & 0 deletions SalmonEgg/SalmonEgg/Presentation/Views/Chat/ChatView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@
<!-- 输入区域 -->
<controls:ResponsiveContentHost Grid.Row="5"
MaxContentWidth="{x:Bind models:UiLayout.ContentMaxWidth, Mode=OneTime}"
x:Load="{x:Bind ViewModel.ShouldLoadConversationInputSurface, Mode=OneWay}"
Visibility="{x:Bind ViewModel.ShouldShowConversationInputSurface, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}">
<controls:ResponsiveContentHost.Child>
<controls:ChatInputArea x:Name="ConversationInputArea"
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Uno.Sdk": "6.5.36"
},
"sdk": {
"version": "10.0.109",
"version": "10.0.103",
"rollForward": "latestMinor",
"allowPrerelease": false
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,9 @@ public bool ShouldLoadTranscriptSurface
public bool ShouldShowConversationInputSurface
=> ResolveConversationSurfaceProjection().ShouldShowConversationInputSurface;

public bool ShouldLoadConversationInputSurface
=> ResolveConversationSurfaceProjection().ShouldLoadConversationInputSurface;

public bool ShouldShowBlockingLoadingMask
=> ResolveConversationSurfaceProjection().ShouldShowBlockingLoadingMask;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ internal readonly record struct ChatConversationSurfaceProjection(
bool ShouldShowTranscriptSurface,
bool ShouldLoadTranscriptSurface,
bool ShouldShowConversationInputSurface,
bool ShouldLoadConversationInputSurface,
bool ShouldShowBlockingLoadingMask,
bool ShouldShowLoadingOverlayStatusPill,
bool ShouldShowLoadingOverlayPresenter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ internal sealed class ChatConversationSurfaceProjectionCoordinator
{
private bool _hasLoadedActiveConversationRoot;
private bool _hasLoadedTranscriptSurface;
private bool _hasLoadedConversationInputSurface;

public ChatConversationSurfaceProjection Project(ChatConversationSurfaceStateInput input)
{
var state = ChatConversationSurfaceStatePresenter.Resolve(input);

_hasLoadedActiveConversationRoot |= state.ShouldShowActiveConversationRoot;
_hasLoadedTranscriptSurface |= state.ShouldShowTranscriptSurface;
_hasLoadedConversationInputSurface |= state.ShouldShowConversationInputSurface;

return new ChatConversationSurfaceProjection(
state.IsActivationOverlayVisible,
Expand All @@ -23,6 +25,7 @@ public ChatConversationSurfaceProjection Project(ChatConversationSurfaceStateInp
state.ShouldShowTranscriptSurface,
_hasLoadedTranscriptSurface,
state.ShouldShowConversationInputSurface,
_hasLoadedConversationInputSurface,
state.ShouldShowBlockingLoadingMask,
state.ShouldShowLoadingOverlayStatusPill,
state.ShouldShowLoadingOverlayPresenter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,51 @@ public void Project_WhenTranscriptSurfaceWasShown_KeepsLoadStateWhenLaterHidden(
Assert.False(hidden.ShouldShowTranscriptSurface);
Assert.True(hidden.ShouldLoadTranscriptSurface);
}

[Fact]
public void Project_WhenConversationInputSurfaceWasShown_KeepsLoadStateWhenLaterHidden()
{
var coordinator = new ChatConversationSurfaceProjectionCoordinator();

var visible = coordinator.Project(new ChatConversationSurfaceStateInput(
IsSessionActive: true,
CurrentSessionId: "conv-1",
MessageHistoryCount: 0,
VisibleTranscriptConversationId: null,
IsChatShellVisibleForRemoteUi: true,
IsConnecting: false,
IsInitializing: false,
IsHydrating: false,
IsLayoutLoading: false,
IsSessionSwitching: false,
SessionSwitchOverlayConversationId: null,
SessionSwitchPreviewConversationId: null,
ConnectionLifecycleOverlayConversationId: null,
HistoryOverlayConversationId: null,
PendingShellActivationConversationId: null,
HydrationLoadedMessageCount: 0));

var hidden = coordinator.Project(new ChatConversationSurfaceStateInput(
IsSessionActive: true,
CurrentSessionId: "conv-1",
MessageHistoryCount: 0,
VisibleTranscriptConversationId: null,
IsChatShellVisibleForRemoteUi: true,
IsConnecting: false,
IsInitializing: false,
IsHydrating: false,
IsLayoutLoading: false,
IsSessionSwitching: true,
SessionSwitchOverlayConversationId: "conv-2",
SessionSwitchPreviewConversationId: null,
ConnectionLifecycleOverlayConversationId: null,
HistoryOverlayConversationId: null,
PendingShellActivationConversationId: null,
HydrationLoadedMessageCount: 0));

Assert.True(visible.ShouldShowConversationInputSurface);
Assert.True(visible.ShouldLoadConversationInputSurface);
Assert.False(hidden.ShouldShowConversationInputSurface);
Assert.True(hidden.ShouldLoadConversationInputSurface);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1403,6 +1403,7 @@ public void ChatView_UsesDeferredTranscriptLoadingWithoutWholePageLifecycleHack(
Assert.Contains("x:Name=\"ActiveConversationRoot\"", xaml);
Assert.Contains("x:Load=\"{x:Bind ViewModel.ShouldLoadActiveConversationRoot, Mode=OneWay}\"", xaml);
Assert.Contains("x:Load=\"{x:Bind ViewModel.ShouldLoadTranscriptSurface, Mode=OneWay}\"", xaml);
Assert.Contains("x:Load=\"{x:Bind ViewModel.ShouldLoadConversationInputSurface, Mode=OneWay}\"", xaml);
Assert.Contains("Unloaded=\"OnMessagesListUnloaded\"", xaml);
Assert.Contains("private void OnMessagesListUnloaded", codeBehind);
Assert.DoesNotContain("PointerPressed=\"OnMessagesListPointerPressed\"", xaml, StringComparison.Ordinal);
Expand Down
Loading