diff --git a/Telegram/SourceFiles/core/update_checker.cpp b/Telegram/SourceFiles/core/update_checker.cpp index b1a181e49..4d7c2b528 100644 --- a/Telegram/SourceFiles/core/update_checker.cpp +++ b/Telegram/SourceFiles/core/update_checker.cpp @@ -31,6 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include +#include extern "C" { #include @@ -1634,16 +1635,14 @@ void UpdateApplication() { return "https://www.microsoft.com/en-us/store/p/telegram-desktop/9nztwsqntd0s"; #elif defined OS_MAC_STORE // OS_WIN_STORE return "https://itunes.apple.com/ae/app/telegram-desktop/id946399090"; -#elif defined Q_OS_UNIX && !defined Q_OS_MAC // OS_WIN_STORE || OS_MAC_STORE - if (Platform::InFlatpak()) { +#else // OS_WIN_STORE || OS_MAC_STORE + if (KSandbox::isFlatpak()) { return "https://flathub.org/apps/details/org.telegram.desktop"; - } else if (Platform::InSnap()) { + } else if (KSandbox::isSnap()) { return "https://snapcraft.io/telegram-desktop"; } return "https://desktop.telegram.org"; -#else // OS_WIN_STORE || OS_MAC_STORE || (defined Q_OS_UNIX && !defined Q_OS_MAC) - return "https://desktop.telegram.org"; -#endif // OS_WIN_STORE || OS_MAC_STORE || (defined Q_OS_UNIX && !defined Q_OS_MAC) +#endif // OS_WIN_STORE || OS_MAC_STORE }(); UrlClickHandler::Open(url); } else { diff --git a/Telegram/SourceFiles/mtproto/session_private.cpp b/Telegram/SourceFiles/mtproto/session_private.cpp index ef4156dcf..cba21d595 100644 --- a/Telegram/SourceFiles/mtproto/session_private.cpp +++ b/Telegram/SourceFiles/mtproto/session_private.cpp @@ -15,13 +15,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "mtproto/mtproto_response.h" #include "mtproto/mtproto_dc_options.h" #include "mtproto/connection_abstract.h" -#include "platform/platform_specific.h" #include "base/random.h" #include "base/qthelp_url.h" #include "base/openssl_help.h" #include "base/unixtime.h" #include "base/platform/base_platform_info.h" +#include #include namespace MTP { @@ -86,15 +86,13 @@ using namespace details; return u" Mac App Store"_q; #elif defined OS_WIN_STORE // OS_MAC_STORE return u" Microsoft Store"_q; -#elif defined Q_OS_UNIX && !defined Q_OS_MAC // OS_MAC_STORE || OS_WIN_STORE - return Platform::InFlatpak() +#else // OS_MAC_STORE || OS_WIN_STORE + return KSandbox::isFlatpak() ? u" Flatpak"_q - : Platform::InSnap() + : KSandbox::isSnap() ? u" Snap"_q : QString(); -#else // OS_MAC_STORE || OS_WIN_STORE || (defined Q_OS_UNIX && !defined Q_OS_MAC) - return QString(); -#endif // OS_MAC_STORE || OS_WIN_STORE || (defined Q_OS_UNIX && !defined Q_OS_MAC) +#endif // OS_MAC_STORE || OS_WIN_STORE })(); } diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index 2eed8df2a..80f66682f 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -36,6 +36,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include #include +#include #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION #include @@ -264,22 +265,12 @@ void SetApplicationIcon(const QIcon &icon) { QApplication::setWindowIcon(icon); } -bool InFlatpak() { - static const auto Result = QFileInfo::exists(qsl("/.flatpak-info")); - return Result; -} - -bool InSnap() { - static const auto Result = qEnvironmentVariableIsSet("SNAP"); - return Result; -} - QString AppRuntimeDirectory() { static const auto Result = [&] { auto runtimeDir = QStandardPaths::writableLocation( QStandardPaths::RuntimeLocation); - if (InFlatpak()) { + if (KSandbox::isFlatpak()) { runtimeDir += qsl("/app/") + FlatpakID(); } @@ -311,7 +302,7 @@ QString SingleInstanceLocalServerName(const QString &hash) { } QString GetIconName() { - static const auto Result = InFlatpak() + static const auto Result = KSandbox::isFlatpak() ? FlatpakID() : kIconName.utf16(); return Result; @@ -363,7 +354,7 @@ bool AutostartSupported() { // in folders with names started with a dot // and doesn't provide any api to add an app to autostart // thus, autostart isn't supported in snap - return !InSnap(); + return !KSandbox::isSnap(); } void AutostartToggle(bool enabled, Fn done) { @@ -374,7 +365,7 @@ void AutostartToggle(bool enabled, Fn done) { }); const auto silent = !done; - if (InFlatpak()) { + if (KSandbox::isFlatpak()) { #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION PortalAutostart(enabled, silent); #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.h b/Telegram/SourceFiles/platform/linux/specific_linux.h index 29b8cdccc..8ae2cb898 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.h +++ b/Telegram/SourceFiles/platform/linux/specific_linux.h @@ -15,9 +15,6 @@ class LocationPoint; namespace Platform { -bool InFlatpak(); -bool InSnap(); - QString AppRuntimeDirectory(); QString GetIconName(); diff --git a/cmake b/cmake index c79563ea3..152fc28f3 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit c79563ea343075d97d30fe3a6598775538676515 +Subproject commit 152fc28f343aff610f5f9dbdff243bbdbda85bf0