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
26 changes: 24 additions & 2 deletions src/app/client_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ namespace {

/**
* @brief Close the active dialog and release staged picker data before streaming can begin.
* @param state Client state containing the dialog and any temporary folder listing.
* @param state Client state containing the dialog and its temporary content.
*/
void close_modal(app::ClientState &state) {
if (state.modal.id == app::ModalId::directory_picker) {
Expand All @@ -703,6 +703,9 @@ namespace {
if (state.modal.id == app::ModalId::screenshot_viewer) {
state.screenshotViewer = {};
}
if (state.modal.id == app::ModalId::stream_summary) {
state.streamSummaryLines.clear();
}
state.modal = {};
reset_confirmation(state);
}
Expand Down Expand Up @@ -801,6 +804,7 @@ namespace {
case app::ModalId::connection_test:
case app::ModalId::screenshot_viewer:
case app::ModalId::quit_progress:
case app::ModalId::stream_summary:
return 0U;
}
return 0U;
Expand Down Expand Up @@ -1600,6 +1604,7 @@ namespace {
case app::ModalId::directory_picker:
case app::ModalId::screenshot_viewer:
case app::ModalId::quit_progress:
case app::ModalId::stream_summary:
return true;
case app::ModalId::confirmation:
return handle_confirmation_modal_activation(state, update);
Expand Down Expand Up @@ -1798,6 +1803,16 @@ namespace {
return false;
}

if (state.modal.id == app::ModalId::stream_summary) {
if (const auto confirm = state.shell.inputDevice == input::UiInputDevice::keyboard ? input::UiCommand::confirm : input::UiCommand::activate; command == confirm) {
close_modal_and_mark_closed(state, update);
if (update != nullptr) {
update->navigation.activatedItemId = "confirm-stream-summary";
}
}
return true;
}

if (state.modal.id == app::ModalId::connection_test && state.connectionTest.inProgress) {
return true;
}
Expand Down Expand Up @@ -3023,10 +3038,17 @@ namespace app {
state.appQuit = {};
}

void show_stream_summary(ClientState &state, std::vector<std::string> lines) {
state.streamSummaryLines = std::move(lines);
state.shell.overlayVisible = false;
state.shell.overlayScrollOffset = 0U;
open_modal(state, ModalId::stream_summary);
}

AppUpdate handle_command(ClientState &state, input::UiCommand command) {
AppUpdate update {};

if (handle_overlay_command(state, command, &update)) {
if (state.modal.id != ModalId::stream_summary && handle_overlay_command(state, command, &update)) {
return update;
}

Expand Down
9 changes: 9 additions & 0 deletions src/app/client_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ namespace app {
directory_picker, ///< Screenshot destination browser and local folder-name keyboard.
screenshot_viewer, ///< Local captures associated with the selected server and app.
quit_progress, ///< Authenticated host-app quit operation running in the background.
stream_summary, ///< Completed stream details on the app picker.
};

/**
Expand Down Expand Up @@ -462,6 +463,7 @@ namespace app {
DirectoryPickerState directoryPicker; ///< Pending screenshot-directory workflow.
ScreenshotViewerState screenshotViewer; ///< Local app screenshot library, released when browsing ends.
AppQuitState appQuit; ///< Retained target for a confirmed host-app quit operation.
std::vector<std::string> streamSummaryLines; ///< Session outcome and statistics retained until confirmation.
ConfirmationDialogState confirmation; ///< Confirmation dialog content for destructive actions.
};

Expand Down Expand Up @@ -757,6 +759,13 @@ namespace app {
* @param message Completion or actionable failure detail.
*/
void apply_app_quit_result(ClientState &state, bool succeeded, const std::string &message);

/**
* @brief Open the completed stream summary over the current app picker.
* @param state Client state receiving the summary.
* @param lines Final session outcome and statistics.
*/
void show_stream_summary(ClientState &state, std::vector<std::string> lines);
/**
* @brief Remove a deleted capture from the open viewer and keep its selection in range.
* @param state Viewer that requested deletion.
Expand Down
10 changes: 8 additions & 2 deletions src/network/host_pairing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2813,7 +2813,8 @@ namespace network {
const PairingIdentity *clientIdentity,
int appId,
std::vector<unsigned char> *assetBytes,
std::string *errorMessage
std::string *errorMessage,
const std::atomic<bool> *cancelRequested
) {
if (address.empty() || httpsPort == 0 || appId <= 0) {
return append_error(errorMessage, "The app-asset request requires a valid host address, port, and app ID");
Expand All @@ -2822,7 +2823,12 @@ namespace network {
std::vector<std::string> attemptFailures;
for (const std::string &path : build_app_asset_paths(resolve_client_unique_id(clientIdentity), appId)) {
HttpResponse response {};
if (std::string attemptError; !http_get(address, httpsPort, path, true, clientIdentity, {}, &response, &attemptError)) {
std::string attemptError;
const bool downloaded = http_get(address, httpsPort, path, true, clientIdentity, {}, &response, &attemptError, cancelRequested);
if (pairing_cancel_requested(cancelRequested)) {
return append_error(errorMessage, "App artwork download cancelled");
}
if (!downloaded) {
std::string failure = path;
failure += ": ";
failure += attemptError;
Expand Down
4 changes: 3 additions & 1 deletion src/network/host_pairing.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ namespace network {
* @param appId Host application identifier.
* @param assetBytes Output vector populated with downloaded asset bytes.
* @param errorMessage Optional output for request failures.
* @param cancelRequested Optional flag checked during the transfer and before trying alternate asset paths.
* @return true when the asset was downloaded successfully.
*/
bool query_app_asset(
Expand All @@ -229,7 +230,8 @@ namespace network {
const PairingIdentity *clientIdentity,
int appId,
std::vector<unsigned char> *assetBytes,
std::string *errorMessage = nullptr
std::string *errorMessage = nullptr,
const std::atomic<bool> *cancelRequested = nullptr
);

/**
Expand Down
Loading
Loading