mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Beta version 3.1.6: Fix crash on old Windows 10 versions.
This commit is contained in:
parent
937c2d3dce
commit
8b7cd4a0c7
2 changed files with 24 additions and 5 deletions
|
@ -109,9 +109,13 @@ bool init() {
|
|||
|
||||
{
|
||||
using namespace Microsoft::WRL;
|
||||
Module<OutOfProc>::GetModule().RegisterObjects();
|
||||
const auto hr = Module<OutOfProc>::GetModule().RegisterObjects();
|
||||
if (!SUCCEEDED(hr)) {
|
||||
LOG(("App Error: Object registration failed."));
|
||||
}
|
||||
}
|
||||
if (!AppUserModelId::validateShortcut()) {
|
||||
LOG(("App Error: Shortcut validation failed."));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -707,8 +711,19 @@ bool Manager::Private::showNotificationInTryCatch(
|
|||
const auto string = &ToastActivation::String;
|
||||
if (const auto args = object.try_as<ToastActivatedEventArgs>()) {
|
||||
activation.args = string(args.Arguments().c_str());
|
||||
const auto reply = args.UserInput().TryLookup(L"fastReply");
|
||||
const auto data = reply.try_as<IReference<winrt::hstring>>();
|
||||
const auto args2 = args.try_as<IToastActivatedEventArgs2>();
|
||||
if (!args2 && activation.args.startsWith("action=reply&")) {
|
||||
LOG(("WinRT Error: "
|
||||
"FastReply without IToastActivatedEventArgs2 support."));
|
||||
return;
|
||||
}
|
||||
const auto input = args2 ? args2.UserInput() : nullptr;
|
||||
const auto reply = input
|
||||
? input.TryLookup(L"fastReply")
|
||||
: nullptr;
|
||||
const auto data = reply
|
||||
? reply.try_as<IReference<winrt::hstring>>()
|
||||
: nullptr;
|
||||
if (data) {
|
||||
activation.input.push_back({
|
||||
.key = u"fastReply"_q,
|
||||
|
@ -741,7 +756,7 @@ bool Manager::Private::showNotificationInTryCatch(
|
|||
}
|
||||
});
|
||||
const auto token3 = toast.Failed([=](
|
||||
const auto &sender,
|
||||
const ToastNotification &sender,
|
||||
const ToastFailedEventArgs &args) {
|
||||
performOnMainQueue([notificationId](Manager *manager) {
|
||||
manager->clearNotification(notificationId);
|
||||
|
|
|
@ -273,6 +273,7 @@ bool validateShortcutAt(const QString &path) {
|
|||
const auto bad2 = !good2 && (toastActivatorPropVar.vt != VT_EMPTY);
|
||||
PropVariantClear(&toastActivatorPropVar);
|
||||
if (good1 && good2) {
|
||||
LOG(("App Info: Shortcut validated at \"%1\"").arg(path));
|
||||
return true;
|
||||
} else if (bad1 || bad2) {
|
||||
return false;
|
||||
|
@ -300,9 +301,11 @@ bool validateShortcutAt(const QString &path) {
|
|||
if (!SUCCEEDED(hr)) return false;
|
||||
|
||||
if (persistFile->IsDirty() == S_OK) {
|
||||
persistFile->Save(p.c_str(), TRUE);
|
||||
hr = persistFile->Save(p.c_str(), TRUE);
|
||||
if (!SUCCEEDED(hr)) return false;
|
||||
}
|
||||
|
||||
LOG(("App Info: Shortcut set and validated at \"%1\"").arg(path));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -400,6 +403,7 @@ bool validateShortcut() {
|
|||
TRUE);
|
||||
if (!SUCCEEDED(hr)) return false;
|
||||
|
||||
LOG(("App Info: Shortcut created and validated at \"%1\"").arg(path));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue