-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into dev/aaron-junker/File…
…ActionsMenu
- Loading branch information
Showing
50 changed files
with
424 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,6 +86,9 @@ howto | |
onefuzzconfig | ||
oip | ||
onefuzzingestionpreparationtool | ||
OTP | ||
Yubi | ||
Yubico | ||
|
||
# KEYS | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -193,6 +193,7 @@ capturevideosample | |
cmdow | ||
Controlz | ||
cortana | ||
dlnilsson | ||
fancymouse | ||
firefox | ||
gpt | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,3 @@ | |
#include <fstream> | ||
|
||
#include <common/logger/logger.h> | ||
#include <wil/filesystem.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#include "pch.h" | ||
#include "NotificationUtil.h" | ||
|
||
#include <common/notifications/notifications.h> | ||
#include <common/notifications/dont_show_again.h> | ||
#include <common/utils/resources.h> | ||
#include <common/SettingsAPI/settings_helpers.h> | ||
|
||
// Non-Localizable strings | ||
namespace NonLocalizable | ||
{ | ||
const wchar_t RunAsAdminInfoPage[] = L"https://aka.ms/powertoysDetectedElevatedHelp"; | ||
const wchar_t ToastNotificationButtonUrl[] = L"powertoys://cant_drag_elevated_disable/"; | ||
} | ||
|
||
namespace notifications | ||
{ | ||
NotificationUtil::NotificationUtil() | ||
{ | ||
ReadSettings(); | ||
auto settingsFileName = PTSettingsHelper::get_powertoys_general_save_file_location(); | ||
|
||
m_settingsFileWatcher = std::make_unique<FileWatcher>(settingsFileName, [this]() { | ||
ReadSettings(); | ||
}); | ||
} | ||
|
||
NotificationUtil::~NotificationUtil() | ||
{ | ||
m_settingsFileWatcher.reset(); | ||
} | ||
|
||
void NotificationUtil::WarnIfElevationIsRequired(std::wstring title, std::wstring message, std::wstring button1, std::wstring button2) | ||
{ | ||
if (m_warningsElevatedApps && !m_warningShown && !is_toast_disabled(ElevatedDontShowAgainRegistryPath, ElevatedDisableIntervalInDays)) | ||
{ | ||
std::vector<action_t> actions = { | ||
link_button{ button1, NonLocalizable::RunAsAdminInfoPage }, | ||
link_button{ button2, NonLocalizable::ToastNotificationButtonUrl } | ||
}; | ||
|
||
show_toast_with_activations(message, | ||
title, | ||
{}, | ||
std::move(actions)); | ||
|
||
m_warningShown = true; | ||
} | ||
} | ||
|
||
void NotificationUtil::ReadSettings() | ||
{ | ||
auto settings = PTSettingsHelper::load_general_settings(); | ||
m_warningsElevatedApps = settings.GetNamedBoolean(L"enable_warnings_elevated_apps", true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,22 @@ | ||
#pragma once | ||
|
||
#include <common/notifications/notifications.h> | ||
#include <common/notifications/dont_show_again.h> | ||
#include <common/utils/resources.h> | ||
#include <common/SettingsAPI/settings_helpers.h> | ||
|
||
#include "Generated Files/resource.h" | ||
#include <common/SettingsAPI/FileWatcher.h> | ||
|
||
namespace notifications | ||
{ | ||
// Non-Localizable strings | ||
namespace NonLocalizable | ||
class NotificationUtil | ||
{ | ||
const wchar_t RunAsAdminInfoPage[] = L"https://aka.ms/powertoysDetectedElevatedHelp"; | ||
const wchar_t ToastNotificationButtonUrl[] = L"powertoys://cant_drag_elevated_disable/"; | ||
} | ||
public: | ||
NotificationUtil(); | ||
~NotificationUtil(); | ||
|
||
inline void WarnIfElevationIsRequired(std::wstring title, std::wstring message, std::wstring button1, std::wstring button2) | ||
{ | ||
using namespace NonLocalizable; | ||
void WarnIfElevationIsRequired(std::wstring title, std::wstring message, std::wstring button1, std::wstring button2); | ||
|
||
auto settings = PTSettingsHelper::load_general_settings(); | ||
auto enableWarningsElevatedApps = settings.GetNamedBoolean(L"enable_warnings_elevated_apps", true); | ||
private: | ||
std::unique_ptr<FileWatcher> m_settingsFileWatcher; | ||
bool m_warningsElevatedApps; | ||
bool m_warningShown = false; | ||
|
||
static bool warning_shown = false; | ||
if (enableWarningsElevatedApps && !warning_shown && !is_toast_disabled(ElevatedDontShowAgainRegistryPath, ElevatedDisableIntervalInDays)) | ||
{ | ||
std::vector<action_t> actions = { | ||
link_button{ button1, RunAsAdminInfoPage }, | ||
link_button{ button2, ToastNotificationButtonUrl } | ||
}; | ||
show_toast_with_activations(message, | ||
title, | ||
{}, | ||
std::move(actions)); | ||
warning_shown = true; | ||
} | ||
} | ||
} | ||
void ReadSettings(); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.