2018-03-17 18:22:05 -06:00
|
|
|
// Copyright 2018 Dolphin Emulator Project
|
2021-07-04 19:22:19 -06:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2018-03-17 18:22:05 -06:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
2021-12-27 11:09:47 -07:00
|
|
|
#include <string_view>
|
2018-03-17 18:22:05 -06:00
|
|
|
|
2021-03-12 18:10:53 -07:00
|
|
|
// Refer to docs/autoupdate_overview.md for a detailed overview of the autoupdate process
|
|
|
|
|
2018-03-17 18:22:05 -06:00
|
|
|
// This class defines all the logic for Dolphin auto-update checking. UI-specific elements have to
|
|
|
|
// be defined in a backend specific subclass.
|
|
|
|
class AutoUpdateChecker
|
|
|
|
{
|
|
|
|
public:
|
2022-11-01 00:08:35 -06:00
|
|
|
enum class CheckType
|
|
|
|
{
|
|
|
|
Automatic,
|
|
|
|
Manual,
|
|
|
|
};
|
2018-03-17 18:22:05 -06:00
|
|
|
// Initiates a check for updates in the background. Calls the OnUpdateAvailable callback if an
|
|
|
|
// update is available, does "nothing" otherwise.
|
2022-11-01 00:08:35 -06:00
|
|
|
void CheckForUpdate(std::string_view update_track, std::string_view hash_override,
|
|
|
|
CheckType check_type);
|
2018-03-17 18:22:05 -06:00
|
|
|
|
2018-03-22 05:20:15 -06:00
|
|
|
static bool SystemSupportsAutoUpdates();
|
|
|
|
|
2018-03-17 18:22:05 -06:00
|
|
|
struct NewVersionInformation
|
|
|
|
{
|
|
|
|
// Name (5.0-1234) and revision hash of the new version.
|
|
|
|
std::string new_shortrev;
|
|
|
|
std::string new_hash;
|
|
|
|
|
|
|
|
// The full changelog in HTML format.
|
|
|
|
std::string changelog_html;
|
|
|
|
|
|
|
|
// Internals, to be passed to the updater binary.
|
|
|
|
std::string this_manifest_url;
|
|
|
|
std::string next_manifest_url;
|
|
|
|
std::string content_store_url;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Starts the updater process, which will wait in the background until the current process exits.
|
2018-03-22 17:29:03 -06:00
|
|
|
enum class RestartMode
|
|
|
|
{
|
|
|
|
NO_RESTART_AFTER_UPDATE = 0,
|
|
|
|
RESTART_AFTER_UPDATE,
|
|
|
|
};
|
|
|
|
void TriggerUpdate(const NewVersionInformation& info, RestartMode restart_mode);
|
2018-03-17 18:22:05 -06:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void OnUpdateAvailable(const NewVersionInformation& info) = 0;
|
|
|
|
};
|