diff --git a/Telegram/Resources/art/uwp/logo.png b/Telegram/Resources/art/uwp/logo.png new file mode 100644 index 0000000000..7c2cf4eb44 Binary files /dev/null and b/Telegram/Resources/art/uwp/logo.png differ diff --git a/Telegram/Resources/art/uwp/logo150.png b/Telegram/Resources/art/uwp/logo150.png new file mode 100644 index 0000000000..13b334d31f Binary files /dev/null and b/Telegram/Resources/art/uwp/logo150.png differ diff --git a/Telegram/Resources/art/uwp/logo44.png b/Telegram/Resources/art/uwp/logo44.png new file mode 100644 index 0000000000..bba602ecd6 Binary files /dev/null and b/Telegram/Resources/art/uwp/logo44.png differ diff --git a/Telegram/Resources/uwp/appxmanifest.xml b/Telegram/Resources/uwp/appxmanifest.xml new file mode 100644 index 0000000000..2bcdefb904 --- /dev/null +++ b/Telegram/Resources/uwp/appxmanifest.xml @@ -0,0 +1,35 @@ + + + + + Telegram Desktop + Reserved + No description entered + Assets\logo.png + + + + + + + + + + + + + + + + diff --git a/Telegram/Resources/uwp/mapping b/Telegram/Resources/uwp/mapping new file mode 100644 index 0000000000..52a4b0d5b0 --- /dev/null +++ b/Telegram/Resources/uwp/mapping @@ -0,0 +1,6 @@ +[Files] +"..\out\Release\Telegram.exe" "Telegram.exe" +"Resources\uwp\appxmanifest.xml" "AppxManifest.xml" +"Resources\art\uwp\logo.png" "Assets\logo.png" +"Resources\art\uwp\logo44.png" "Assets\logo44.png" +"Resources\art\uwp\logo150.png" "Assets\logo150.png" diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index 61f4579db3..4bbd03c925 100644 --- a/Telegram/Resources/winrc/Telegram.rc +++ b/Telegram/Resources/winrc/Telegram.rc @@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,5,0 - PRODUCTVERSION 1,0,5,0 + FILEVERSION 1,0,6,0 + PRODUCTVERSION 1,0,6,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -51,10 +51,10 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "Telegram Messenger LLP" - VALUE "FileVersion", "1.0.5.0" + VALUE "FileVersion", "1.0.6.0" VALUE "LegalCopyright", "Copyright (C) 2014-2017" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "1.0.5.0" + VALUE "ProductVersion", "1.0.6.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index f1cbdaba42..70ad75da7e 100644 --- a/Telegram/Resources/winrc/Updater.rc +++ b/Telegram/Resources/winrc/Updater.rc @@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,5,0 - PRODUCTVERSION 1,0,5,0 + FILEVERSION 1,0,6,0 + PRODUCTVERSION 1,0,6,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -43,10 +43,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram Messenger LLP" VALUE "FileDescription", "Telegram Updater" - VALUE "FileVersion", "1.0.5.0" + VALUE "FileVersion", "1.0.6.0" VALUE "LegalCopyright", "Copyright (C) 2014-2017" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "1.0.5.0" + VALUE "ProductVersion", "1.0.6.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index 3a8cef9fbc..1d0b95ebfa 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -24,7 +24,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #define BETA_VERSION_MACRO (0ULL) -constexpr int AppVersion = 1000005; -constexpr str_const AppVersionStr = "1.0.5"; +constexpr int AppVersion = 1000006; +constexpr str_const AppVersionStr = "1.0.6"; constexpr bool AppAlphaVersion = false; constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO; diff --git a/Telegram/SourceFiles/logs.cpp b/Telegram/SourceFiles/logs.cpp index a6c97c3fc9..da89d4a41e 100644 --- a/Telegram/SourceFiles/logs.cpp +++ b/Telegram/SourceFiles/logs.cpp @@ -331,7 +331,9 @@ namespace Logs { } else { cForceWorkingDir(psAppDataPath()); workingDirChosen = true; -#endif // Q_OS_WINRT +#elif defined OS_WIN_STORE + cForceWorkingDir(psAppDataPath()); +#endif // OS_WIN_STORE } LogsData = new LogsDataFields(); diff --git a/Telegram/SourceFiles/platform/win/audio_win.cpp b/Telegram/SourceFiles/platform/win/audio_win.cpp index babcf0e141..5b1edb6c35 100644 --- a/Telegram/SourceFiles/platform/win/audio_win.cpp +++ b/Telegram/SourceFiles/platform/win/audio_win.cpp @@ -21,6 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #include "stdafx.h" #include "platform/win/audio_win.h" +#include "platform/win/windows_dlls.h" #include "media/media_audio.h" #include @@ -73,13 +74,42 @@ STDMETHODIMP DeviceListener::QueryInterface(REFIID iid, void** object) { } STDMETHODIMP DeviceListener::OnPropertyValueChanged(LPCWSTR device_id, const PROPERTYKEY key) { - LOG(("Audio Info: OnPropertyValueChanged() scheduling detach from audio device.")); - Media::Player::DetachFromDeviceByTimer(); + auto deviceName = device_id ? '"' + QString::fromWCharArray(device_id) + '"' : QString("nullptr"); + + constexpr auto kKeyBufferSize = 1024; + WCHAR keyBuffer[kKeyBufferSize] = { 0 }; + auto hr = Dlls::PSStringFromPropertyKey(key, keyBuffer, kKeyBufferSize); + auto keyName = Dlls::PSStringFromPropertyKey ? (SUCCEEDED(hr) ? '"' + QString::fromWCharArray(keyBuffer) + '"' : QString("unknown")) : QString("unsupported"); + + // BAD GUID { 0xD4EF3098, 0xC967, 0x4A4E, { 0xB2, 0x19, 0xAC, 0xB6, 0xDA, 0x1D, 0xC3, 0x73 } }; + // BAD GUID { 0x3DE556E2, 0xE087, 0x4721, { 0xBE, 0x97, 0xEC, 0x16, 0x2D, 0x54, 0x81, 0xF8 } }; + + // VERY BAD GUID { 0x91F1336D, 0xC37C, 0x4C48, { 0xAD, 0xEB, 0x92, 0x17, 0x2F, 0xA8, 0x7E, 0xEB } }; + // It is fired somewhere from CloseAudioPlaybackDevice() causing deadlock on AudioMutex. + + // Sometimes unknown value change events come very frequently, like each 0.5 seconds. + // So we will handle only special value change events from mmdeviceapi.h + constexpr GUID pkey_AudioEndpoint = { 0x1da5d803, 0xd492, 0x4edd, { 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e } }; + constexpr GUID pkey_AudioEngine_Device = { 0xf19f064d, 0x82c, 0x4e27, { 0xbc, 0x73, 0x68, 0x82, 0xa1, 0xbb, 0x8e, 0x4c } }; + constexpr GUID pkey_AudioEngine_OEM = { 0xe4870e26, 0x3cc5, 0x4cd2, { 0xba, 0x46, 0xca, 0xa, 0x9a, 0x70, 0xed, 0x4 } }; + constexpr GUID pkey_AudioUnknown1 = { 0x3d6e1656, 0x2e50, 0x4c4c, { 0x8d, 0x85, 0xd0, 0xac, 0xae, 0x3c, 0x6c, 0x68 } }; + constexpr GUID pkey_AudioUnknown2 = { 0x624f56de, 0xfd24, 0x473e, { 0x81, 0x4a, 0xde, 0x40, 0xaa, 0xca, 0xed, 0x16 } }; + if (key.fmtid == pkey_AudioEndpoint + || key.fmtid == pkey_AudioEngine_Device + || key.fmtid == pkey_AudioEngine_OEM + || key.fmtid == pkey_AudioUnknown1 + || key.fmtid == pkey_AudioUnknown2) { + LOG(("Audio Info: OnPropertyValueChanged(%1, %2) scheduling detach from audio device.").arg(deviceName).arg(keyName)); + Media::Player::DetachFromDeviceByTimer(); + } else { + DEBUG_LOG(("Audio Info: OnPropertyValueChanged(%1, %2) unknown, skipping.").arg(deviceName).arg(keyName)); + } return S_OK; } STDMETHODIMP DeviceListener::OnDeviceStateChanged(LPCWSTR device_id, DWORD new_state) { - LOG(("Audio Info: OnDeviceStateChanged() scheduling detach from audio device.")); + auto deviceName = device_id ? '"' + QString::fromWCharArray(device_id) + '"' : QString("nullptr"); + LOG(("Audio Info: OnDeviceStateChanged(%1, %2) scheduling detach from audio device.").arg(deviceName).arg(new_state)); Media::Player::DetachFromDeviceByTimer(); return S_OK; } diff --git a/Telegram/SourceFiles/platform/win/windows_app_user_model_id.cpp b/Telegram/SourceFiles/platform/win/windows_app_user_model_id.cpp index 5db6514e46..314258283f 100644 --- a/Telegram/SourceFiles/platform/win/windows_app_user_model_id.cpp +++ b/Telegram/SourceFiles/platform/win/windows_app_user_model_id.cpp @@ -39,7 +39,11 @@ namespace { const PROPERTYKEY pkey_AppUserModel_ID = { { 0x9F4C2855, 0x9F79, 0x4B39, { 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3 } }, 5 }; const PROPERTYKEY pkey_AppUserModel_StartPinOption = { { 0x9F4C2855, 0x9F79, 0x4B39, { 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3 } }, 12 }; +#ifdef OS_WIN_STORE +const WCHAR AppUserModelIdRelease[] = L"Telegram.TelegramDesktop.Store"; +#else // OS_WIN_STORE const WCHAR AppUserModelIdRelease[] = L"Telegram.TelegramDesktop"; +#endif // OS_WIN_STORE const WCHAR AppUserModelIdBeta[] = L"Telegram.TelegramDesktop.Beta"; } // namespace diff --git a/Telegram/SourceFiles/platform/win/windows_dlls.cpp b/Telegram/SourceFiles/platform/win/windows_dlls.cpp index 3961616ce7..44e0f42594 100644 --- a/Telegram/SourceFiles/platform/win/windows_dlls.cpp +++ b/Telegram/SourceFiles/platform/win/windows_dlls.cpp @@ -55,6 +55,7 @@ f_RoGetActivationFactory RoGetActivationFactory; f_WindowsCreateStringReference WindowsCreateStringReference; f_WindowsDeleteString WindowsDeleteString; f_PropVariantToString PropVariantToString; +f_PSStringFromPropertyKey PSStringFromPropertyKey; HINSTANCE LibUxTheme; HINSTANCE LibShell32; @@ -89,6 +90,7 @@ void start() { LibPropSys = LoadLibrary(L"PROPSYS.DLL"); load(LibPropSys, "PropVariantToString", PropVariantToString); + load(LibPropSys, "PSStringFromPropertyKey", PSStringFromPropertyKey); if (version >= QSysInfo::WV_WINDOWS8) { LibComBase = LoadLibrary(L"COMBASE.DLL"); diff --git a/Telegram/SourceFiles/platform/win/windows_dlls.h b/Telegram/SourceFiles/platform/win/windows_dlls.h index b7c724e666..ae0c8b3c7a 100644 --- a/Telegram/SourceFiles/platform/win/windows_dlls.h +++ b/Telegram/SourceFiles/platform/win/windows_dlls.h @@ -82,6 +82,9 @@ extern f_WTSUnRegisterSessionNotification WTSUnRegisterSessionNotification; typedef HRESULT (FAR STDAPICALLTYPE *f_PropVariantToString)(_In_ REFPROPVARIANT propvar, _Out_writes_(cch) PWSTR psz, _In_ UINT cch); extern f_PropVariantToString PropVariantToString; +typedef HRESULT (FAR STDAPICALLTYPE *f_PSStringFromPropertyKey)(_In_ REFPROPERTYKEY pkey, _Out_writes_(cch) LPWSTR psz, _In_ UINT cch); +extern f_PSStringFromPropertyKey PSStringFromPropertyKey; + // COMBASE.DLL typedef HRESULT (FAR STDAPICALLTYPE *f_RoGetActivationFactory)(_In_ HSTRING activatableClassId, _In_ REFIID iid, _COM_Outptr_ void ** factory); @@ -93,5 +96,7 @@ extern f_WindowsCreateStringReference WindowsCreateStringReference; typedef HRESULT (FAR STDAPICALLTYPE *f_WindowsDeleteString)(_In_opt_ HSTRING string); extern f_WindowsDeleteString WindowsDeleteString; + + } // namespace Dlls } // namespace Platform diff --git a/Telegram/SourceFiles/pspecific_win.cpp b/Telegram/SourceFiles/pspecific_win.cpp index 9b7bb1d469..e0e14172a7 100644 --- a/Telegram/SourceFiles/pspecific_win.cpp +++ b/Telegram/SourceFiles/pspecific_win.cpp @@ -362,7 +362,11 @@ QString psAppDataPath() { WCHAR wstrPath[maxFileLen]; if (GetEnvironmentVariable(L"APPDATA", wstrPath, maxFileLen)) { QDir appData(QString::fromStdWString(std::wstring(wstrPath))); +#ifdef OS_WIN_STORE + return appData.absolutePath() + qsl("/Telegram Desktop UWP/"); +#else // OS_WIN_STORE return appData.absolutePath() + '/' + str_const_toString(AppName) + '/'; +#endif // OS_WIN_STORE } return QString(); } diff --git a/Telegram/build/build.bat b/Telegram/build/build.bat index 4117476c55..86d3291d1e 100644 --- a/Telegram/build/build.bat +++ b/Telegram/build/build.bat @@ -3,6 +3,14 @@ setlocal enabledelayedexpansion set "FullScriptPath=%~dp0" set "FullExecPath=%cd%" +set "BuildPlatform=%1" + +if "%BuildPlatform%" neq "uwp" ( + set "BuildUWP=0" +) else ( + set "BuildUWP=1" +) + if not exist "%FullScriptPath%..\..\..\TelegramPrivate" ( echo. echo This script is for building the production version of Telegram Desktop. @@ -31,7 +39,11 @@ if %BetaVersion% neq 0 ( ) echo. -echo Building version %AppVersionStrFull% for Windows.. +if %BuildUWP% neq 0 ( + echo Building version %AppVersionStrFull% for UWP.. +) else ( + echo Building version %AppVersionStrFull% for Windows.. +) echo. set "HomePath=%FullScriptPath%.." @@ -43,6 +55,7 @@ set "PortableFile=tportable.%AppVersionStrFull%.zip" set "ReleasePath=%HomePath%\..\out\Release" set "DeployPath=%ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStrFull%" set "SignPath=%HomePath%\..\..\TelegramPrivate\Sign.bat" +set "SignAppxPath=%HomePath%\..\..\TelegramPrivate\AppxSign.bat" set "BinaryName=Telegram" set "DropboxSymbolsPath=X:\Telegram\symbols" set "FinalReleasePath=Y:\TBuild\tother\tsetup" @@ -58,6 +71,10 @@ if not exist %FinalReleasePath% ( ) if %BetaVersion% neq 0 ( + if %BuildUWP% neq 0 ( + echo Can not build UWP version from a closed beta! + exit /b 1 + ) if exist %DeployPath%\ ( echo Deploy folder for version %AppVersionStr% already exists! exit /b 1 @@ -67,25 +84,47 @@ if %BetaVersion% neq 0 ( exit /b 1 ) ) else ( - if exist %ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStr%.alpha\ ( - echo Deploy folder for version %AppVersionStr%.alpha already exists! - exit /b 1 - ) - if exist %ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStr%.dev\ ( - echo Deploy folder for version %AppVersionStr%.dev already exists! - exit /b 1 - ) - if exist %ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStr%\ ( - echo Deploy folder for version %AppVersionStr% already exists! - exit /b 1 - ) - if exist %ReleasePath%\tupdate%AppVersion% ( - echo Update file for version %AppVersion% already exists! - exit /b 1 + if %BuildUWP% neq 0 ( + if "%AlphaBetaParam%" neq "" ( + echo Can not build UWP version from an alpha! + exit /b 1 + ) + if exist %ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStr%\uwp\ ( + echo UWP deploy folder for version %AppVersionStr% already exists! + exit /b 1 + ) + if not exist %ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStr%\ ( + echo Deploy folder for version %AppVersionStr% does not exist! + exit /b 1 + ) + ) else ( + if exist %ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStr%.alpha\ ( + echo Deploy folder for version %AppVersionStr%.alpha already exists! + exit /b 1 + ) + if exist %ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStr%.dev\ ( + echo Deploy folder for version %AppVersionStr%.dev already exists! + exit /b 1 + ) + if exist %ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStr%\ ( + echo Deploy folder for version %AppVersionStr% already exists! + exit /b 1 + ) + if exist %ReleasePath%\tupdate%AppVersion% ( + echo Update file for version %AppVersion% already exists! + exit /b 1 + ) ) ) cd "%HomePath%" + +if %BuildUWP% neq 0 ( + echo uwp > build\target +) else ( + echo win > build\target +) + call gyp\refresh.bat if %errorlevel% neq 0 goto error @@ -93,9 +132,9 @@ cd "%SolutionPath%" call ninja -C out/Release Telegram if %errorlevel% neq 0 goto error -echo . +echo. echo Version %AppVersionStrFull% build successfull. Preparing.. -echo . +echo. echo Dumping debug symbols.. xcopy "%ReleasePath%\%BinaryName%.exe" "%ReleasePath%\%BinaryName%.exe.exe*" @@ -109,43 +148,52 @@ cd "%ReleasePath%" call "%SignPath%" "%BinaryName%.exe" if %errorlevel% neq 0 goto error -call "%SignPath%" "Updater.exe" -if %errorlevel% neq 0 goto error +if %BuildUWP% neq 0 ( + cd "%HomePath%" -if %BetaVersion% equ 0 ( - iscc /dMyAppVersion=%AppVersionStrSmall% /dMyAppVersionZero=%AppVersionStr% /dMyAppVersionFull=%AppVersionStrFull% "/dReleasePath=%ReleasePath%" "%FullScriptPath%setup.iss" + MakeAppx.exe pack /f Resources\uwp\mapping /p ..\out\Release\%BinaryName%.appx if %errorlevel% neq 0 goto error - if not exist "tsetup.%AppVersionStrFull%.exe" goto error - call "%SignPath%" "tsetup.%AppVersionStrFull%.exe" + call "%SignAppxPath%" "..\out\Release\%BinaryName%.appx" +) else ( + call "%SignPath%" "Updater.exe" if %errorlevel% neq 0 goto error -) -call Packer.exe -version %VersionForPacker% -path %BinaryName%.exe -path Updater.exe %AlphaBetaParam% -if %errorlevel% neq 0 goto error + if %BetaVersion% equ 0 ( + iscc /dMyAppVersion=%AppVersionStrSmall% /dMyAppVersionZero=%AppVersionStr% /dMyAppVersionFull=%AppVersionStrFull% "/dReleasePath=%ReleasePath%" "%FullScriptPath%setup.iss" + if %errorlevel% neq 0 goto error + if not exist "tsetup.%AppVersionStrFull%.exe" goto error -if %BetaVersion% neq 0 ( - if not exist "%ReleasePath%\%BetaKeyFile%" ( - echo Beta version key file not found! - exit /b 1 + call "%SignPath%" "tsetup.%AppVersionStrFull%.exe" + if %errorlevel% neq 0 goto error ) - FOR /F "tokens=1* delims= " %%i in (%ReleasePath%\%BetaKeyFile%) do set "BetaSignature=%%i" -) -if %errorlevel% neq 0 goto error + call Packer.exe -version %VersionForPacker% -path %BinaryName%.exe -path Updater.exe %AlphaBetaParam% + if %errorlevel% neq 0 goto error -if %BetaVersion% neq 0 ( - set "UpdateFile=%UpdateFile%_%BetaSignature%" - set "PortableFile=tbeta%BetaVersion%_%BetaSignature%.zip" + if %BetaVersion% neq 0 ( + if not exist "%ReleasePath%\%BetaKeyFile%" ( + echo Beta version key file not found! + exit /b 1 + ) + + FOR /F "tokens=1* delims= " %%i in (%ReleasePath%\%BetaKeyFile%) do set "BetaSignature=%%i" + ) + if %errorlevel% neq 0 goto error + + if %BetaVersion% neq 0 ( + set "UpdateFile=%UpdateFile%_%BetaSignature%" + set "PortableFile=tbeta%BetaVersion%_%BetaSignature%.zip" + ) ) for /f ^"usebackq^ eol^=^ ^ delims^=^" %%a in (%ReleasePath%\%BinaryName%.exe.sym) do ( - set "SymbolsHashLine=%%a" - goto symbolslinedone -) -:symbolslinedone + set "SymbolsHashLine=%%a" + goto symbolslinedone + ) + :symbolslinedone FOR /F "tokens=1,2,3,4* delims= " %%i in ("%SymbolsHashLine%") do set "SymbolsHash=%%l" echo Copying %BinaryName%.exe.sym to %DropboxSymbolsPath%\%BinaryName%.exe.pdb\%SymbolsHash% @@ -154,61 +202,71 @@ if not exist %DropboxSymbolsPath%\%BinaryName%.exe.pdb\%SymbolsHash% mkdir %Drop move "%ReleasePath%\%BinaryName%.exe.sym" %DropboxSymbolsPath%\%BinaryName%.exe.pdb\%SymbolsHash%\ echo Done! -if not exist "%ReleasePath%\deploy" mkdir "%ReleasePath%\deploy" -if not exist "%ReleasePath%\deploy\%AppVersionStrMajor%" mkdir "%ReleasePath%\deploy\%AppVersionStrMajor%" -mkdir "%DeployPath%" -mkdir "%DeployPath%\%BinaryName%" -if %errorlevel% neq 0 goto error - -move "%ReleasePath%\%BinaryName%.exe" "%DeployPath%\%BinaryName%\" -move "%ReleasePath%\Updater.exe" "%DeployPath%\" -xcopy "%ReleasePath%\%BinaryName%.pdb" "%DeployPath%\" -xcopy "%ReleasePath%\Updater.pdb" "%DeployPath%\" -move "%ReleasePath%\%BinaryName%.exe.pdb" "%DeployPath%\" -move "%ReleasePath%\Updater.exe.pdb" "%DeployPath%\" -if %BetaVersion% equ 0 ( - move "%ReleasePath%\%SetupFile%" "%DeployPath%\" +if %BuildUWP% neq 0 ( + mkdir "%DeployPath%\uwp" + move "%ReleasePath%\%BinaryName%.exe" "%DeployPath%\uwp\" + xcopy "%ReleasePath%\%BinaryName%.pdb" "%DeployPath%\uwp\" + move "%ReleasePath%\%BinaryName%.exe.pdb" "%DeployPath%\uwp\" + move "%ReleasePath%\Telegram.appx" "%DeployPath%\uwp\" ) else ( - move "%ReleasePath%\%BetaKeyFile%" "%DeployPath%\" + if not exist "%ReleasePath%\deploy" mkdir "%ReleasePath%\deploy" + if not exist "%ReleasePath%\deploy\%AppVersionStrMajor%" mkdir "%ReleasePath%\deploy\%AppVersionStrMajor%" + mkdir "%DeployPath%" + mkdir "%DeployPath%\%BinaryName%" + if %errorlevel% neq 0 goto error + + move "%ReleasePath%\%BinaryName%.exe" "%DeployPath%\%BinaryName%\" + move "%ReleasePath%\Updater.exe" "%DeployPath%\" + xcopy "%ReleasePath%\%BinaryName%.pdb" "%DeployPath%\" + xcopy "%ReleasePath%\Updater.pdb" "%DeployPath%\" + move "%ReleasePath%\%BinaryName%.exe.pdb" "%DeployPath%\" + move "%ReleasePath%\Updater.exe.pdb" "%DeployPath%\" + if %BetaVersion% equ 0 ( + move "%ReleasePath%\%SetupFile%" "%DeployPath%\" + ) else ( + move "%ReleasePath%\%BetaKeyFile%" "%DeployPath%\" + ) + move "%ReleasePath%\%UpdateFile%" "%DeployPath%\" + if %errorlevel% neq 0 goto error + + cd "%DeployPath%" + 7z a -mx9 %PortableFile% %BinaryName%\ + if %errorlevel% neq 0 goto error ) -move "%ReleasePath%\%UpdateFile%" "%DeployPath%\" -if %errorlevel% neq 0 goto error -cd "%DeployPath%" -7z a -mx9 %PortableFile% %BinaryName%\ -if %errorlevel% neq 0 goto error +if %BuildUWP% equ 0 ( + echo. + echo Version %AppVersionStrFull% is ready for deploy! + echo. -echo . -echo Version %AppVersionStrFull% is ready for deploy! -echo . + set "FinalDeployPath=%FinalReleasePath%\%AppVersionStrMajor%\%AppVersionStrFull%" -set "FinalDeployPath=%FinalReleasePath%\%AppVersionStrMajor%\%AppVersionStrFull%" + if not exist "%DeployPath%\%UpdateFile%" goto error + if not exist "%DeployPath%\%PortableFile%" goto error + if %BetaVersion% equ 0 ( + if not exist "%DeployPath%\%SetupFile%" goto error + ) + if not exist "%DeployPath%\%BinaryName%.pdb" goto error + if not exist "%DeployPath%\%BinaryName%.exe.pdb" goto error + if not exist "%DeployPath%\Updater.exe" goto error + if not exist "%DeployPath%\Updater.pdb" goto error + if not exist "%DeployPath%\Updater.exe.pdb" goto error + if not exist "%FinalReleasePath%\%AppVersionStrMajor%" mkdir "%FinalReleasePath%\%AppVersionStrMajor%" + if not exist "%FinalDeployPath%" mkdir "%FinalDeployPath%" -if not exist "%DeployPath%\%UpdateFile%" goto error -if not exist "%DeployPath%\%PortableFile%" goto error -if %BetaVersion% equ 0 ( - if not exist "%DeployPath%\%SetupFile%" goto error + xcopy "%DeployPath%\%UpdateFile%" "%FinalDeployPath%\" + xcopy "%DeployPath%\%PortableFile%" "%FinalDeployPath%\" + if %BetaVersion% equ 0 ( + xcopy "%DeployPath%\%SetupFile%" "%FinalDeployPath%\" + ) else ( + xcopy "%DeployPath%\%BetaKeyFile%" "%FinalDeployPath%\" /Y + ) + xcopy "%DeployPath%\%BinaryName%.pdb" "%FinalDeployPath%\" + xcopy "%DeployPath%\%BinaryName%.exe.pdb" "%FinalDeployPath%\" + xcopy "%DeployPath%\Updater.exe" "%FinalDeployPath%\" + xcopy "%DeployPath%\Updater.pdb" "%FinalDeployPath%\" + xcopy "%DeployPath%\Updater.exe.pdb" "%FinalDeployPath%\" ) -if not exist "%DeployPath%\%BinaryName%.pdb" goto error -if not exist "%DeployPath%\%BinaryName%.exe.pdb" goto error -if not exist "%DeployPath%\Updater.exe" goto error -if not exist "%DeployPath%\Updater.pdb" goto error -if not exist "%DeployPath%\Updater.exe.pdb" goto error -if not exist "%FinalReleasePath%\%AppVersionStrMajor%" mkdir "%FinalReleasePath%\%AppVersionStrMajor%" -if not exist "%FinalDeployPath%" mkdir "%FinalDeployPath%" - -xcopy "%DeployPath%\%UpdateFile%" "%FinalDeployPath%\" -xcopy "%DeployPath%\%PortableFile%" "%FinalDeployPath%\" -if %BetaVersion% equ 0 ( - xcopy "%DeployPath%\%SetupFile%" "%FinalDeployPath%\" -) else ( - xcopy "%DeployPath%\%BetaKeyFile%" "%FinalDeployPath%\" /Y -) -xcopy "%DeployPath%\%BinaryName%.pdb" "%FinalDeployPath%\" -xcopy "%DeployPath%\%BinaryName%.exe.pdb" "%FinalDeployPath%\" -xcopy "%DeployPath%\Updater.exe" "%FinalDeployPath%\" -xcopy "%DeployPath%\Updater.pdb" "%FinalDeployPath%\" -xcopy "%DeployPath%\Updater.exe.pdb" "%FinalDeployPath%\" echo Version %AppVersionStrFull% is ready! diff --git a/Telegram/build/set_version.bat b/Telegram/build/set_version.bat index 06ec7b0207..c508a42bef 100644 --- a/Telegram/build/set_version.bat +++ b/Telegram/build/set_version.bat @@ -103,6 +103,10 @@ call :repl "Replace=(PRODUCTVERSION) (\s*)\d+,\d+,\d+,\d+/$1$2 %VersionMajor%,%V call :repl "Replace=("FileVersion",) (\s*)"\d+.\d+.\d+.\d+"/$1$2 "%VersionMajor%.%VersionMinor%.%VersionPatch%.%VersionBeta%"" "Filename=%ResourcePath%" || goto :error call :repl "Replace=("ProductVersion",) (\s*)"\d+.\d+.\d+.\d+"/$1$2 "%VersionMajor%.%VersionMinor%.%VersionPatch%.%VersionBeta%"" "Filename=%ResourcePath%" || goto :error +echo Patching appxmanifest.xml... +set "ResourcePath=%FullScriptPath%..\Resources\uwp\appxmanifest.xml" +call :repl "Replace=(Version=)"\d+.\d+.\d+.\d+"/$1"%VersionMajor%.%VersionMinor%.%VersionPatch%.%VersionBeta%"" "Filename=%ResourcePath%" || goto :error + exit /b :error diff --git a/Telegram/build/version b/Telegram/build/version index c6e2ab595e..cdafbd7aaf 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,6 +1,6 @@ -AppVersion 1000005 +AppVersion 1000006 AppVersionStrMajor 1.0 -AppVersionStrSmall 1.0.5 -AppVersionStr 1.0.5 +AppVersionStrSmall 1.0.6 +AppVersionStr 1.0.6 AlphaChannel 0 BetaVersion 0 diff --git a/Telegram/gyp/common.gypi b/Telegram/gyp/common.gypi index a050623b60..ca73a899c0 100644 --- a/Telegram/gyp/common.gypi +++ b/Telegram/gyp/common.gypi @@ -92,6 +92,11 @@ }, { 'build_macstore': 0, }], + [ '"<(official_build_target)" == "uwp"', { + 'build_uwp': 1, + }, { + 'build_uwp': 0, + }], ], 'ld_lib_prefix': '<(ld_lib_prefix)', 'ld_lib_postfix': '<(ld_lib_postfix)', diff --git a/Telegram/gyp/settings_linux.gypi b/Telegram/gyp/settings_linux.gypi index 3356b979c2..79eacfcb5a 100644 --- a/Telegram/gyp/settings_linux.gypi +++ b/Telegram/gyp/settings_linux.gypi @@ -44,7 +44,7 @@ ], 'conditions': [ [ '"<(official_build_target)" != "" and "<(official_build_target)" != "linux"', { - 'sources': [ '__Wrong_Official_Build_Target__' ], + 'sources': [ '__Wrong_Official_Build_Target_<(official_build_target)_' ], }], ], }, { diff --git a/Telegram/gyp/settings_win.gypi b/Telegram/gyp/settings_win.gypi index 1d9f7b3b48..5d5cca9f5d 100644 --- a/Telegram/gyp/settings_win.gypi +++ b/Telegram/gyp/settings_win.gypi @@ -109,7 +109,7 @@ }, }, 'conditions': [ - [ '"<(official_build_target)" != "" and "<(official_build_target)" != "win"', { + [ '"<(official_build_target)" != "" and "<(official_build_target)" != "win" and "<(official_build_target)" != "uwp"', { 'sources': [ '__Wrong_Official_Build_Target__' ], }], ], diff --git a/Telegram/gyp/telegram_win.gypi b/Telegram/gyp/telegram_win.gypi index ce23aa2e6d..3009a840aa 100644 --- a/Telegram/gyp/telegram_win.gypi +++ b/Telegram/gyp/telegram_win.gypi @@ -88,5 +88,10 @@ ], }, }, + }], [ 'build_uwp', { + 'defines': [ + 'TDESKTOP_DISABLE_AUTOUPDATE', + 'OS_WIN_STORE', + ] }]], }