diff --git a/.appveyor/install.bat b/.appveyor/install.bat deleted file mode 100644 index 420667e0a..000000000 --- a/.appveyor/install.bat +++ /dev/null @@ -1,86 +0,0 @@ -@echo off - -IF "%BUILD_DIR%"=="" SET BUILD_DIR=C:\TBuild -SET LIB_DIR=%BUILD_DIR%\Libraries -SET SRC_DIR=%BUILD_DIR%\tdesktop -SET QT_VERSION=5_6_2 - -call:configureBuild -call:getDependencies -call:setupGYP -cd %SRC_DIR% - -echo Finished! - -GOTO:EOF - -:: FUNCTIONS -:logInfo - echo [INFO] %~1 -GOTO:EOF - -:logError - echo [ERROR] %~1 -GOTO:EOF - -:getDependencies - call:logInfo "Clone dependencies repository" - git clone -q --depth 1 --branch master https://github.com/telegramdesktop/dependencies_windows.git %LIB_DIR% - cd %LIB_DIR% - - git clone --depth 1 --branch 0.9.1 https://github.com/ericniebler/range-v3 - - if exist prepare.bat ( - call prepare.bat - ) else ( - call:logError "Error cloning dependencies, trying again" - rmdir %LIB_DIR% /S /Q - call:getDependencies - ) -GOTO:EOF - -:setupGYP - call:logInfo "Setup GYP/Ninja and generate VS solution" - cd %LIB_DIR% - git clone https://github.com/telegramdesktop/gyp.git - cd gyp - git checkout tdesktop - SET PATH=%PATH%;%BUILD_DIR%\Libraries\gyp;%BUILD_DIR%\Libraries\ninja; - cd %SRC_DIR% - git submodule init - git submodule update - cd %SRC_DIR%\Telegram - call gyp\refresh.bat --api-id 17349 --api-hash 344583e45741c457fe1862106095a5eb --ci-build - GOTO:EOF - -:configureBuild - call:logInfo "Configuring build" - call:logInfo "Build version: %BUILD_VERSION%" - set TDESKTOP_BUILD_DEFINES= - - echo %BUILD_VERSION% | findstr /C:"disable_register_custom_scheme">nul && ( - set TDESKTOP_BUILD_DEFINES=%TDESKTOP_BUILD_DEFINES%,TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME - ) - - echo %BUILD_VERSION% | findstr /C:"disable_crash_reports">nul && ( - set TDESKTOP_BUILD_DEFINES=%TDESKTOP_BUILD_DEFINES%,DESKTOP_APP_DISABLE_CRASH_REPORTS - ) - - echo %BUILD_VERSION% | findstr /C:"disable_network_proxy">nul && ( - set TDESKTOP_BUILD_DEFINES=%TDESKTOP_BUILD_DEFINES%,TDESKTOP_DISABLE_NETWORK_PROXY - ) - - echo %BUILD_VERSION% | findstr /C:"disable_desktop_file_generation">nul && ( - set TDESKTOP_BUILD_DEFINES=%TDESKTOP_BUILD_DEFINES%,TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION - ) - - echo %BUILD_VERSION% | findstr /C:"disable_gtk_integration">nul && ( - set TDESKTOP_BUILD_DEFINES=%TDESKTOP_BUILD_DEFINES%,TDESKTOP_DISABLE_GTK_INTEGRATION - ) - - if not "%TDESKTOP_BUILD_DEFINES%" == "" ( - set "TDESKTOP_BUILD_DEFINES=%TDESKTOP_BUILD_DEFINES:~1%" - ) - - call:logInfo "Build Defines: %TDESKTOP_BUILD_DEFINES%" -GOTO:EOF diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.md b/.github/ISSUE_TEMPLATE/BUG_REPORT.md index cb33b88a7..ad45b57c1 100644 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.md +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.md @@ -8,7 +8,7 @@ about: Report errors or unexpected behavior. Thanks for reporting issues of Telegram Desktop! To make it easier for us to help you please enter detailed information below. ---> +--> ### Steps to reproduce 1. 2. diff --git a/.github/workflows/issue_closer.yml b/.github/workflows/issue_closer.yml new file mode 100644 index 000000000..4ad34baa7 --- /dev/null +++ b/.github/workflows/issue_closer.yml @@ -0,0 +1,103 @@ +name: Issue closer. + +on: + issues: + types: opened + +jobs: + comment: + runs-on: ubuntu-latest + steps: + - name: Get the latest version. + run: | + tag=$(git ls-remote --tags git://github.com/$GITHUB_REPOSITORY | cut -f 2 | tail -n1) + echo $tag + echo ::set-env name=LATEST_TAG::$tag + + - name: Check a version from an issue. + uses: actions/github-script@0.4.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + let errorStr = "Version not found."; + + let item1 = "Version of Telegram Desktop"; + let item2 = "Used theme"; + let body = context.payload.issue.body; + + console.log("Body of issue:\n" + body); + let index1 = body.indexOf(item1) + item1.length; + let index2 = body.indexOf(item2); + index2 = (index2 == -1) ? Number.MAX_SAFE_INTEGER : index2; + + console.log("Index 1: " + index1); + console.log("Index 2: " + index2); + + if (index1 == -1) { + console.log(errorStr); + return; + } + + function parseVersion(str) { + let pattern = /[0-9]\.[0-9][0-9.]{0,}/g; + return str.match(pattern); + } + function firstNum(version) { + return version[0].split(".")[0]; + } + + let issueVer = parseVersion(body.substring(index1, index2)); + + if (issueVer == undefined) { + console.log(errorStr); + return; + } + console.log("Version from issue: " + issueVer[0]); + + let latestVer = parseVersion(process.env.LATEST_TAG); + + if (latestVer == undefined) { + console.log(errorStr); + return; + } + console.log("Version from tags: " + latestVer[0]); + + let issueNum = firstNum(issueVer); + let latestNum = firstNum(latestVer); + + if (issueNum <= latestNum && issueNum < 5) { + console.log("Seems the version of this issue is fine!"); + return; + } + + let message = ` + Sorry, but according to the version you specify in this issue, \ + you are using the [Telegram for macOS](https://macos.telegram.org), \ + not the [Telegram Desktop](https://desktop.telegram.org). + You can report your issue to [the group](https://t.me/macswift) \ + or to [the repository of Telegram for macOS](https://github.com/overtake/TelegramSwift). + + If I made a mistake and closed your issue wrongly, please reopen it. Thanks! + `; + + let params = { + owner: context.issue.owner, + repo: context.issue.repo, + issue_number: context.issue.number + }; + + github.issues.createComment({ + ...params, + body: message + }); + + github.issues.addLabels({ + ...params, + labels: ['TG macOS Swift'] + }); + + github.issues.update({ + ...params, + state: 'closed' + }); + diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index ebfb141e6..3550b814f 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -102,7 +102,7 @@ jobs: git clone $GIT/desktop-app/zlib.git cd zlib - CFLAGS="$MIN_MAC $UNGUARDED" LDFLAGS="$MIN_MAC" ./configure + CFLAGS="$MIN_MAC $UNGUARDED" LDFLAGS="$MIN_MAC" ./configure --prefix=$PREFIX make -j$(nproc) sudo make install @@ -429,4 +429,4 @@ jobs: name: Upload artifact. with: name: Telegram - path: $REPO_NAME\out\Debug\artifact\ \ No newline at end of file + path: ${{ env.REPO_NAME }}/out/Debug/artifact/ diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml index 46b83e924..702a3651f 100644 --- a/.github/workflows/win.yml +++ b/.github/workflows/win.yml @@ -23,7 +23,6 @@ jobs: env: SDK: "10.0.18362.0" VC: "call vcvars32.bat && cd Libraries" - PY2: 'C:\hostedtoolcache\windows\Python\2.7.16\x64' GIT: "https://github.com" QT: "5_12_5" OPENSSL_VER: "1_1_1" @@ -186,6 +185,16 @@ jobs: run: | cd %LibrariesPath% + echo Find any version of Python 2. + for /D %%a in (C:\hostedtoolcache\windows\Python\2.*) do ( + SET PY2=%%a\x64 + ) + IF [%PY2%] == [] ( + echo Python 2 is not found. + exit 1 + ) + echo Found %PY2%. + git clone %GIT%/telegramdesktop/gyp.git cd gyp SET PATH=%PY2%;%cd%;%PATH% diff --git a/.gitmodules b/.gitmodules index f206a48c7..e3544453a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -28,9 +28,6 @@ [submodule "Telegram/lib_base"] path = Telegram/lib_base url = https://github.com/desktop-app/lib_base.git -[submodule "Telegram/gyp/helpers"] - path = Telegram/gyp/helpers - url = https://github.com/desktop-app/gyp_helpers.git [submodule "Telegram/codegen"] path = Telegram/codegen url = https://github.com/desktop-app/codegen.git diff --git a/.travis/build.sh b/.travis/build.sh index 6033b51d3..7b9fd4df2 100755 --- a/.travis/build.sh +++ b/.travis/build.sh @@ -224,7 +224,7 @@ buildRange() { rm -rf * cd "$EXTERNAL" - git clone --depth 1 --branch 0.9.1 https://github.com/ericniebler/range-v3 + git clone --depth 1 --branch 0.10.0 https://github.com/ericniebler/range-v3 cd "$EXTERNAL/range-v3" cp -r * "$RANGE_PATH/" diff --git a/.travis/common.sh b/.travis/common.sh index d9061ab51..6a79baba0 100755 --- a/.travis/common.sh +++ b/.travis/common.sh @@ -43,7 +43,7 @@ travisStartFold() { fi echo "travis_fold:start:$NAME" - sameLineInfoMessage "$TITLE" + sameLineInfoMessage "$TITLE" TRAVIS_LAST_FOLD="$NAME" } diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 47f124a01..f950426b4 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -524,6 +524,10 @@ PRIVATE info/media/info_media_widget.h info/members/info_members_widget.cpp info/members/info_members_widget.h + info/polls/info_polls_results_inner_widget.cpp + info/polls/info_polls_results_inner_widget.h + info/polls/info_polls_results_widget.cpp + info/polls/info_polls_results_widget.h info/profile/info_profile_actions.cpp info/profile/info_profile_actions.h info/profile/info_profile_cover.cpp @@ -1096,7 +1100,11 @@ elseif (build_osx) else() set(bundle_identifier "com.tdesktop.Telegram$<$:Debug>") set(bundle_entitlements "Telegram.entitlements") - set(output_name "Telegram") + if (LINUX AND DESKTOP_APP_USE_PACKAGED) + set(output_name "telegram-desktop") + else() + set(output_name "Telegram") + endif() endif() set_target_properties(Telegram PROPERTIES @@ -1193,3 +1201,17 @@ if ((NOT disable_autoupdate OR NOT LINUX) AND NOT build_macstore AND NOT build_w set_target_properties(Packer PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${output_folder}) endif() endif() + +if (LINUX AND DESKTOP_APP_USE_PACKAGED) + include(GNUInstallDirs) + install(TARGETS Telegram RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}") + install(FILES "Resources/art/icon16.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/16x16/apps" RENAME "telegram.png") + install(FILES "Resources/art/icon32.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/32x32/apps" RENAME "telegram.png") + install(FILES "Resources/art/icon48.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/48x48/apps" RENAME "telegram.png") + install(FILES "Resources/art/icon64.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/64x64/apps" RENAME "telegram.png") + install(FILES "Resources/art/icon128.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps" RENAME "telegram.png") + install(FILES "Resources/art/icon256.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/256x256/apps" RENAME "telegram.png") + install(FILES "Resources/art/icon512.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/512x512/apps" RENAME "telegram.png") + install(FILES "../lib/xdg/telegramdesktop.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications" RENAME "${TDESKTOP_LAUNCHER_BASENAME}.desktop") + install(FILES "../lib/xdg/telegramdesktop.appdata.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo" RENAME "${TDESKTOP_LAUNCHER_BASENAME}.appdata.xml") +endif() diff --git a/Telegram/Resources/icons/poll_choice_right.png b/Telegram/Resources/icons/poll_choice_right.png new file mode 100644 index 000000000..ebc2c9e9e Binary files /dev/null and b/Telegram/Resources/icons/poll_choice_right.png differ diff --git a/Telegram/Resources/icons/poll_choice_right@2x.png b/Telegram/Resources/icons/poll_choice_right@2x.png new file mode 100644 index 000000000..7907a5afe Binary files /dev/null and b/Telegram/Resources/icons/poll_choice_right@2x.png differ diff --git a/Telegram/Resources/icons/poll_choice_right@3x.png b/Telegram/Resources/icons/poll_choice_right@3x.png new file mode 100644 index 000000000..706c70780 Binary files /dev/null and b/Telegram/Resources/icons/poll_choice_right@3x.png differ diff --git a/Telegram/Resources/icons/poll_choice_wrong.png b/Telegram/Resources/icons/poll_choice_wrong.png new file mode 100644 index 000000000..afb504540 Binary files /dev/null and b/Telegram/Resources/icons/poll_choice_wrong.png differ diff --git a/Telegram/Resources/icons/poll_choice_wrong@2x.png b/Telegram/Resources/icons/poll_choice_wrong@2x.png new file mode 100644 index 000000000..c59a6e91f Binary files /dev/null and b/Telegram/Resources/icons/poll_choice_wrong@2x.png differ diff --git a/Telegram/Resources/icons/poll_choice_wrong@3x.png b/Telegram/Resources/icons/poll_choice_wrong@3x.png new file mode 100644 index 000000000..2caf9a23e Binary files /dev/null and b/Telegram/Resources/icons/poll_choice_wrong@3x.png differ diff --git a/Telegram/Resources/icons/poll_select_check.png b/Telegram/Resources/icons/poll_select_check.png new file mode 100644 index 000000000..535ef0917 Binary files /dev/null and b/Telegram/Resources/icons/poll_select_check.png differ diff --git a/Telegram/Resources/icons/poll_select_check@2x.png b/Telegram/Resources/icons/poll_select_check@2x.png new file mode 100644 index 000000000..f3ddc5122 Binary files /dev/null and b/Telegram/Resources/icons/poll_select_check@2x.png differ diff --git a/Telegram/Resources/icons/poll_select_check@3x.png b/Telegram/Resources/icons/poll_select_check@3x.png new file mode 100644 index 000000000..3429c939b Binary files /dev/null and b/Telegram/Resources/icons/poll_select_check@3x.png differ diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 56ad08e72..34a13bc57 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -158,6 +158,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_deleted_message" = "Deleted message"; "lng_pinned_message" = "Pinned message"; "lng_pinned_poll" = "Pinned poll"; +"lng_pinned_quiz" = "Pinned quiz"; "lng_pinned_unpin_sure" = "Would you like to unpin this message?"; "lng_pinned_pin_sure" = "Would you like to pin this message?"; "lng_pinned_pin" = "Pin"; @@ -1294,6 +1295,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_scheduled_messages" = "Scheduled Messages"; "lng_reminder_messages" = "Reminders"; +"lng_scheduled_date" = "Scheduled for {date}"; +"lng_scheduled_date_until_online" = "Scheduled until online"; +"lng_scheduled_send_until_online" = "Send when online"; "lng_scheduled_send_now" = "Send message now?"; "lng_scheduled_send_now_many#one" = "Send {count} message now?"; "lng_scheduled_send_now_many#other" = "Send {count} messages now?"; @@ -1453,6 +1457,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_send_album" = "Send as an album"; "lng_send_photo" = "Send as a photo"; "lng_send_file" = "Send as a file"; +"lng_send_media_invalid_files" = "Sorry, no valid files found."; "lng_forward_choose" = "Choose recipient..."; "lng_forward_cant" = "Sorry, no way to forward here :("; @@ -1797,6 +1802,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_restricted_send_inline_all" = "Posting inline content isn't allowed in this group."; "lng_restricted_send_polls_all" = "Posting polls isn't allowed in this group."; +"lng_restricted_send_public_polls" = "Sorry, public polls can't be forwarded to channels."; + "lng_exceptions_list_title" = "Exceptions"; "lng_removed_list_title" = "Removed users"; @@ -2166,10 +2173,18 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_launch_exe_dont_ask" = "Don't ask me again"; "lng_polls_anonymous" = "Anonymous Poll"; +"lng_polls_public" = "Poll"; +"lng_polls_anonymous_quiz" = "Anonymous Quiz"; +"lng_polls_public_quiz" = "Quiz"; "lng_polls_closed" = "Final results"; "lng_polls_votes_count#one" = "{count} vote"; "lng_polls_votes_count#other" = "{count} votes"; "lng_polls_votes_none" = "No votes"; +"lng_polls_answers_count#one" = "{count} answer"; +"lng_polls_answers_count#other" = "{count} answers"; +"lng_polls_answers_none" = "No answers"; +"lng_polls_submit_votes" = "Vote"; +"lng_polls_view_results" = "View results"; "lng_polls_retract" = "Retract vote"; "lng_polls_stop" = "Stop poll"; "lng_polls_stop_warning" = "If you stop this poll now, nobody will be able to vote in it anymore. This action cannot be undone."; @@ -2183,8 +2198,19 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_polls_create_limit#one" = "You can add {count} more option."; "lng_polls_create_limit#other" = "You can add {count} more options."; "lng_polls_create_maximum" = "You have added the maximum number of options."; +"lng_polls_create_settings" = "Settings"; +"lng_polls_create_hint" = "Tap to select the right option"; +"lng_polls_create_anonymous" = "Anonymous Votes"; +"lng_polls_create_multiple_choice" = "Multiple Answers"; +"lng_polls_create_quiz_mode" = "Quiz Mode"; "lng_polls_create_button" = "Create"; +"lng_polls_poll_results_title" = "Poll results"; +"lng_polls_quiz_results_title" = "Quiz results"; +"lng_polls_show_more#one" = "Show more ({count})"; +"lng_polls_show_more#other" = "Show more ({count})"; +"lng_polls_votes_collapse" = "Collapse"; + "lng_outdated_title" = "PLEASE UPDATE YOUR OPERATING SYSTEM."; "lng_outdated_soon" = "Otherwise, Telegram Desktop will stop updating on {date}."; "lng_outdated_now" = "So that Telegram Desktop can update to newer versions."; diff --git a/Telegram/Resources/tl/api.tl b/Telegram/Resources/tl/api.tl index 982f05af7..a7cddc5c3 100644 --- a/Telegram/Resources/tl/api.tl +++ b/Telegram/Resources/tl/api.tl @@ -71,7 +71,7 @@ inputMediaDocumentExternal#fb52dc99 flags:# url:string ttl_seconds:flags.0?int = inputMediaGame#d33f43f3 id:InputGame = InputMedia; inputMediaInvoice#f4e096c3 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:string = InputMedia; inputMediaGeoLive#ce4e82fd flags:# stopped:flags.0?true geo_point:InputGeoPoint period:flags.1?int = InputMedia; -inputMediaPoll#6b3765b poll:Poll = InputMedia; +inputMediaPoll#abe9ca25 flags:# poll:Poll correct_answers:flags.0?Vector = InputMedia; inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto; @@ -351,6 +351,7 @@ updateDeleteScheduledMessages#90866cee peer:Peer messages:Vector = Update; updateTheme#8216fba3 theme:Theme = Update; updateGeoLiveViewed#871fb939 peer:Peer msg_id:int = Update; updateLoginToken#564fe691 = Update; +updateMessagePollVote#42f88f2c poll_id:long user_id:int options:Vector = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; @@ -546,6 +547,7 @@ keyboardButtonGame#50f41ccf text:string = KeyboardButton; keyboardButtonBuy#afd93fbb text:string = KeyboardButton; keyboardButtonUrlAuth#10b78d29 flags:# text:string fwd_text:flags.0?string url:string button_id:int = KeyboardButton; inputKeyboardButtonUrlAuth#d02e7fd4 flags:# request_write_access:flags.0?true text:string fwd_text:flags.1?string url:string bot:InputUser = KeyboardButton; +keyboardButtonRequestPoll#bbc7515d flags:# quiz:flags.0?Bool text:string = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; @@ -1015,11 +1017,11 @@ help.userInfo#1eb3758 message:string entities:Vector author:strin pollAnswer#6ca9c2e9 text:string option:bytes = PollAnswer; -poll#d5529d06 id:long flags:# closed:flags.0?true question:string answers:Vector = Poll; +poll#d5529d06 id:long flags:# closed:flags.0?true public_voters:flags.1?true multiple_choice:flags.2?true quiz:flags.3?true question:string answers:Vector = Poll; -pollAnswerVoters#3b6ddad2 flags:# chosen:flags.0?true option:bytes voters:int = PollAnswerVoters; +pollAnswerVoters#3b6ddad2 flags:# chosen:flags.0?true correct:flags.1?true option:bytes voters:int = PollAnswerVoters; -pollResults#5755785a flags:# min:flags.0?true results:flags.1?Vector total_voters:flags.2?int = PollResults; +pollResults#c87024a2 flags:# min:flags.0?true results:flags.1?Vector total_voters:flags.2?int recent_voters:flags.3?Vector = PollResults; chatOnlines#f041e250 onlines:int = ChatOnlines; @@ -1077,16 +1079,11 @@ restrictionReason#d072acb4 platform:string reason:string text:string = Restricti inputTheme#3c5693e9 id:long access_hash:long = InputTheme; inputThemeSlug#f5890df1 slug:string = InputTheme; -themeDocumentNotModified#483d270c = Theme; theme#28f1114 flags:# creator:flags.0?true default:flags.1?true id:long access_hash:long slug:string title:string document:flags.2?Document settings:flags.3?ThemeSettings installs_count:int = Theme; account.themesNotModified#f41eb622 = account.Themes; account.themes#7f676421 hash:int themes:Vector = account.Themes; -wallet.liteResponse#764386d7 response:bytes = wallet.LiteResponse; - -wallet.secretSalt#dd484d64 salt:bytes = wallet.KeySecretSalt; - auth.loginToken#629f1980 expires:int token:bytes = auth.LoginToken; auth.loginTokenMigrateTo#68e9916 dc_id:int token:bytes = auth.LoginToken; auth.loginTokenSuccess#390d5c5e authorization:auth.Authorization = auth.LoginToken; @@ -1107,6 +1104,12 @@ themeSettings#9c14984a flags:# base_theme:BaseTheme accent_color:int message_top webPageAttributeTheme#54b56617 flags:# documents:flags.0?Vector settings:flags.1?ThemeSettings = WebPageAttribute; +messageUserVote#a28e5559 user_id:int option:bytes date:int = MessageUserVote; +messageUserVoteInputOption#36377430 user_id:int date:int = MessageUserVote; +messageUserVoteMultiple#e8fe0de user_id:int options:Vector date:int = MessageUserVote; + +messages.votesList#823f649 flags:# count:int votes:Vector users:Vector next_offset:flags.0?string = messages.VotesList; + ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; @@ -1343,6 +1346,7 @@ messages.getScheduledHistory#e2c2685b peer:InputPeer hash:int = messages.Message messages.getScheduledMessages#bdbb0464 peer:InputPeer id:Vector = messages.Messages; messages.sendScheduledMessages#bd38850a peer:InputPeer id:Vector = Updates; messages.deleteScheduledMessages#59ae2b16 peer:InputPeer id:Vector = Updates; +messages.getPollVotes#b86e380e flags:# peer:InputPeer id:int option:flags.0?bytes offset:flags.1?string limit:int = messages.VotesList; updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; @@ -1354,7 +1358,7 @@ photos.deletePhotos#87cf7f2f id:Vector = Vector; photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos; upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool; -upload.getFile#b15a9afc flags:# precise:flags.0?true location:InputFileLocation offset:int limit:int = upload.File; +upload.getFile#b15a9afc flags:# precise:flags.0?true cdn_supported:flags.1?true location:InputFileLocation offset:int limit:int = upload.File; upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool; upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile; upload.getCdnFile#2000bcc3 file_token:bytes offset:int limit:int = upload.CdnFile; @@ -1451,7 +1455,4 @@ langpack.getLanguage#6a596502 lang_pack:string lang_code:string = LangPackLangua folders.editPeerFolders#6847d0ab folder_peers:Vector = Updates; folders.deleteFolder#1c295881 folder_id:int = Updates; -wallet.sendLiteRequest#e2c9d33e body:bytes = wallet.LiteResponse; -wallet.getKeySecretSalt#b57f346 revoke:Bool = wallet.KeySecretSalt; - -// LAYER 108 +// LAYER 109 diff --git a/Telegram/Resources/uwp/AppX/AppxManifest.xml b/Telegram/Resources/uwp/AppX/AppxManifest.xml index 664e29634..a281d969f 100644 --- a/Telegram/Resources/uwp/AppX/AppxManifest.xml +++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml @@ -9,7 +9,7 @@ + Version="1.9.7.0" /> Telegram Desktop Telegram FZ-LLC diff --git a/Telegram/Resources/winrc/Telegram.manifest b/Telegram/Resources/winrc/Telegram.manifest index da510ee48..4eba5dde5 100644 --- a/Telegram/Resources/winrc/Telegram.manifest +++ b/Telegram/Resources/winrc/Telegram.manifest @@ -1,17 +1,17 @@  - - - + + + - + - + \ No newline at end of file diff --git a/Telegram/SourceFiles/api/api_common.h b/Telegram/SourceFiles/api/api_common.h index 25e737d14..beb73081f 100644 --- a/Telegram/SourceFiles/api/api_common.h +++ b/Telegram/SourceFiles/api/api_common.h @@ -21,6 +21,7 @@ struct SendOptions { enum class SendType { Normal, Scheduled, + ScheduledToUser, // For "Send when online". }; struct SendAction { diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 64a4432f1..3866d85b8 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -5842,12 +5842,24 @@ void ApiWrap::createPoll( sendFlags |= MTPmessages_SendMedia::Flag::f_schedule_date; } + const auto inputFlags = data.quiz() + ? MTPDinputMediaPoll::Flag::f_correct_answers + : MTPDinputMediaPoll::Flag(0); + auto correct = QVector(); + for (const auto &answer : data.answers) { + if (answer.correct) { + correct.push_back(MTP_bytes(answer.option)); + } + } const auto replyTo = action.replyTo; history->sendRequestId = request(MTPmessages_SendMedia( MTP_flags(sendFlags), peer->input, MTP_int(replyTo), - MTP_inputMediaPoll(PollDataToMTP(&data)), + MTP_inputMediaPoll( + MTP_flags(inputFlags), + PollDataToMTP(&data), + MTP_vector(correct)), MTP_string(), MTP_long(rand_value()), MTPReplyMarkup(), @@ -5879,13 +5891,13 @@ void ApiWrap::sendPollVotes( const auto hideSending = [=] { if (showSending) { if (const auto item = _session->data().message(itemId)) { - poll->sendingVote = QByteArray(); + poll->sendingVotes.clear(); _session->data().requestItemRepaint(item); } } }; if (showSending) { - poll->sendingVote = options.front(); + poll->sendingVotes = options; _session->data().requestItemRepaint(item); } @@ -5921,12 +5933,24 @@ void ApiWrap::closePoll(not_null item) { return; } + const auto inputFlags = poll->quiz() + ? MTPDinputMediaPoll::Flag::f_correct_answers + : MTPDinputMediaPoll::Flag(0); + auto correct = QVector(); + for (const auto &answer : poll->answers) { + if (answer.correct) { + correct.push_back(MTP_bytes(answer.option)); + } + } const auto requestId = request(MTPmessages_EditMessage( MTP_flags(MTPmessages_EditMessage::Flag::f_media), item->history()->peer->input, MTP_int(item->id), MTPstring(), - MTP_inputMediaPoll(PollDataToMTP(poll)), + MTP_inputMediaPoll( + MTP_flags(inputFlags), + PollDataToMTP(poll, true), + MTP_vector(correct)), MTPReplyMarkup(), MTPVector(), MTP_int(0) // schedule_date diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index f5b103af8..198f4867f 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -41,6 +41,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "numbers.h" #include "observer_peer.h" #include "main/main_session.h" +#include "styles/style_boxes.h" #include "styles/style_overview.h" #include "styles/style_mediaview.h" #include "styles/style_chat_helpers.h" @@ -180,6 +181,8 @@ namespace App { prepareCorners(MessageInSelectedCorners, st::historyMessageRadius, st::msgInBgSelected, &st::msgInShadowSelected); prepareCorners(MessageOutCorners, st::historyMessageRadius, st::msgOutBg, &st::msgOutShadow); prepareCorners(MessageOutSelectedCorners, st::historyMessageRadius, st::msgOutBgSelected, &st::msgOutShadowSelected); + + prepareCorners(SendFilesBoxAlbumGroupCorners, st::sendBoxAlbumGroupRadius, st::callFingerprintBg); } void createCorners() { diff --git a/Telegram/SourceFiles/app.h b/Telegram/SourceFiles/app.h index 5f7173781..5f828d675 100644 --- a/Telegram/SourceFiles/app.h +++ b/Telegram/SourceFiles/app.h @@ -63,6 +63,8 @@ enum RoundCorners : int { MessageOutCorners, MessageOutSelectedCorners, + SendFilesBoxAlbumGroupCorners, + RoundCornersCount }; diff --git a/Telegram/SourceFiles/boxes/boxes.style b/Telegram/SourceFiles/boxes/boxes.style index 27ddf7f3b..f1fc45e13 100644 --- a/Telegram/SourceFiles/boxes/boxes.style +++ b/Telegram/SourceFiles/boxes/boxes.style @@ -514,6 +514,29 @@ editMediaButton: IconButton { ripple: defaultRippleAnimation; } +// SendFilesBox + +sendBoxAlbumGroupEditInternalSkip: 9px; +sendBoxAlbumGroupSkipRight: 6px; +sendBoxAlbumGroupSkipTop: 6px; +sendBoxAlbumGroupRadius: 12px; +sendBoxAlbumGroupHeight: 25px; + +sendBoxAlbumGroupEditButtonIcon: editMediaButtonIconPhoto; +sendBoxAlbumGroupEditButtonIconPosition: point(4px, -1px); + +sendBoxAlbumGroupButtonFile: IconButton(editMediaButton) { + ripple: RippleAnimation(defaultRippleAnimation) { + color: windowBgRipple; + } +} + +sendBoxAlbumGroupDeleteButtonIconPosition: point(-3px, 0px); +sendBoxAlbumGroupDeleteButtonIcon: icon {{ "history_file_cancel", msgServiceFg}}; +sendBoxAlbumGroupDeleteButtonIconFile: icon {{ "history_file_cancel", menuIconFg, point(6px, 6px) }}; + +// End of SendFilesBox + calendarTitleHeight: boxTitleHeight; calendarPrevious: IconButton { width: calendarTitleHeight; @@ -812,15 +835,15 @@ createPollField: InputField(defaultInputField) { } createPollFieldPadding: margins(22px, 5px, 22px, 5px); createPollOptionField: InputField(createPollField) { - textMargins: margins(22px, 8px, 40px, 8px); + textMargins: margins(22px, 11px, 40px, 11px); placeholderMargins: margins(2px, 0px, 2px, 0px); - heightMax: 64px; + heightMax: 68px; } createPollLimitLabel: FlatLabel(defaultFlatLabel) { minWidth: 274px; align: align(topleft); } -createPollLimitPadding: margins(22px, 10px, 22px, 5px); +createPollLimitPadding: margins(22px, 10px, 22px, 16px); createPollOptionRemove: CrossButton { width: 22px; height: 22px; @@ -841,7 +864,7 @@ createPollOptionRemove: CrossButton { color: windowBgOver; } } -createPollOptionRemovePosition: point(10px, 7px); +createPollOptionRemovePosition: point(11px, 9px); createPollWarning: FlatLabel(defaultFlatLabel) { textFg: windowSubTextFg; palette: TextPalette(defaultTextPalette) { @@ -849,6 +872,8 @@ createPollWarning: FlatLabel(defaultFlatLabel) { } } createPollWarningPosition: point(16px, 6px); +createPollCheckboxMargin: margins(23px, 10px, 23px, 10px); +createPollFieldTitlePadding: margins(22px, 7px, 10px, 6px); callSettingsButton: IconButton { width: 50px; @@ -922,6 +947,33 @@ customBadgeField: InputField(defaultInputField) { heightMin: 32px; } +pollResultsQuestion: FlatLabel(defaultFlatLabel) { + minWidth: 320px; + textFg: windowBoldFg; + style: TextStyle(defaultTextStyle) { + font: font(16px semibold); + linkFont: font(16px semibold); + linkFontOver: font(16px semibold underline); + } +} +pollResultsVotesCount: FlatLabel(defaultFlatLabel) { + textFg: windowSubTextFg; +} +pollResultsHeaderPadding: margins(22px, 22px, 22px, 8px); +pollResultsShowMore: SettingsButton { + textFg: lightButtonFg; + textFgOver: lightButtonFgOver; + textBg: windowBg; + textBgOver: windowBgOver; + + font: semiboldFont; + + height: 20px; + padding: margins(71px, 10px, 8px, 8px); + + ripple: defaultRippleAnimation; +} + fontsBoxTextStyle: TextStyle(defaultTextStyle) { font: font(13px); linkFont: font(13px); diff --git a/Telegram/SourceFiles/boxes/create_poll_box.cpp b/Telegram/SourceFiles/boxes/create_poll_box.cpp index 11d44d311..1d9b433bf 100644 --- a/Telegram/SourceFiles/boxes/create_poll_box.cpp +++ b/Telegram/SourceFiles/boxes/create_poll_box.cpp @@ -12,10 +12,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/toast/toast.h" #include "ui/wrap/vertical_layout.h" #include "ui/wrap/slide_wrap.h" +#include "ui/wrap/fade_wrap.h" #include "ui/widgets/input_fields.h" #include "ui/widgets/shadow.h" #include "ui/widgets/labels.h" #include "ui/widgets/buttons.h" +#include "ui/widgets/checkbox.h" +#include "ui/toast/toast.h" #include "main/main_session.h" #include "chat_helpers/emoji_suggestions_widget.h" #include "chat_helpers/message_field.h" @@ -42,13 +45,16 @@ public: Options( not_null outer, not_null container, - not_null session); + not_null session, + bool chooseCorrectEnabled); [[nodiscard]] bool isValid() const; [[nodiscard]] rpl::producer isValidChanged() const; [[nodiscard]] std::vector toPollAnswers() const; void focusFirst(); + void enableChooseCorrect(bool enabled); + [[nodiscard]] rpl::producer usedCount() const; [[nodiscard]] rpl::producer> scrollToWidget() const; [[nodiscard]] rpl::producer<> backspaceInFront() const; @@ -56,23 +62,31 @@ public: private: class Option { public: - static Option Create( + Option( not_null outer, not_null container, not_null session, - int position); + int position, + std::shared_ptr group); + + Option(const Option &other) = delete; + Option &operator=(const Option &other) = delete; void toggleRemoveAlways(bool toggled); + void enableChooseCorrect( + std::shared_ptr group); void show(anim::type animated); void destroy(FnMut done); - //[[nodisacrd]] bool hasShadow() const; - //void destroyShadow(); + [[nodisacrd]] bool hasShadow() const; + void createShadow(); + void destroyShadow(); [[nodiscard]] bool isEmpty() const; [[nodiscard]] bool isGood() const; [[nodiscard]] bool isTooLong() const; + [[nodiscard]] bool isCorrect() const; [[nodiscard]] bool hasFocus() const; void setFocus() const; void clearValue(); @@ -86,29 +100,18 @@ private: [[nodiscard]] rpl::producer removeClicks() const; - inline bool operator<(const Option &other) const { - return field() < other.field(); - } - - friend inline bool operator<( - const Option &option, - Ui::InputField *field) { - return option.field() < field; - } - friend inline bool operator<( - Ui::InputField *field, - const Option &option) { - return field < option.field(); - } - private: - Option() = default; - - void createShadow(); void createRemove(); void createWarning(); + void toggleCorrectSpace(bool visible); + void updateFieldGeometry(); - base::unique_qptr> _field; + base::unique_qptr> _wrap; + not_null _content; + base::unique_qptr> _correct; + Ui::Animations::Simple _correctShown; + bool _hasCorrect = false; + Ui::InputField *_field = nullptr; base::unique_qptr _shadow; base::unique_qptr _remove; rpl::variable *_removeAlways = nullptr; @@ -116,23 +119,26 @@ private: }; [[nodiscard]] bool full() const; - //[[nodiscard]] bool correctShadows() const; - //void fixShadows(); + [[nodiscard]] bool correctShadows() const; + void fixShadows(); void removeEmptyTail(); void addEmptyOption(); void checkLastOption(); void validateState(); void fixAfterErase(); - void destroy(Option &&option); - void removeDestroyed(not_null field); + void destroy(std::unique_ptr